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

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

Issue 312793002: dart2dart: Preserve variable names throughout the IR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
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 import "package:expect/expect.dart";
6
7 class Foo {
8 var field = 0;
9 }
10
11 bar(x,y) {
12 return x * 100 + y;
13 }
14
15 foo(z) {
16 var x = 0, y = x;
17 if (z > 0) {
18 x = 10;
19 }
20 if (z > 10) {
21 y = 20;
22 }
23 return bar(x,y);
asgerf 2014/06/03 14:37:17 Without register allocation, this reference to 'y'
sigurdm 2014/06/04 07:51:57 This could maybe be a comment in the code for late
24 }
25
26 baz(z) {
27 var f = new Foo()
28 ..field = 10
29 ..field = z;
30 return f;
31 }
32
33 main() {
34 Expect.equals(0, foo(0));
35 Expect.equals(1000, foo(5));
36 Expect.equals(1020, foo(15));
37
38 Expect.equals(20, baz(20).field);
39 Expect.equals(30, baz(30).field);
40 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698