Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: tests/language/await_postfix_expr_test.dart

Issue 989633003: Fix await x++ (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/ast_transformer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, 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 import "dart:async";
6 import "package:expect/expect.dart";
7 import "package:async_helper/async_helper.dart";
8
9
10 post0(a) async {
11 return await a++;
12 }
13
14 post1(a) async {
15 return await a++ + await a++;
16 }
17
18 pref0(a) async {
19 return await ++a;
20 }
21
22 pref1(a) async {
23 return await ++a + await ++a;
24 }
25
26 sum(a) async {
27 var s = 0;
28 for (int i = 0; i < a.length; /* nothing */) {
29 s += a[await i++];
30 }
31 return s;
32 }
33
34 test() async {
35 Expect.equals(10, await post0(10));
36 Expect.equals(21, await post1(10));
37 Expect.equals(11, await pref0(10));
38 Expect.equals(23, await pref1(10));
39 Expect.equals(10, await sum([1, 2, 3, 4]));
40 }
41
42 main() {
43 asyncStart();
44 test().then((_) {
45 asyncEnd();
46 });
47 }
OLDNEW
« no previous file with comments | « runtime/vm/ast_transformer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698