| 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 library test.metadata_with_type_literal; |
| 6 |
| 7 import 'dart:mirrors'; |
| 8 |
| 9 import 'metadata_test.dart'; |
| 10 import 'metadata_allowed_values_import.dart'; // Unprefixed. |
| 11 import 'metadata_allowed_values_import.dart' as prefix; |
| 12 |
| 13 @A |
| 14 class A {} |
| 15 |
| 16 @B.CONSTANT |
| 17 class B { |
| 18 static const CONSTANT = 3; |
| 19 } |
| 20 |
| 21 @C(3) |
| 22 class C { |
| 23 final field; |
| 24 const C(this.field); |
| 25 } |
| 26 |
| 27 @D.named(4) |
| 28 class D { |
| 29 final field; |
| 30 const D.named(this.field); |
| 31 } |
| 32 |
| 33 @E.NOT_CONSTANT /// 01: compile-time error |
| 34 class E { |
| 35 static var NOT_CONSTANT = 3; |
| 36 } |
| 37 |
| 38 @F(6) /// 02: compile-time error |
| 39 class F { |
| 40 final field; |
| 41 F(this.field); |
| 42 } |
| 43 |
| 44 @G.named(4) /// 03: compile-time error |
| 45 class G { |
| 46 final field; |
| 47 G.named(this.field); |
| 48 } |
| 49 |
| 50 @H<int>() /// 04: compile-time error |
| 51 class H<T> { |
| 52 const H(); |
| 53 } |
| 54 |
| 55 @I[0] /// 05: compile-time error |
| 56 class I {} |
| 57 |
| 58 @this.toString /// 06: compile-time error |
| 59 class J {} |
| 60 |
| 61 @super.toString /// 07: compile-time error |
| 62 class K {} |
| 63 |
| 64 @L.func() /// 08: compile-time error |
| 65 class L { |
| 66 static func() => 6; |
| 67 } |
| 68 |
| 69 @Imported |
| 70 class M {} |
| 71 |
| 72 @Imported() |
| 73 class N {} |
| 74 |
| 75 @Imported.named() |
| 76 class O {} |
| 77 |
| 78 @Imported.CONSTANT |
| 79 class P {} |
| 80 |
| 81 @prefix.Imported |
| 82 class Q {} |
| 83 |
| 84 @prefix.Imported() |
| 85 class R {} |
| 86 |
| 87 @prefix.Imported.named() |
| 88 class S {} |
| 89 |
| 90 @prefix.Imported.CONSTANT |
| 91 class T {} |
| 92 |
| 93 @U..toString() /// 09: compile-time error |
| 94 class U {} |
| 95 |
| 96 @V.tearOff /// 10: compile-time error |
| 97 class V { |
| 98 static tearOff() {} |
| 99 } |
| 100 |
| 101 topLevelTearOff() => 4; |
| 102 |
| 103 @topLevelTearOff /// 11: compile-time error |
| 104 class W {} |
| 105 |
| 106 @TypeParameter /// 12: compile-time error |
| 107 class X<TypeParameter> {} |
| 108 |
| 109 @TypeParameter.member /// 13: compile-time error |
| 110 class Y<TypeParameter> {} |
| 111 |
| 112 @1 /// 14: compile-time error |
| 113 class Z {} |
| 114 |
| 115 @3.14 /// 15: compile-time error |
| 116 class AA {} |
| 117 |
| 118 @'string' /// 16: compile-time error |
| 119 class BB {} |
| 120 |
| 121 @#symbol /// 17: compile-time error |
| 122 class CC {} |
| 123 |
| 124 @['element'] /// 18: compile-time error |
| 125 class DD {} |
| 126 |
| 127 @{'key': 'value'} /// 19: compile-time error |
| 128 class EE {} |
| 129 |
| 130 @true /// 20: compile-time error |
| 131 class FF {} |
| 132 |
| 133 @false /// 21: compile-time error |
| 134 class GG {} |
| 135 |
| 136 @null /// 22: compile-time error |
| 137 class HH {} |
| 138 |
| 139 main() { |
| 140 checkMetadata(reflectClass(A), [A]); |
| 141 checkMetadata(reflectClass(B), [B.CONSTANT]); |
| 142 checkMetadata(reflectClass(C), [const C(3)]); |
| 143 checkMetadata(reflectClass(D), [const D.named(4)]); |
| 144 reflectClass(E).metadata; /// 01: continued |
| 145 reflectClass(F).metadata; /// 02: continued |
| 146 reflectClass(G).metadata; /// 03: continued |
| 147 reflectClass(H).metadata; /// 04: continued |
| 148 reflectClass(I).metadata; /// 05: continued |
| 149 reflectClass(J).metadata; /// 06: continued |
| 150 reflectClass(K).metadata; /// 07: continued |
| 151 reflectClass(L).metadata; /// 08: continued |
| 152 checkMetadata(reflectClass(M), [Imported]); |
| 153 checkMetadata(reflectClass(N), [const Imported()]); |
| 154 checkMetadata(reflectClass(O), [const Imported.named()]); |
| 155 checkMetadata(reflectClass(P), [Imported.CONSTANT]); |
| 156 checkMetadata(reflectClass(Q), [prefix.Imported]); |
| 157 checkMetadata(reflectClass(R), [const prefix.Imported()]); |
| 158 checkMetadata(reflectClass(S), [const prefix.Imported.named()]); |
| 159 checkMetadata(reflectClass(T), [prefix.Imported.CONSTANT]); |
| 160 reflectClass(U).metadata; /// 09: continued |
| 161 reflectClass(V).metadata; /// 10: continued |
| 162 reflectClass(W).metadata; /// 11: continued |
| 163 reflectClass(X).metadata; /// 12: continued |
| 164 reflectClass(Y).metadata; /// 13: continued |
| 165 reflectClass(Z).metadata; /// 14: continued |
| 166 reflectClass(AA).metadata; /// 15: continued |
| 167 reflectClass(BB).metadata; /// 16: continued |
| 168 reflectClass(CC).metadata; /// 17: continued |
| 169 reflectClass(DD).metadata; /// 18: continued |
| 170 reflectClass(EE).metadata; /// 19: continued |
| 171 reflectClass(FF).metadata; /// 20: continued |
| 172 reflectClass(GG).metadata; /// 21: continued |
| 173 reflectClass(HH).metadata; /// 22: continued |
| 174 } |
| OLD | NEW |