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 // VMOptions=--use_mirrored_compilation_error=true | 5 // VMOptions=--use_mirrored_compilation_error=true |
6 | 6 |
7 @notDefined | 7 @notDefined |
8 library mirrored_compilation_error_test; | 8 library mirrored_compilation_error_test; |
9 | 9 |
10 import 'dart:mirrors'; | 10 import 'dart:mirrors'; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 return true; | 57 return true; |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 main() { | 61 main() { |
62 | 62 |
63 // Metadata. | 63 // Metadata. |
64 | 64 |
65 raises(() => reflectClass(Class).metadata); | 65 raises(() => reflectClass(Class).metadata); |
66 raises(() => reflectClass(Class).typeVariables.single.metadata); | 66 raises(() => reflectClass(Class).typeVariables.single.metadata); |
67 raises(() => reflectClass(Class).variables[#field].metadata); | 67 raises(() => reflectClass(Class).declarations[#field].metadata); |
68 raises(() => reflectClass(Class).methods[#method].metadata); | 68 raises(() => reflectClass(Class).declarations[#method].metadata); |
69 raises(() => reflectClass(Class).methods[#method].parameters.single.metadata); | 69 raises(() => reflectClass(Class).declarations[#method].parameters.single.metad
ata); |
70 raises(() => reflectClass(Class).owner.metadata); | 70 raises(() => reflectClass(Class).owner.metadata); |
71 | 71 |
72 | 72 |
73 // Invocation. | 73 // Invocation. |
74 | 74 |
75 InstanceMirror im = reflect(new Class2()); | 75 InstanceMirror im = reflect(new Class2()); |
76 raises(() => im.invoke(#method, [])); | 76 raises(() => im.invoke(#method, [])); |
77 raises(() => im.getField(#getter)); | 77 raises(() => im.getField(#getter)); |
78 raises(() => im.setField(#setter, 'some value')); | 78 raises(() => im.setField(#setter, 'some value')); |
79 // The implementation is within its right to defer the compilation even | 79 // The implementation is within its right to defer the compilation even |
(...skipping 14 matching lines...) Expand all Loading... |
94 raises(() => lm.getField(#toplevelFunction).apply([])); | 94 raises(() => lm.getField(#toplevelFunction).apply([])); |
95 | 95 |
96 | 96 |
97 // Bounds violation. | 97 // Bounds violation. |
98 | 98 |
99 if (inCheckedMode) { | 99 if (inCheckedMode) { |
100 ClassMirror cm = reflect(new G<int, String>()).type; | 100 ClassMirror cm = reflect(new G<int, String>()).type; |
101 raises(() => cm.newInstance(#swap, [])); | 101 raises(() => cm.newInstance(#swap, [])); |
102 } | 102 } |
103 } | 103 } |
OLD | NEW |