Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014, 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 main() { | |
| 6 var x; | |
| 7 | |
| 8 // 'void' is allowed as a symbol name. | |
| 9 x = const Symbol('void'); /// 01: ok | |
| 10 | |
| 11 // However, it is not allowed as a part of a symbol name. | |
| 12 x = const Symbol('void.foo'); /// 02: compile-time error | |
| 13 x = const Symbol('foo.void'); /// 03: compile-time error | |
| 14 | |
| 15 // All other reserved words are disallowed. | |
| 16 x = const Symbol('assert'); /// 04: compile-time error | |
| 17 x = const Symbol('break'); /// 05: compile-time error | |
|
Lasse Reichstein Nielsen
2014/07/23 20:52:35
I wouldn't mind just using '04: continued' here an
Paul Berry
2014/07/24 21:40:47
Done.
ahe
2014/08/04 14:28:05
That means you won't be testing each case. We don'
| |
| 18 x = const Symbol('case'); /// 06: compile-time error | |
| 19 x = const Symbol('catch'); /// 07: compile-time error | |
| 20 x = const Symbol('class'); /// 08: compile-time error | |
| 21 x = const Symbol('const'); /// 09: compile-time error | |
| 22 x = const Symbol('continue'); /// 10: compile-time error | |
| 23 x = const Symbol('default'); /// 11: compile-time error | |
| 24 x = const Symbol('do'); /// 12: compile-time error | |
| 25 x = const Symbol('else'); /// 13: compile-time error | |
| 26 x = const Symbol('enum'); /// 14: compile-time error | |
| 27 x = const Symbol('extends'); /// 15: compile-time error | |
| 28 x = const Symbol('false'); /// 16: compile-time error | |
| 29 x = const Symbol('final'); /// 17: compile-time error | |
| 30 x = const Symbol('finally'); /// 18: compile-time error | |
| 31 x = const Symbol('for'); /// 19: compile-time error | |
| 32 x = const Symbol('if'); /// 20: compile-time error | |
| 33 x = const Symbol('in'); /// 21: compile-time error | |
| 34 x = const Symbol('is'); /// 22: compile-time error | |
| 35 x = const Symbol('new'); /// 23: compile-time error | |
| 36 x = const Symbol('null'); /// 24: compile-time error | |
| 37 x = const Symbol('rethrow'); /// 25: compile-time error | |
| 38 x = const Symbol('return'); /// 26: compile-time error | |
| 39 x = const Symbol('super'); /// 27: compile-time error | |
| 40 x = const Symbol('switch'); /// 28: compile-time error | |
| 41 x = const Symbol('this'); /// 29: compile-time error | |
| 42 x = const Symbol('throw'); /// 30: compile-time error | |
| 43 x = const Symbol('true'); /// 31: compile-time error | |
| 44 x = const Symbol('try'); /// 32: compile-time error | |
| 45 x = const Symbol('var'); /// 33: compile-time error | |
| 46 x = const Symbol('while'); /// 34: compile-time error | |
| 47 x = const Symbol('with'); /// 35: compile-time error | |
| 48 } | |
|
Lasse Reichstein Nielsen
2014/07/23 20:52:35
Consider also testing "new Symbol(...)" and "#..."
Paul Berry
2014/07/24 21:40:47
Done.
| |
| OLD | NEW |