| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Check that we can use pseudo keywords as names in function level code. | 4 // Check that we can use pseudo keywords as names in function level code. |
| 5 | 5 |
| 6 | 6 |
| 7 class PseudoKWTest { | 7 class PseudoKWTest { |
| 8 static testMain() { | 8 static testMain() { |
| 9 | 9 |
| 10 // This list is taken from the 'identifier' production | 10 // This is a list of built-in identifiers from the Dart spec. |
| 11 // of the Dart grammar. It lists all the pseudo-keywords | 11 // It sanity checks that these pseudo-keywords are legal identifiers. |
| 12 // that are legal identifiers at the function level. | |
| 13 | 12 |
| 14 var abstract = 0; | 13 var abstract = 0; |
| 14 var assert = 0; |
| 15 var call = 0; |
| 16 var Dynamic = 0; |
| 15 var factory = 0; | 17 var factory = 0; |
| 16 var get = 0; | 18 var get = 0; |
| 17 var implements = 0; | 19 var implements = 0; |
| 18 var import = 0; | 20 var import = 0; |
| 19 var interface = 0; | 21 var interface = 0; |
| 20 var library = 0; | 22 var library = 0; |
| 21 var native = 0; | |
| 22 var negate = 0; | 23 var negate = 0; |
| 23 var operator = 0; | 24 var operator = 0; |
| 24 var set = 0; | 25 var set = 0; |
| 25 var source = 0; | 26 var source = 0; |
| 26 var static = 0; | 27 var static = 0; |
| 28 var typedef = 0; |
| 29 |
| 30 // "native" is a per-implementation extension that is not a part of the |
| 31 // Dart language. While it is not an official built-in identifier, it |
| 32 // is useful to ensure that it remains a legal identifier. |
| 33 var native = 0; |
| 34 |
| 35 |
| 36 // The code below adds a few additional variants of usage without any |
| 37 // attempt at complete coverage. |
| 27 { | 38 { |
| 28 void factory(set) { | 39 void factory(set) { |
| 29 return 0; | 40 return 0; |
| 30 } | 41 } |
| 31 } | 42 } |
| 32 | 43 |
| 33 get: while (import > 0) { | 44 get: while (import > 0) { |
| 34 break get; | 45 break get; |
| 35 } | 46 } |
| 36 | 47 |
| 37 return static + library * operator; | 48 return static + library * operator; |
| 38 } | 49 } |
| 39 } | 50 } |
| 40 | 51 |
| 41 | 52 |
| 42 main() { | 53 main() { |
| 43 PseudoKWTest.testMain(); | 54 PseudoKWTest.testMain(); |
| 44 } | 55 } |
| OLD | NEW |