OLD | NEW |
1 // compile options: --emit-metadata | 1 // compile options: --emit-metadata |
2 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 // Regression test for Issue 17141. | 6 // Regression test for Issue 17141. |
7 | 7 |
8 library test.metadata_nested_constructor_call; | 8 library test.metadata_nested_constructor_call; |
9 | 9 |
10 import 'dart:mirrors'; | 10 import 'dart:mirrors'; |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 @Box() | 23 @Box() |
24 class A {} | 24 class A {} |
25 | 25 |
26 @Box(const Box()) | 26 @Box(const Box()) |
27 class B {} | 27 class B {} |
28 | 28 |
29 @Box(const Box(const Box())) | 29 @Box(const Box(const Box())) |
30 class C {} | 30 class C {} |
31 | 31 |
32 @Box(const Box(const MutableBox())) // /// 01: compile-time error | 32 @Box(const Box(const MutableBox())) // //# 01: compile-time error |
33 class D {} | 33 class D {} |
34 | 34 |
35 @Box(const MutableBox(const Box())) // /// 02: compile-time error | 35 @Box(const MutableBox(const Box())) // //# 02: compile-time error |
36 class E {} | 36 class E {} |
37 | 37 |
38 @Box(Box()) // /// 03: compile-time error | 38 @Box(Box()) // //# 03: compile-time error |
39 class F {} | 39 class F {} |
40 | 40 |
41 @Box(Box(const Box())) // /// 04: compile-time error | 41 @Box(Box(const Box())) // //# 04: compile-time error |
42 class G {} | 42 class G {} |
43 | 43 |
44 @Box(Box(const MutableBox())) // /// 05: compile-time error | 44 @Box(Box(const MutableBox())) // //# 05: compile-time error |
45 class H {} | 45 class H {} |
46 | 46 |
47 @Box(MutableBox(const Box())) // /// 06: compile-time error | 47 @Box(MutableBox(const Box())) // //# 06: compile-time error |
48 class I {} | 48 class I {} |
49 | 49 |
50 final closure = () => 42; | 50 final closure = () => 42; |
51 @Box(closure()) // /// 07: compile-time error | 51 @Box(closure()) // //# 07: compile-time error |
52 class J {} | 52 class J {} |
53 | 53 |
54 @Box(closure) // /// 08: compile-time error | 54 @Box(closure) // //# 08: compile-time error |
55 class K {} | 55 class K {} |
56 | 56 |
57 function() => 42; | 57 function() => 42; |
58 @Box(function()) // /// 09: compile-time error | 58 @Box(function()) // //# 09: compile-time error |
59 class L {} | 59 class L {} |
60 | 60 |
61 // N.B. This is legal, but @function is not (tested by metadata_allowed_values). | 61 // N.B. This is legal, but @function is not (tested by metadata_allowed_values). |
62 @Box(function) | 62 @Box(function) |
63 class M {} | 63 class M {} |
64 | 64 |
65 checkMetadata(DeclarationMirror mirror, List expectedMetadata) { | 65 checkMetadata(DeclarationMirror mirror, List expectedMetadata) { |
66 Expect.listEquals(expectedMetadata.map(reflect).toList(), mirror.metadata); | 66 Expect.listEquals(expectedMetadata.map(reflect).toList(), mirror.metadata); |
67 } | 67 } |
68 | 68 |
69 main() { | 69 main() { |
70 closure(); | 70 closure(); |
71 checkMetadata(reflectClass(A), [const Box()]); | 71 checkMetadata(reflectClass(A), [const Box()]); |
72 checkMetadata(reflectClass(B), [const Box(const Box())]); | 72 checkMetadata(reflectClass(B), [const Box(const Box())]); |
73 checkMetadata(reflectClass(C), [const Box(const Box(const Box()))]); | 73 checkMetadata(reflectClass(C), [const Box(const Box(const Box()))]); |
74 reflectClass(D).metadata; | 74 reflectClass(D).metadata; |
75 reflectClass(E).metadata; | 75 reflectClass(E).metadata; |
76 reflectClass(F).metadata; | 76 reflectClass(F).metadata; |
77 reflectClass(G).metadata; | 77 reflectClass(G).metadata; |
78 reflectClass(H).metadata; | 78 reflectClass(H).metadata; |
79 reflectClass(I).metadata; | 79 reflectClass(I).metadata; |
80 reflectClass(J).metadata; | 80 reflectClass(J).metadata; |
81 reflectClass(K).metadata; | 81 reflectClass(K).metadata; |
82 reflectClass(L).metadata; | 82 reflectClass(L).metadata; |
83 reflectClass(M).metadata; | 83 reflectClass(M).metadata; |
84 } | 84 } |
OLD | NEW |