OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Tests function statements and expressions. | 5 // Tests function statements and expressions. |
6 | 6 |
7 class Bug4089219 { | 7 class Bug4089219 { |
8 int x; | 8 int x; |
9 var f; | 9 var f; |
10 | 10 |
11 Bug4089219(int i) : this.x = i { | 11 Bug4089219(int i) : this.x = i { |
12 f = () => x; | 12 f = () => x; |
13 } | 13 } |
14 } | 14 } |
15 | 15 |
16 class Bug4342163 { | 16 class Bug4342163 { |
17 final m; | 17 final m; |
18 Bug4342163(int a) : this.m = (() => a) {} | 18 Bug4342163(int a) : this.m = (() => a) {} |
19 } | 19 } |
20 | 20 |
21 class StaticFunctionDef { | 21 class StaticFunctionDef { |
22 static final int one = 1; | 22 static const int one = 1; |
23 static var fn1; | 23 static var fn1; |
24 static var fn2; | 24 static var fn2; |
25 static var fn3; | 25 static var fn3; |
26 | 26 |
27 static init() { | 27 static init() { |
28 fn1 = () { return one; }; | 28 fn1 = () { return one; }; |
29 fn2 = () { return (() { return one; })(); }; | 29 fn2 = () { return (() { return one; })(); }; |
30 fn3 = () { | 30 fn3 = () { |
31 final local = 1; | 31 final local = 1; |
32 return (() { return local; })(); | 32 return (() { return local; })(); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 fooIntString = foo; | 349 fooIntString = foo; |
350 | 350 |
351 uf = uf2; | 351 uf = uf2; |
352 uf2 = uf; | 352 uf2 = uf; |
353 } | 353 } |
354 } | 354 } |
355 | 355 |
356 main() { | 356 main() { |
357 FunctionTest.testMain(); | 357 FunctionTest.testMain(); |
358 } | 358 } |
OLD | NEW |