| OLD | NEW |
| (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 // Test parsing and resolution of argument definition test. | |
| 6 | |
| 7 int test(int a, {int b: 2, int c: 3}) { | |
| 8 int result = 0; | |
| 9 print(?b); | |
| 10 print(?result); /// 01: compile-time error | |
| 11 print(?a); | |
| 12 print(?b); | |
| 13 print(?c); | |
| 14 { | |
| 15 var b; | |
| 16 ?b; /// 02: compile-time error | |
| 17 } | |
| 18 print((!?a?!?b:!?c) == (?a??b:?c)); | |
| 19 print(!?a?!?b:!?c == ?a??b:?c); | |
| 20 } | |
| 21 | |
| 22 closure_test(int a, {int b: 2, int c: 3}) { | |
| 23 var x = 0; | |
| 24 return () { | |
| 25 int result = 0; | |
| 26 print(?b); | |
| 27 print(?result); /// 03: compile-time error | |
| 28 print(?x); /// 04: compile-time error | |
| 29 print(?a); | |
| 30 print(?b); | |
| 31 print(?c); | |
| 32 { | |
| 33 var b; | |
| 34 ?b; /// 05: compile-time error | |
| 35 } | |
| 36 print((!?a?!?b:!?c) == (?a??b:?c)); | |
| 37 print(!?a?!?b:!?c == ?a??b:?c); | |
| 38 }; | |
| 39 } | |
| 40 | |
| 41 main() { | |
| 42 test(1); | |
| 43 test(1, b: 2); | |
| 44 test(1, b: 2, c: 3); | |
| 45 test(1, c: 3); | |
| 46 | |
| 47 closure_test(1)(); | |
| 48 closure_test(1, b: 2)(); | |
| 49 closure_test(1, b: 2, c: 3)(); | |
| 50 closure_test(1, c: 3)(); | |
| 51 } | |
| OLD | NEW |