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

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

Issue 19299003: Moved some MethodMirror properties from embedded API to native calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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
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 import "dart:mirrors";
6
7 import "package:expect/expect.dart";
8
9 doNothing42() {}
10
11 int _x = 5;
12 int get topGetter => _x;
13 void set topSetter(x) { _x = x; }
14
15 class AbstractC {
16
17 AbstractC();
18
19 void bar();
20 get priv;
21 set priv(value);
22 }
23
24 class C extends AbstractC {
25
26 static foo() {}
27
28 C();
29 C.other();
30 C.other2() : this.other();
31
32 var _priv;
33 get priv => _priv;
34 set priv(value) => _priv = value;
35 }
36
37 checkKinds(method, kinds) {
38 Expect.equals(method.isStatic, kinds[0]);
39 Expect.equals(method.isAbstract, kinds[1]);
40 Expect.equals(method.isGetter, kinds[2]);
41 Expect.equals(method.isSetter, kinds[3]);
42 Expect.equals(method.isConstructor, kinds[4]);
43 }
44
45 main() {
46 // Top level functions should be static.
47 var closureMirror = reflect(doNothing42);
48 checkKinds(closureMirror.function,
49 [true, false, false, false, false]);
50 var libraryMirror = reflectClass(C).owner;
51 checkKinds(libraryMirror.getters[const Symbol("topGetter")],
52 [true, false, true, false, false]);
53 checkKinds(libraryMirror.setters[const Symbol("topSetter=")],
54 [true, false, false, true, false]);
55 var classMirror;
56 classMirror = reflectClass(C);
57 checkKinds(classMirror.members[const Symbol("foo")],
58 [true, false, false, false, false]);
59 checkKinds(classMirror.members[const Symbol("priv")],
60 [false, false, true, false, false]);
61 checkKinds(classMirror.members[const Symbol("priv=")],
62 [false, false, false, true, false]);
63 checkKinds(classMirror.constructors[const Symbol("C")],
64 [false, false, false, false, true]);
65 checkKinds(classMirror.constructors[const Symbol("C.other")],
66 [false, false, false, false, true]);
67 checkKinds(classMirror.constructors[const Symbol("C.other2")],
68 [false, false, false, false, true]);
69 classMirror = reflectClass(AbstractC);
70 checkKinds(classMirror.constructors[const Symbol("AbstractC")],
71 [false, false, false, false, true]);
72 checkKinds(classMirror.members[const Symbol("bar")],
73 [false, true, false, false, false]);
74 checkKinds(classMirror.members[const Symbol("priv")],
75 [false, true, true, false, false]);
76 checkKinds(classMirror.members[const Symbol("priv=")],
77 [false, true, false, true, false]);
78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698