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

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

Issue 1382123003: Fix await transformation of function calls (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« runtime/vm/ast_transformer.cc ('K') | « 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
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 5
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 later(vodka) => new Future.value(vodka); 10 later(vodka) => new Future.value(vodka);
(...skipping 12 matching lines...) Expand all
23 addLater({a, b}) => new Future.value(a + b); 23 addLater({a, b}) => new Future.value(a + b);
24 24
25 // Regression test for issue 21480. 25 // Regression test for issue 21480.
26 testNamedArguments() async { 26 testNamedArguments() async {
27 var sum = await addLater(a:5, b:10); 27 var sum = await addLater(a:5, b:10);
28 Expect.equals(sum, 15); 28 Expect.equals(sum, 15);
29 sum = await addLater(b:11, a:-11); 29 sum = await addLater(b:11, a:-11);
30 Expect.equals(sum, 0); 30 Expect.equals(sum, 0);
31 } 31 }
32 32
33 testSideEffects() async {
34 Future foo(int a1, int a2) {
35 Expect.equals(10, a1);
36 Expect.equals(11, a2);
37 return new Future.value();
38 }
39 int a = 10;
40 await foo(a++, a++);
41 Expect.equals(12, a);
42 }
43
33 main() async { 44 main() async {
34 testNestedFunctions(); 45 testNestedFunctions();
35 testNamedArguments(); 46 testNamedArguments();
47 testSideEffects();
36 } 48 }
OLDNEW
« runtime/vm/ast_transformer.cc ('K') | « runtime/vm/ast_transformer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698