mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Flip DDC to default to sync-async
See #32868 Change-Id: I757321632c9f383edea398741c67fc7c3e3815e5 Reviewed-on: https://dart-review.googlesource.com/52900 Commit-Queue: Vijay Menon <vsm@google.com> Reviewed-by: Jenny Messerly <jmesserly@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
parent
a31d24dbd8
commit
001af89c8e
|
@ -23,6 +23,12 @@
|
||||||
* Force splitting an empty block as the then body of an if with an else.
|
* Force splitting an empty block as the then body of an if with an else.
|
||||||
* Uses the new lowercase Dart 2 constant names.
|
* Uses the new lowercase Dart 2 constant names.
|
||||||
|
|
||||||
|
#### Dart Dev Compiler
|
||||||
|
|
||||||
|
* `async` functions now start synchronously by default. Build tools
|
||||||
|
(e.g., build_runner) may override the default and/or allow
|
||||||
|
developers to configure.
|
||||||
|
|
||||||
#### Pub
|
#### Pub
|
||||||
|
|
||||||
* The `build` and `serve` commands will now fail and point users to
|
* The `build` and `serve` commands will now fail and point users to
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
// This call is no longer on the stack when the error is thrown.
|
/*1:main*/ test();
|
||||||
/*:main*/ test();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test() async {
|
test /*ddk.2:test*/ () /*ddc.2:test*/ async {
|
||||||
/*1:test*/ throw '>ExceptionMarker<';
|
/*3:test*/ throw '>ExceptionMarker<';
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,13 @@
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
test1();
|
/*1:main*/ test1();
|
||||||
}
|
}
|
||||||
|
|
||||||
test1() async {
|
test1 /*ddk.2:test1*/ () /*ddc.2:test1*/ async {
|
||||||
// This call is no longer on the stack when the error is thrown.
|
await /*3:test1*/ test2();
|
||||||
await /*:test1*/ test2();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test2() async {
|
test2 /*ddk.4:test2*/ () /*ddc.4:test2*/ async {
|
||||||
/*1:test2*/ throw '>ExceptionMarker<';
|
/*5:test2*/ throw '>ExceptionMarker<';
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,17 +4,17 @@
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
// This call is no longer on the stack when the error is thrown.
|
// This call is no longer on the stack when the error is thrown.
|
||||||
/*:main*/ test();
|
/*1:main*/ test();
|
||||||
}
|
}
|
||||||
|
|
||||||
test() async {
|
test /*ddk.2:test*/ () /*ddc.2:test*/ async {
|
||||||
// ignore: UNUSED_LOCAL_VARIABLE
|
// ignore: UNUSED_LOCAL_VARIABLE
|
||||||
var c = new /*1:test*/ Class();
|
var c = new /*3:test*/ Class();
|
||||||
}
|
}
|
||||||
|
|
||||||
class Class {
|
class Class {
|
||||||
Class() {
|
Class() {
|
||||||
// Some comment
|
// Some comment
|
||||||
/*2:Class.new*/ throw '>ExceptionMarker<';
|
/*4:Class.new*/ throw '>ExceptionMarker<';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
test1();
|
/*1:main*/ test1();
|
||||||
}
|
}
|
||||||
|
|
||||||
test1() async {
|
test1 /*ddk.2:test1*/ () /*ddc.2:test1*/ async {
|
||||||
/*1:test1*/ test2();
|
/*3:test1*/ test2();
|
||||||
}
|
}
|
||||||
|
|
||||||
test2() {
|
test2() {
|
||||||
/*2:test2*/ throw '>ExceptionMarker<';
|
/*4:test2*/ throw '>ExceptionMarker<';
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
main() {
|
main() {
|
||||||
/*bl*/
|
/*bl*/
|
||||||
/*s:1*/ foo();
|
/*s:1*/ foo();
|
||||||
/*nbb:0:3*/ /*s:3*/
|
/*s:4*/
|
||||||
}
|
}
|
||||||
|
|
||||||
foo() async {
|
foo() /*sl:2*/ async {
|
||||||
/*nbb:0:4*/ /*bc:4*/ print("hello from foo");
|
print("hello from foo");
|
||||||
/*s:2*/
|
/*s:3*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,12 +60,6 @@ if [ "$1" = "-k" ]; then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SYNC_ASYNC=false
|
|
||||||
if [ "$1" = "--sync-async" ]; then
|
|
||||||
SYNC_ASYNC=true
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
|
|
||||||
BASENAME=$( basename "${1%.*}")
|
BASENAME=$( basename "${1%.*}")
|
||||||
LIBROOT=$(cd $( dirname "${1%.*}") && pwd)
|
LIBROOT=$(cd $( dirname "${1%.*}") && pwd)
|
||||||
|
|
||||||
|
@ -110,7 +104,6 @@ echo "
|
||||||
let sdk = require(\"dart_sdk\");
|
let sdk = require(\"dart_sdk\");
|
||||||
let main = require(\"./$BASENAME\").$BASENAME.main;
|
let main = require(\"./$BASENAME\").$BASENAME.main;
|
||||||
sdk.dart.ignoreWhitelistedErrors(false);
|
sdk.dart.ignoreWhitelistedErrors(false);
|
||||||
if ($SYNC_ASYNC) sdk.dart.setStartAsyncSynchronously();
|
|
||||||
try {
|
try {
|
||||||
sdk._isolate_helper.startRootIsolate(main, []);
|
sdk._isolate_helper.startRootIsolate(main, []);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
|
|
@ -11,8 +11,9 @@
|
||||||
/// stepping stone for proposed ES7 async/await, and uses ES6 Promises.
|
/// stepping stone for proposed ES7 async/await, and uses ES6 Promises.
|
||||||
part of dart._runtime;
|
part of dart._runtime;
|
||||||
|
|
||||||
// TODO(vsm): Remove once this flag is the default.
|
// TODO(vsm): Remove once this flag we've removed the ability to
|
||||||
bool startAsyncSynchronously = false;
|
// whitelist / fallback on the old behavior.
|
||||||
|
bool startAsyncSynchronously = true;
|
||||||
void setStartAsyncSynchronously([bool value = true]) {
|
void setStartAsyncSynchronously([bool value = true]) {
|
||||||
startAsyncSynchronously = value;
|
startAsyncSynchronously = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,7 @@ String dart2jsHtml(String title, String scriptPath) {
|
||||||
/// The [testName] is the short name of the test without any subdirectory path
|
/// The [testName] is the short name of the test without any subdirectory path
|
||||||
/// or extension, like "math_test". The [testJSDir] is the relative path to the
|
/// or extension, like "math_test". The [testJSDir] is the relative path to the
|
||||||
/// build directory where the dartdevc-generated JS file is stored.
|
/// build directory where the dartdevc-generated JS file is stored.
|
||||||
String dartdevcHtml(String testName, String testJSDir, String buildDir,
|
String dartdevcHtml(String testName, String testJSDir, String buildDir) {
|
||||||
{bool syncAsync}) {
|
|
||||||
var packagePaths = testPackages
|
var packagePaths = testPackages
|
||||||
.map((package) => ' "$package": "/root_dart/$buildDir/gen/utils/'
|
.map((package) => ' "$package": "/root_dart/$buildDir/gen/utils/'
|
||||||
'dartdevc/pkg/$package",')
|
'dartdevc/pkg/$package",')
|
||||||
|
@ -87,7 +86,6 @@ window.ddcSettings = {
|
||||||
requirejs(["$testName", "dart_sdk", "async_helper"],
|
requirejs(["$testName", "dart_sdk", "async_helper"],
|
||||||
function($testName, sdk, async_helper) {
|
function($testName, sdk, async_helper) {
|
||||||
sdk.dart.ignoreWhitelistedErrors(false);
|
sdk.dart.ignoreWhitelistedErrors(false);
|
||||||
if ($syncAsync) sdk.dart.setStartAsyncSynchronously();
|
|
||||||
// TODO(rnystrom): This uses DDC's forked version of async_helper. Unfork
|
// TODO(rnystrom): This uses DDC's forked version of async_helper. Unfork
|
||||||
// these packages when possible.
|
// these packages when possible.
|
||||||
async_helper.async_helper.asyncTestInitialize(function() {});
|
async_helper.async_helper.asyncTestInitialize(function() {});
|
||||||
|
|
|
@ -1062,7 +1062,7 @@ class StandardTestSuite extends TestSuite {
|
||||||
// Always run with synchronous starts of `async` functions.
|
// Always run with synchronous starts of `async` functions.
|
||||||
// If we want to make this dependent on other parameters or flags,
|
// If we want to make this dependent on other parameters or flags,
|
||||||
// this flag could be become conditional.
|
// this flag could be become conditional.
|
||||||
content = dartdevcHtml(nameNoExt, jsDir, buildDir, syncAsync: true);
|
content = dartdevcHtml(nameNoExt, jsDir, buildDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue