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

Side by Side Diff: dart/tests/compiler/dart2js_extra/closure7_test.dart

Issue 10831332: Support new getter syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments and disable one test. Created 8 years, 4 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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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 var foo; 5 var foo;
6 bar() => foo(3, 99); 6 bar() => foo(3, 99);
7 gee(f) => foo(fun: f); 7 gee(f) => foo(fun: f);
8 8
9 get foo2() => foo; 9 get foo2 => foo;
10 bar2() => foo2(3, 99); 10 bar2() => foo2(3, 99);
11 gee2(f) => foo2(fun: f); 11 gee2(f) => foo2(fun: f);
12 12
13 globalTest() { 13 globalTest() {
14 foo = () => 499; 14 foo = () => 499;
15 Expect.equals(499, foo()); 15 Expect.equals(499, foo());
16 foo = (x, y) => x + y; 16 foo = (x, y) => x + y;
17 Expect.equals(102, bar()); 17 Expect.equals(102, bar());
18 foo = ([fun = null]) => fun(41); 18 foo = ([fun = null]) => fun(41);
19 Expect.equals(42, gee((x) => x + 1)); 19 Expect.equals(42, gee((x) => x + 1));
20 20
21 foo = () => 499; 21 foo = () => 499;
22 Expect.equals(499, foo2()); 22 Expect.equals(499, foo2());
23 foo = (x, y) => x + y; 23 foo = (x, y) => x + y;
24 Expect.equals(102, bar2()); 24 Expect.equals(102, bar2());
25 foo = ([fun = null]) => fun(41); 25 foo = ([fun = null]) => fun(41);
26 Expect.equals(42, gee2((x) => x + 1)); 26 Expect.equals(42, gee2((x) => x + 1));
27 } 27 }
28 28
29 class A { 29 class A {
30 static var foo; 30 static var foo;
31 static bar() => foo(3, 99); 31 static bar() => foo(3, 99);
32 static gee(f) => foo(fun: f); 32 static gee(f) => foo(fun: f);
33 33
34 static get foo2() => foo; 34 static get foo2 => foo;
35 static bar2() => foo2(3, 99); 35 static bar2() => foo2(3, 99);
36 static gee2(f) => foo2(fun: f); 36 static gee2(f) => foo2(fun: f);
37 } 37 }
38 38
39 staticTest() { 39 staticTest() {
40 A.foo = () => 499; 40 A.foo = () => 499;
41 Expect.equals(499, A.foo()); 41 Expect.equals(499, A.foo());
42 A.foo = (x, y) => x + y; 42 A.foo = (x, y) => x + y;
43 Expect.equals(102, A.bar()); 43 Expect.equals(102, A.bar());
44 A.foo = ([fun = null]) => fun(41); 44 A.foo = ([fun = null]) => fun(41);
45 Expect.equals(42, A.gee((x) => x + 1)); 45 Expect.equals(42, A.gee((x) => x + 1));
46 46
47 A.foo = () => 499; 47 A.foo = () => 499;
48 Expect.equals(499, A.foo2()); 48 Expect.equals(499, A.foo2());
49 A.foo = (x, y) => x + y; 49 A.foo = (x, y) => x + y;
50 Expect.equals(102, A.bar2()); 50 Expect.equals(102, A.bar2());
51 A.foo = ([fun = null]) => fun(41); 51 A.foo = ([fun = null]) => fun(41);
52 Expect.equals(42, A.gee2((x) => x + 1)); 52 Expect.equals(42, A.gee2((x) => x + 1));
53 } 53 }
54 54
55 main() { 55 main() {
56 globalTest(); 56 globalTest();
57 staticTest(); 57 staticTest();
58 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698