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