Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: tests/lib/mirrors/parameter_metadata_test.dart

Issue 23224016: Implement ParameterMirror.metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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.parameter_metadata_test;
6
7 import 'dart:mirrors';
8
9 import 'metadata_test.dart';
10
11 const m1 = 'm1';
12 const m2 = const Symbol('m2');
13 const m3 = const CustomAnnotation(3);
14
15 class CustomAnnotation {
16 final value;
17 const CustomAnnotation(this.value);
18 toString() => 'CustomAnnotation($value)';
19 }
20
21 class B {
22 B.foo(int x);
23 factory B.bar(@m3 @m2 int z, x){}
24
25 baz(@m1 final int x, @m2 int y, @m3 final int z);
26 qux(int x, [@m3 @m2 @m1 int y= 3 + 1]);
27 quux(int x, {String str: "foo"});
28 corge({@m1 int x: 3 * 17, @m2 String str: "bar"});
29
30 set x(@m2 final value);
31 }
32
33 main() {
34 ClassMirror cm = reflectClass(B);
35
36 checkMetadata(cm.constructors[const Symbol('B.foo')].parameters[0], []);
37
38 checkMetadata(cm.constructors[const Symbol('B.bar')].parameters[0], [m3, m2]);
39 checkMetadata(cm.constructors[const Symbol('B.bar')].parameters[1], []);
40
41 checkMetadata(cm.members[const Symbol('baz')].parameters[0], [m1]);
42 checkMetadata(cm.members[const Symbol('baz')].parameters[1], [m2]);
43 checkMetadata(cm.members[const Symbol('baz')].parameters[2], [m3]);
44
45 checkMetadata(cm.members[const Symbol('qux')].parameters[0], []);
46 checkMetadata(cm.members[const Symbol('qux')].parameters[1], [m3, m2, m1]);
47
48 checkMetadata(cm.members[const Symbol('quux')].parameters[0], []);
49 checkMetadata(cm.members[const Symbol('quux')].parameters[1], []);
50
51 checkMetadata(cm.members[const Symbol('corge')].parameters[0], [m1]);
52 checkMetadata(cm.members[const Symbol('corge')].parameters[1], [m2]);
53
54 checkMetadata(cm.members[const Symbol('x=')].parameters[0], [m2]);
55 }
OLDNEW
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698