| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // VMOptions=--enable_async |
| 6 |
| 7 import 'dart:async'; |
| 8 |
| 9 import 'package:expect/expect.dart'; |
| 10 |
| 11 get await => 4; |
| 12 |
| 13 // For functions that are declared with the async modifier we treat await as |
| 14 // keyword. |
| 15 |
| 16 test0() async { |
| 17 var x = await 7; |
| 18 Expect.equals(7, x); |
| 19 var await = 1; /// await1: compile-time error |
| 20 } |
| 21 |
| 22 test1() async { |
| 23 var x = await 9; |
| 24 Expect.equals(9, x); |
| 25 var y = await; /// await2: compile-time error |
| 26 } |
| 27 |
| 28 // For functions that are not declared with the async modifier we allow await to |
| 29 // be used as an identifier. |
| 30 |
| 31 test2() { |
| 32 var y = await; |
| 33 Expect.equals(4, y); |
| 34 var x = await 1; /// await3: compile-time error |
| 35 } |
| 36 |
| 37 test3() { |
| 38 var await = 3; |
| 39 Expect.equals(3, await); |
| 40 var x = await 1; /// await4: compile-time error |
| 41 } |
| 42 |
| 43 main() { |
| 44 test0(); |
| 45 test1(); |
| 46 test2(); |
| 47 test3(); |
| 48 } |
| OLD | NEW |