OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // Validate the following spec text from section 16.32 (Identifier Reference): | 5 // Validate the following spec text from section 16.32 (Identifier Reference): |
6 // Evaluation of an identifier expression e of the form id proceeds as | 6 // Evaluation of an identifier expression e of the form id proceeds as |
7 // follows: | 7 // follows: |
8 // Let d be the innermost declaration in the enclosing lexical scope whose | 8 // Let d be the innermost declaration in the enclosing lexical scope whose |
9 // name is id or id=. If no such declaration exists in the lexical scope, | 9 // name is id or id=. If no such declaration exists in the lexical scope, |
10 // d be the declaration of the inherited member named id if it exists. | 10 // d be the declaration of the inherited member named id if it exists. |
11 // - If d is a prefix p, a compile-time error occurs unless the token | 11 // - If d is a prefix p, a compile-time error occurs unless the token |
12 // immediately following d is '.'. | 12 // immediately following d is '.'. |
13 | 13 |
14 import "package:expect/expect.dart"; | 14 import "package:expect/expect.dart"; |
15 import "empty_library.dart" as p; | 15 import "empty_library.dart" as p; |
16 | 16 |
17 void f(x) {} | 17 void f(x) {} |
18 | 18 |
19 main() { | 19 main() { |
20 f(p); /// 01: compile-time error | 20 f(p); //# 01: compile-time error |
21 var x = p; /// 02: compile-time error | 21 var x = p; //# 02: compile-time error |
22 var x = p[0]; /// 03: compile-time error | 22 var x = p[0]; //# 03: compile-time error |
23 p[0] = null; /// 04: compile-time error | 23 p[0] = null; //# 04: compile-time error |
24 p += 0; /// 05: compile-time error | 24 p += 0; //# 05: compile-time error |
25 } | 25 } |
OLD | NEW |