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 library test.parameter_metadata_test; | 5 library test.parameter_metadata_test; |
6 | 6 |
7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 | 8 |
9 import 'metadata_test.dart'; | 9 import 'metadata_test.dart'; |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 qux(int x, [@m3 @m2 @m1 int y= 3 + 1]) {} | 26 qux(int x, [@m3 @m2 @m1 int y= 3 + 1]) {} |
27 quux(int x, {String str: "foo"}) {} | 27 quux(int x, {String str: "foo"}) {} |
28 corge({@m1 int x: 3 * 17, @m2 String str: "bar"}) {} | 28 corge({@m1 int x: 3 * 17, @m2 String str: "bar"}) {} |
29 | 29 |
30 set x(@m2 final value) {} | 30 set x(@m2 final value) {} |
31 } | 31 } |
32 | 32 |
33 main() { | 33 main() { |
34 ClassMirror cm = reflectClass(B); | 34 ClassMirror cm = reflectClass(B); |
35 | 35 |
36 checkMetadata((cm.declarations[#B.foo] as MethodMirror).parameters[0], []); | 36 checkMetadata(cm.constructors[#B.foo].parameters[0], []); |
37 | 37 |
38 checkMetadata((cm.declarations[#B.bar] as MethodMirror).parameters[0], [m3, m2
]); | 38 checkMetadata(cm.constructors[#B.bar].parameters[0], [m3, m2]); |
39 checkMetadata((cm.declarations[#B.bar] as MethodMirror).parameters[1], []); | 39 checkMetadata(cm.constructors[#B.bar].parameters[1], []); |
40 | 40 |
41 checkMetadata((cm.declarations[#baz] as MethodMirror).parameters[0], [m1]); | 41 checkMetadata(cm.methods[#baz].parameters[0], [m1]); |
42 checkMetadata((cm.declarations[#baz] as MethodMirror).parameters[1], [m2]); | 42 checkMetadata(cm.methods[#baz].parameters[1], [m2]); |
43 checkMetadata((cm.declarations[#baz] as MethodMirror).parameters[2], [m3]); | 43 checkMetadata(cm.methods[#baz].parameters[2], [m3]); |
44 | 44 |
45 checkMetadata((cm.declarations[#qux] as MethodMirror).parameters[0], []); | 45 checkMetadata(cm.methods[#qux].parameters[0], []); |
46 checkMetadata((cm.declarations[#qux] as MethodMirror).parameters[1], [m3, m2,
m1]); | 46 checkMetadata(cm.methods[#qux].parameters[1], [m3, m2, m1]); |
47 | 47 |
48 checkMetadata((cm.declarations[#quux] as MethodMirror).parameters[0], []); | 48 checkMetadata(cm.methods[#quux].parameters[0], []); |
49 checkMetadata((cm.declarations[#quux] as MethodMirror).parameters[1], []); | 49 checkMetadata(cm.methods[#quux].parameters[1], []); |
50 | 50 |
51 checkMetadata((cm.declarations[#corge] as MethodMirror).parameters[0], [m1]); | 51 checkMetadata(cm.methods[#corge].parameters[0], [m1]); |
52 checkMetadata((cm.declarations[#corge] as MethodMirror).parameters[1], [m2]); | 52 checkMetadata(cm.methods[#corge].parameters[1], [m2]); |
53 | 53 |
54 checkMetadata((cm.declarations[const Symbol('x=')] as MethodMirror).parameters
[0], [m2]); | 54 checkMetadata(cm.setters[const Symbol('x=')].parameters[0], [m2]); |
55 } | 55 } |
OLD | NEW |