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.
|
||||
* 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
|
||||
|
||||
* 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.
|
||||
|
||||
main() {
|
||||
// This call is no longer on the stack when the error is thrown.
|
||||
/*:main*/ test();
|
||||
/*1:main*/ test();
|
||||
}
|
||||
|
||||
test() async {
|
||||
/*1:test*/ throw '>ExceptionMarker<';
|
||||
test /*ddk.2:test*/ () /*ddc.2:test*/ async {
|
||||
/*3:test*/ throw '>ExceptionMarker<';
|
||||
}
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
main() {
|
||||
test1();
|
||||
/*1:main*/ test1();
|
||||
}
|
||||
|
||||
test1() async {
|
||||
// This call is no longer on the stack when the error is thrown.
|
||||
await /*:test1*/ test2();
|
||||
test1 /*ddk.2:test1*/ () /*ddc.2:test1*/ async {
|
||||
await /*3:test1*/ test2();
|
||||
}
|
||||
|
||||
test2() async {
|
||||
/*1:test2*/ throw '>ExceptionMarker<';
|
||||
test2 /*ddk.4:test2*/ () /*ddc.4:test2*/ async {
|
||||
/*5:test2*/ throw '>ExceptionMarker<';
|
||||
}
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
|
||||
main() {
|
||||
// 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
|
||||
var c = new /*1:test*/ Class();
|
||||
var c = new /*3:test*/ Class();
|
||||
}
|
||||
|
||||
class Class {
|
||||
Class() {
|
||||
// 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.
|
||||
|
||||
main() {
|
||||
test1();
|
||||
/*1:main*/ test1();
|
||||
}
|
||||
|
||||
test1() async {
|
||||
/*1:test1*/ test2();
|
||||
test1 /*ddk.2:test1*/ () /*ddc.2:test1*/ async {
|
||||
/*3:test1*/ test2();
|
||||
}
|
||||
|
||||
test2() {
|
||||
/*2:test2*/ throw '>ExceptionMarker<';
|
||||
/*4:test2*/ throw '>ExceptionMarker<';
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
main() {
|
||||
/*bl*/
|
||||
/*s:1*/ foo();
|
||||
/*nbb:0:3*/ /*s:3*/
|
||||
/*s:4*/
|
||||
}
|
||||
|
||||
foo() async {
|
||||
/*nbb:0:4*/ /*bc:4*/ print("hello from foo");
|
||||
/*s:2*/
|
||||
foo() /*sl:2*/ async {
|
||||
print("hello from foo");
|
||||
/*s:3*/
|
||||
}
|
||||
|
|
|
@ -60,12 +60,6 @@ if [ "$1" = "-k" ]; then
|
|||
shift
|
||||
fi
|
||||
|
||||
SYNC_ASYNC=false
|
||||
if [ "$1" = "--sync-async" ]; then
|
||||
SYNC_ASYNC=true
|
||||
shift
|
||||
fi
|
||||
|
||||
BASENAME=$( basename "${1%.*}")
|
||||
LIBROOT=$(cd $( dirname "${1%.*}") && pwd)
|
||||
|
||||
|
@ -110,7 +104,6 @@ echo "
|
|||
let sdk = require(\"dart_sdk\");
|
||||
let main = require(\"./$BASENAME\").$BASENAME.main;
|
||||
sdk.dart.ignoreWhitelistedErrors(false);
|
||||
if ($SYNC_ASYNC) sdk.dart.setStartAsyncSynchronously();
|
||||
try {
|
||||
sdk._isolate_helper.startRootIsolate(main, []);
|
||||
} catch(e) {
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
/// stepping stone for proposed ES7 async/await, and uses ES6 Promises.
|
||||
part of dart._runtime;
|
||||
|
||||
// TODO(vsm): Remove once this flag is the default.
|
||||
bool startAsyncSynchronously = false;
|
||||
// TODO(vsm): Remove once this flag we've removed the ability to
|
||||
// whitelist / fallback on the old behavior.
|
||||
bool startAsyncSynchronously = true;
|
||||
void setStartAsyncSynchronously([bool value = true]) {
|
||||
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
|
||||
/// or extension, like "math_test". The [testJSDir] is the relative path to the
|
||||
/// build directory where the dartdevc-generated JS file is stored.
|
||||
String dartdevcHtml(String testName, String testJSDir, String buildDir,
|
||||
{bool syncAsync}) {
|
||||
String dartdevcHtml(String testName, String testJSDir, String buildDir) {
|
||||
var packagePaths = testPackages
|
||||
.map((package) => ' "$package": "/root_dart/$buildDir/gen/utils/'
|
||||
'dartdevc/pkg/$package",')
|
||||
|
@ -87,7 +86,6 @@ window.ddcSettings = {
|
|||
requirejs(["$testName", "dart_sdk", "async_helper"],
|
||||
function($testName, sdk, async_helper) {
|
||||
sdk.dart.ignoreWhitelistedErrors(false);
|
||||
if ($syncAsync) sdk.dart.setStartAsyncSynchronously();
|
||||
// TODO(rnystrom): This uses DDC's forked version of async_helper. Unfork
|
||||
// these packages when possible.
|
||||
async_helper.async_helper.asyncTestInitialize(function() {});
|
||||
|
|
|
@ -1062,7 +1062,7 @@ class StandardTestSuite extends TestSuite {
|
|||
// Always run with synchronous starts of `async` functions.
|
||||
// If we want to make this dependent on other parameters or flags,
|
||||
// this flag could be become conditional.
|
||||
content = dartdevcHtml(nameNoExt, jsDir, buildDir, syncAsync: true);
|
||||
content = dartdevcHtml(nameNoExt, jsDir, buildDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue