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

Side by Side Diff: tests/language/vm/optimized_await_regress_test.dart

Issue 653073002: Fix bug with captured parameters and optimized try-catch. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/scopes.h ('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) 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 --optimization-counter-threshold=10
6
7 // This tests that captured parameters (by the async-closure) are
8 // correctly treated in try-catch generated in the async function.
9 // They must be skipped when generating sync-code in the optimized
10 // try-block.
11
12 import 'package:expect/expect.dart';
13
14 import 'dart:async';
15
16 check(value) {
17 try {
18 } finally {
19 return value;
20 }
21 }
22
23 fail() {
24 try {
25 Expect.isTrue(false);
26 } finally { }
27 }
28
29 foo(i) async {
30 var k = await 77;
31 var a = "abc${k}";
32 if (a != "abc77") fail();
33 return k;
34 }
35
36
37 main() {
38 for (int i = 0; i < 20; i++) {
39 foo(i).then((value) => Expect.equals(77, value));
40 }
41 }
OLDNEW
« no previous file with comments | « runtime/vm/scopes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698