| 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 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 void testFunctionDefaults2() { | 297 void testFunctionDefaults2() { |
| 298 Expect.equals(10, helperFunctionDefaults2()); | 298 Expect.equals(10, helperFunctionDefaults2()); |
| 299 Expect.equals(1, helperFunctionDefaults2(1)); | 299 Expect.equals(1, helperFunctionDefaults2(1)); |
| 300 } | 300 } |
| 301 | 301 |
| 302 num helperFunctionDefaults2([a = 10]) { | 302 num helperFunctionDefaults2([a = 10]) { |
| 303 return ((){return a;})(); | 303 return ((){return a;})(); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void testEscapingFunctions() { | 306 void testEscapingFunctions() { |
| 307 f() { return 42; } | 307 f() { return 42; }; |
| 308 (() { Expect.equals(42, f()); })(); | 308 (() { Expect.equals(42, f()); })(); |
| 309 var o = new Bug4089219(42); | 309 var o = new Bug4089219(42); |
| 310 Expect.equals(42, (o.f)()); | 310 Expect.equals(42, (o.f)()); |
| 311 } | 311 } |
| 312 | 312 |
| 313 void testThisBinding() { | 313 void testThisBinding() { |
| 314 Expect.equals(this, () { return this; }()); | 314 Expect.equals(this, () { return this; }()); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| (...skipping 31 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 |