| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Regression test for Issue 13817. | 5 // Regression test for Issue 13817. |
| 6 | 6 |
| 7 library test.metadata_constructor_arguments; | 7 library test.metadata_constructor_arguments; |
| 8 | 8 |
| 9 import 'dart:mirrors'; | 9 import 'dart:mirrors'; |
| 10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 @Tag(named: F.nonConstStaticField) /// 04: compile-time error | 38 @Tag(named: F.nonConstStaticField) /// 04: compile-time error |
| 39 class F { | 39 class F { |
| 40 static var nonConstStaticField = 6; | 40 static var nonConstStaticField = 6; |
| 41 } | 41 } |
| 42 | 42 |
| 43 @Tag(named: instanceMethod) /// 05: compile-time error | 43 @Tag(named: instanceMethod) /// 05: compile-time error |
| 44 class G { | 44 class G { |
| 45 instanceMethod() {} | 45 instanceMethod() {} |
| 46 } | 46 } |
| 47 | 47 |
| 48 @Tag(named: this) /// 06: compile-time error |
| 49 class H { |
| 50 instanceMethod() {} |
| 51 } |
| 52 |
| 53 @Tag(named: super) /// 07: compile-time error |
| 54 class I { |
| 55 instanceMethod() {} |
| 56 } |
| 57 |
| 48 checkMetadata(DeclarationMirror mirror, List expectedMetadata) { | 58 checkMetadata(DeclarationMirror mirror, List expectedMetadata) { |
| 49 Expect.listEquals(expectedMetadata.map(reflect).toList(), mirror.metadata); | 59 Expect.listEquals(expectedMetadata.map(reflect).toList(), mirror.metadata); |
| 50 } | 60 } |
| 51 | 61 |
| 52 main() { | 62 main() { |
| 53 reflectClass(A).metadata; | 63 reflectClass(A).metadata; |
| 54 checkMetadata(reflectClass(B), [const Tag(named: 'valid')]); | 64 checkMetadata(reflectClass(B), [const Tag(named: 'valid')]); |
| 55 checkMetadata(reflectClass(C), [const Tag(named: C.STATIC_FIELD)]); | 65 checkMetadata(reflectClass(C), [const Tag(named: C.STATIC_FIELD)]); |
| 56 reflectClass(D).metadata; | 66 reflectClass(D).metadata; |
| 57 reflectClass(E).metadata; | 67 reflectClass(E).metadata; |
| 58 reflectClass(F).metadata; | 68 reflectClass(F).metadata; |
| 59 reflectClass(G).metadata; | 69 reflectClass(G).metadata; |
| 70 reflectClass(H).metadata; |
| 71 reflectClass(I).metadata; |
| 60 } | 72 } |
| OLD | NEW |