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

Side by Side Diff: tests/compiler/dart2js/closure/data/nested_closures.dart

Issue 3003963002: Add more tests for closures and change closure indexing to be by FunctionExpression or FunctionDecl… (Closed)
Patch Set: . Created 3 years, 3 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
OLDNEW
(Empty)
1 // Copyright (c) 2017, 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 /// Test boxing/captures for nested closures.
6
7 /*useOne:box=box0,boxed=[b1]*/ useOne(/*boxed*/ b1) {
8 /*box=box1,boxed=[b2],free=[b1,box0]*/ () {
9 var /*boxed*/ b2 = (b1 = 1);
10
11 /*free=[b2,box1]*/ () {
12 return (b2 = 2);
13 };
14
15 return b2;
16 };
17 return b1;
18 }
19
20 /*useBoth:box=box0,boxed=[b1]*/ useBoth(/*boxed*/ b1) {
21 /*box=box1,boxed=[b2],free=[b1,box0]*/ () {
22 var /*boxed*/ b2 = (b1 = 1);
23
24 /*free=[b1,b2,box0,box1]*/ () {
25 return b1 + (b2 = 2);
26 };
27
28 return b2;
29 };
30 return b1;
31 }
32
33 /*useMany:box=box0,boxed=[b1,b2,b3]*/ useMany(c1, /*boxed*/ b1) {
34 var /*boxed*/ b2 = 2;
35 var /*boxed*/ b3 = 3;
36 var c2 = 2;
37 var c3 = 3;
38 /*box=box1,boxed=[b4],free=[b1,b2,b3,box0,c1,c2,c3]*/ () {
39 var c4 = c1 + c2 + c3;
40 var /*boxed*/ b4 = (b1 = 1) + (b2 = 2) + (b3 = 3);
41
42 /*free=[b1,b2,b4,box0,box1,c4]*/ () {
43 return c4 + (b1 = 1) + (b2 = 2) + (b4 = 4);
44 };
45
46 return b4;
47 };
48 return b1 + b2 + b3 + c1 + c2 + c3;
49 }
50
51 main() {
52 useOne(1);
53 useBoth(1);
54 useMany(1, 2);
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698