| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Test compile-time errors for illegal variable declarations if the name | 5 // Test compile-time errors for illegal variable declarations if the name |
| 6 // has been referenced before the variable is declared. | 6 // has been referenced before the variable is declared. |
| 7 | 7 |
| 8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 use(value) => value; | 10 use(value) => value; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 if (true) { | 36 if (true) { |
| 37 use(x); // Refers to top-level x. | 37 use(x); // Refers to top-level x. |
| 38 use(y); // Refers to top-level y. | 38 use(y); // Refers to top-level y. |
| 39 } | 39 } |
| 40 final x = "I have not yet begun to procrastinate."; // //# 02: compile-time
error | 40 final x = "I have not yet begun to procrastinate."; // //# 02: compile-time
error |
| 41 const y = "Honk if you like peace and quiet!"; // //# 03: compile-time error | 41 const y = "Honk if you like peace and quiet!"; // //# 03: compile-time error |
| 42 } | 42 } |
| 43 | 43 |
| 44 void test4() { | 44 void test4() { |
| 45 void Q() { | 45 void Q() { |
| 46 P(); // Refers to non-existing top-level function P | 46 P(); //# 06: compile-time error |
| 47 } | 47 } |
| 48 void P() { // //# 06: compile-time error | 48 void P() { |
| 49 Q(); // //# 06: continued | 49 Q(); |
| 50 } // //# 06: continued | 50 } |
| 51 | 51 |
| 52 Function f = () {x = f;}; // //# 07: compile-time error | 52 Function f = () {x = f;}; // //# 07: compile-time error |
| 53 } | 53 } |
| 54 | 54 |
| 55 test() { | 55 test() { |
| 56 test1(); | 56 test1(); |
| 57 test2(); | 57 test2(); |
| 58 test3(); | 58 test3(); |
| 59 test4(); | 59 test4(); |
| 60 } | 60 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 88 var int = 007; | 88 var int = 007; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void main() { | 91 void main() { |
| 92 var c = new C(); | 92 var c = new C(); |
| 93 c.test(); | 93 c.test(); |
| 94 testTypeRef(); | 94 testTypeRef(); |
| 95 testLibPrefix(); | 95 testLibPrefix(); |
| 96 noErrorsExpected(); | 96 noErrorsExpected(); |
| 97 } | 97 } |
| OLD | NEW |