| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 // Dart test program for testing the prohibited use of a variable before it has | |
| 5 // been declared, which is not trivial to detect in the context of a variable | |
| 6 // declaration shadowing another one. | |
| 7 | |
| 8 class ScopeNegativeTest { | |
| 9 static testMain() { | |
| 10 var a = 1; | |
| 11 { | |
| 12 var b = 2; | |
| 13 var c = a; // Use of 'a' prior to its shadow declaration below. | |
| 14 var d = b + c; | |
| 15 var a = 5; // Shadow declaration of 'a'. | |
| 16 return d + a; | |
| 17 } | |
| 18 } | |
| 19 } | |
| 20 | |
| 21 | |
| 22 main() { | |
| 23 ScopeNegativeTest.testMain(); | |
| 24 } | |
| OLD | NEW |