mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:41:19 +00:00
ada21bfda6
The await “preamble” code must be part of the expression, not part of the body. Fixes issue 22777 R=srdjan@google.com Review URL: https://codereview.chromium.org//1012933002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44520 260f80e4-7a28-3924-810f-c04153c831b5
43 lines
764 B
Dart
43 lines
764 B
Dart
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import "package:async_helper/async_helper.dart";
|
|
import "package:expect/expect.dart";
|
|
|
|
var a = 0;
|
|
|
|
testSync () {
|
|
do {
|
|
continue;
|
|
} while (throw "Error");
|
|
a = 100;
|
|
}
|
|
|
|
testAsync() async {
|
|
do {
|
|
continue;
|
|
} while (await (throw "Error"));
|
|
a = 100;
|
|
}
|
|
|
|
test() async {
|
|
try {
|
|
testSync();
|
|
} catch (e) {
|
|
Expect.equals(e, "Error");
|
|
}
|
|
Expect.equals(a, 0);
|
|
|
|
try {
|
|
await testAsync();
|
|
} catch (e) {
|
|
Expect.equals(e, "Error");
|
|
}
|
|
Expect.equals(a, 0);
|
|
}
|
|
|
|
main() {
|
|
asyncStart();
|
|
test().then((_) => asyncEnd());
|
|
} |