OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013, 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 // Test to detect syntactically illegal left-hand-side (assignable) | |
6 // expressions. | |
7 | |
8 class C { | |
9 static dynamic field = 0; | |
10 } | |
11 | |
12 dynamic variable = 0; | |
13 | |
14 main() { | |
15 variable = 0; | |
16 (variable) = 0; // //# 01: compile-time error | |
17 (variable)++; // //# 02: compile-time error | |
18 ++(variable); // //# 03: compile-time error | |
19 | |
20 C.field = 0; | |
21 (C.field) = 0; // //# 11: compile-time error | |
22 (C.field)++; // //# 12: compile-time error | |
23 ++(C.field); // //# 13: compile-time error | |
24 | |
25 variable = [1, 2, 3]; | |
26 variable[0] = 0; | |
27 (variable)[0] = 0; | |
28 (variable[0]) = 0; // //# 21: compile-time error | |
29 (variable[0])++; // //# 22: compile-time error | |
30 ++(variable[0]); // //# 23: compile-time error | |
31 | |
32 C.field = [1, 2, 3]; | |
33 (C.field[0]) = 0; // //# 31: compile-time error | |
34 (C.field[0])++; // //# 32: compile-time error | |
35 ++(C.field[0]); // //# 33: compile-time error | |
36 | |
37 var a = 0; | |
38 (a) = 0; // //# 41: compile-time error | |
39 (a)++; // //# 42: compile-time error | |
40 ++(a); // //# 43: compile-time error | |
41 | |
42 // Neat palindrome expression. x is assignable, ((x)) is not. | |
43 var funcnuf = (x) => ((x))=((x)) <= (x); // //# 50: compile-time error | |
44 } | |
OLD | NEW |