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 that assignment to a prefix is handled consistently with the | 5 // Validate that assignment to a prefix is handled consistently with the |
6 // following spec text from section 16.19 (Assignment): | 6 // following spec text from section 16.19 (Assignment): |
7 // Evaluation of an assignment a of the form v = e proceeds as follows: | 7 // Evaluation of an assignment a of the form v = e proceeds as follows: |
8 // Let d be the innermost declaration whose name is v or v=, if it exists. | 8 // Let d be the innermost declaration whose name is v or v=, if it exists. |
9 // It is a compile-time error if d denotes a prefix object. | 9 // It is a compile-time error if d denotes a prefix object. |
10 | 10 |
11 import "empty_library.dart" as p; | 11 import "empty_library.dart" as p; |
12 | 12 |
13 class Base { | 13 class Base { |
14 var p; | 14 var p; |
15 } | 15 } |
16 | 16 |
17 class Derived extends Base { | 17 class Derived extends Base { |
18 void f() { | 18 void f() { |
19 p = 1; /// 01: compile-time error | 19 p = 1; //# 01: compile-time error |
20 } | 20 } |
21 } | 21 } |
22 | 22 |
23 main() { | 23 main() { |
24 new Derived().f(); | 24 new Derived().f(); |
25 p = 1; /// 02: compile-time error | 25 p = 1; //# 02: compile-time error |
26 } | 26 } |
OLD | NEW |