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 // Verify that the individual variable declarations inside a variable | 5 // Verify that the individual variable declarations inside a variable |
6 // declaration list are not allowed to be annotated with metadata. | 6 // declaration list are not allowed to be annotated with metadata. |
7 | 7 |
8 const annotation = null; | 8 const annotation = null; |
9 | 9 |
10 var | 10 var |
11 @annotation /// 01: compile-time error | 11 @annotation //# 01: compile-time error |
12 v1, | 12 v1, |
13 @annotation /// 02: compile-time error | 13 @annotation //# 02: compile-time error |
14 v2; | 14 v2; |
15 | 15 |
16 int | 16 int |
17 @annotation /// 03: compile-time error | 17 @annotation //# 03: compile-time error |
18 v3, | 18 v3, |
19 @annotation /// 04: compile-time error | 19 @annotation //# 04: compile-time error |
20 v4; | 20 v4; |
21 | 21 |
22 class C { | 22 class C { |
23 var | 23 var |
24 @annotation /// 05: compile-time error | 24 @annotation //# 05: compile-time error |
25 f1, | 25 f1, |
26 @annotation /// 06: compile-time error | 26 @annotation //# 06: compile-time error |
27 f2; | 27 f2; |
28 | 28 |
29 int | 29 int |
30 @annotation /// 07: compile-time error | 30 @annotation //# 07: compile-time error |
31 f3, | 31 f3, |
32 @annotation /// 08: compile-time error | 32 @annotation //# 08: compile-time error |
33 f4; | 33 f4; |
34 } | 34 } |
35 | 35 |
36 use(x) => x; | 36 use(x) => x; |
37 | 37 |
38 main() { | 38 main() { |
39 use(v1); | 39 use(v1); |
40 use(v2); | 40 use(v2); |
41 use(v3); | 41 use(v3); |
42 use(v4); | 42 use(v4); |
43 | 43 |
44 C c = new C(); | 44 C c = new C(); |
45 use(c.f1); | 45 use(c.f1); |
46 use(c.f2); | 46 use(c.f2); |
47 use(c.f3); | 47 use(c.f3); |
48 use(c.f4); | 48 use(c.f4); |
49 | 49 |
50 var | 50 var |
51 @annotation /// 09: compile-time error | 51 @annotation //# 09: compile-time error |
52 l1, | 52 l1, |
53 @annotation /// 10: compile-time error | 53 @annotation //# 10: compile-time error |
54 l2; | 54 l2; |
55 | 55 |
56 int | 56 int |
57 @annotation /// 11: compile-time error | 57 @annotation //# 11: compile-time error |
58 l3, | 58 l3, |
59 @annotation /// 12: compile-time error | 59 @annotation //# 12: compile-time error |
60 l4; | 60 l4; |
61 | 61 |
62 use(l1); | 62 use(l1); |
63 use(l2); | 63 use(l2); |
64 use(l3); | 64 use(l3); |
65 use(l4); | 65 use(l4); |
66 | 66 |
67 for (var | 67 for (var |
68 @annotation /// 13: compile-time error | 68 @annotation //# 13: compile-time error |
69 i1 = 0, | 69 i1 = 0, |
70 @annotation /// 14: compile-time error | 70 @annotation //# 14: compile-time error |
71 i2 = 0; ; ) { | 71 i2 = 0; ; ) { |
72 use(i1); | 72 use(i1); |
73 use(i2); | 73 use(i2); |
74 break; | 74 break; |
75 } | 75 } |
76 | 76 |
77 for (int | 77 for (int |
78 @annotation /// 15: compile-time error | 78 @annotation //# 15: compile-time error |
79 i3 = 0, | 79 i3 = 0, |
80 @annotation /// 16: compile-time error | 80 @annotation //# 16: compile-time error |
81 i4 = 0; ; ) { | 81 i4 = 0; ; ) { |
82 use(i3); | 82 use(i3); |
83 use(i4); | 83 use(i4); |
84 break; | 84 break; |
85 } | 85 } |
86 } | 86 } |
OLD | NEW |