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

Side by Side Diff: frog/tests/leg_only/closure_capture2_test.dart

Issue 10536169: Move frog/tests/{leg,leg_only,frog_native} to tests/compiler/. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | « frog/tests/leg_only/closure7_test.dart ('k') | frog/tests/leg_only/closure_capture3_test.dart » ('j') | 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) 2012, 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 closure0() {
6 // f and g will both capture a variable named 'x'. If we use the original
7 // name in the (shared) box then there will be troubles.
8 var f;
9 var g;
10 {
11 var x = 499;
12 // TODO(floitsch): remove name from functions.
13 f = fun() { return x; };
14 x++;
15 }
16 {
17 var x = 42;
18 // TODO(floitsch): remove name from functions.
19 g = fun() { return x; };
20 x++;
21 }
22 Expect.equals(500, f());
23 Expect.equals(43, g());
24 }
25
26 closure1() {
27 // f captures variable $0 which could yield to troubles with HForeign if we
28 // don't mangle correctly.
29 var $1 = 499;
30 // TODO(floitsch): remove name from functions.
31 var f = fun() { return $1; };
32 $1++;
33 Expect.equals(500, f());
34 }
35
36 main() {
37 closure0();
38 closure1();
39 }
OLDNEW
« no previous file with comments | « frog/tests/leg_only/closure7_test.dart ('k') | frog/tests/leg_only/closure_capture3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698