OLD | NEW |
| (Empty) |
1 dart_library.library('dart/mirrors', null, /* Imports */[ | |
2 'dart/_runtime', | |
3 'dart/core' | |
4 ], /* Lazy imports */[ | |
5 'dart/_js_mirrors' | |
6 ], function(exports, dart, core, _js_mirrors) { | |
7 'use strict'; | |
8 let dartx = dart.dartx; | |
9 class MirrorSystem extends core.Object { | |
10 findLibrary(libraryName) { | |
11 return this.libraries[dartx.values][dartx.singleWhere](dart.fn(library =>
dart.equals(library.simpleName, libraryName), core.bool, [LibraryMirror])); | |
12 } | |
13 static getName(symbol) { | |
14 return _js_mirrors.getName(symbol); | |
15 } | |
16 static getSymbol(name, library) { | |
17 if (library === void 0) library = null; | |
18 return _js_mirrors.getSymbol(name, library); | |
19 } | |
20 } | |
21 dart.setSignature(MirrorSystem, { | |
22 methods: () => ({findLibrary: [LibraryMirror, [core.Symbol]]}), | |
23 statics: () => ({ | |
24 getName: [core.String, [core.Symbol]], | |
25 getSymbol: [core.Symbol, [core.String], [LibraryMirror]] | |
26 }), | |
27 names: ['getName', 'getSymbol'] | |
28 }); | |
29 function currentMirrorSystem() { | |
30 return dart.as(_js_mirrors.currentJsMirrorSystem, MirrorSystem); | |
31 } | |
32 dart.fn(currentMirrorSystem, MirrorSystem, []); | |
33 function reflect(reflectee) { | |
34 return _js_mirrors.reflect(reflectee); | |
35 } | |
36 dart.fn(reflect, () => dart.definiteFunctionType(InstanceMirror, [core.Object]
)); | |
37 function reflectClass(key) { | |
38 if (!dart.is(key, core.Type) || dart.equals(key, dart.dynamic)) { | |
39 dart.throw(new core.ArgumentError(`${key} does not denote a class`)); | |
40 } | |
41 let tm = reflectType(key); | |
42 if (!dart.is(tm, ClassMirror)) { | |
43 dart.throw(new core.ArgumentError(`${key} does not denote a class`)); | |
44 } | |
45 return dart.as(dart.as(tm, ClassMirror).originalDeclaration, ClassMirror); | |
46 } | |
47 dart.fn(reflectClass, () => dart.definiteFunctionType(ClassMirror, [core.Type]
)); | |
48 function reflectType(key) { | |
49 if (dart.equals(key, dart.dynamic)) { | |
50 return currentMirrorSystem().dynamicType; | |
51 } | |
52 return _js_mirrors.reflectType(key); | |
53 } | |
54 dart.fn(reflectType, () => dart.definiteFunctionType(TypeMirror, [core.Type]))
; | |
55 class Mirror extends core.Object {} | |
56 class IsolateMirror extends core.Object {} | |
57 IsolateMirror[dart.implements] = () => [Mirror]; | |
58 class DeclarationMirror extends core.Object {} | |
59 DeclarationMirror[dart.implements] = () => [Mirror]; | |
60 class ObjectMirror extends core.Object {} | |
61 ObjectMirror[dart.implements] = () => [Mirror]; | |
62 class InstanceMirror extends core.Object {} | |
63 InstanceMirror[dart.implements] = () => [ObjectMirror]; | |
64 class ClosureMirror extends core.Object {} | |
65 ClosureMirror[dart.implements] = () => [InstanceMirror]; | |
66 class LibraryMirror extends core.Object {} | |
67 LibraryMirror[dart.implements] = () => [DeclarationMirror, ObjectMirror]; | |
68 class LibraryDependencyMirror extends core.Object {} | |
69 LibraryDependencyMirror[dart.implements] = () => [Mirror]; | |
70 class CombinatorMirror extends core.Object {} | |
71 CombinatorMirror[dart.implements] = () => [Mirror]; | |
72 class TypeMirror extends core.Object {} | |
73 TypeMirror[dart.implements] = () => [DeclarationMirror]; | |
74 class ClassMirror extends core.Object {} | |
75 ClassMirror[dart.implements] = () => [TypeMirror, ObjectMirror]; | |
76 class FunctionTypeMirror extends core.Object {} | |
77 FunctionTypeMirror[dart.implements] = () => [ClassMirror]; | |
78 class TypeVariableMirror extends TypeMirror {} | |
79 class TypedefMirror extends core.Object {} | |
80 TypedefMirror[dart.implements] = () => [TypeMirror]; | |
81 class MethodMirror extends core.Object {} | |
82 MethodMirror[dart.implements] = () => [DeclarationMirror]; | |
83 class VariableMirror extends core.Object {} | |
84 VariableMirror[dart.implements] = () => [DeclarationMirror]; | |
85 class ParameterMirror extends core.Object {} | |
86 ParameterMirror[dart.implements] = () => [VariableMirror]; | |
87 class SourceLocation extends core.Object {} | |
88 class Comment extends core.Object { | |
89 Comment(text, trimmedText, isDocComment) { | |
90 this.text = text; | |
91 this.trimmedText = trimmedText; | |
92 this.isDocComment = isDocComment; | |
93 } | |
94 } | |
95 dart.setSignature(Comment, { | |
96 constructors: () => ({Comment: [Comment, [core.String, core.String, core.boo
l]]}) | |
97 }); | |
98 class MirrorsUsed extends core.Object { | |
99 MirrorsUsed(opts) { | |
100 let symbols = opts && 'symbols' in opts ? opts.symbols : null; | |
101 let targets = opts && 'targets' in opts ? opts.targets : null; | |
102 let metaTargets = opts && 'metaTargets' in opts ? opts.metaTargets : null; | |
103 let override = opts && 'override' in opts ? opts.override : null; | |
104 this.symbols = symbols; | |
105 this.targets = targets; | |
106 this.metaTargets = metaTargets; | |
107 this.override = override; | |
108 } | |
109 } | |
110 dart.setSignature(MirrorsUsed, { | |
111 constructors: () => ({MirrorsUsed: [MirrorsUsed, [], {symbols: dart.dynamic,
targets: dart.dynamic, metaTargets: dart.dynamic, override: dart.dynamic}]}) | |
112 }); | |
113 // Exports: | |
114 exports.MirrorSystem = MirrorSystem; | |
115 exports.currentMirrorSystem = currentMirrorSystem; | |
116 exports.reflect = reflect; | |
117 exports.reflectClass = reflectClass; | |
118 exports.reflectType = reflectType; | |
119 exports.Mirror = Mirror; | |
120 exports.IsolateMirror = IsolateMirror; | |
121 exports.DeclarationMirror = DeclarationMirror; | |
122 exports.ObjectMirror = ObjectMirror; | |
123 exports.InstanceMirror = InstanceMirror; | |
124 exports.ClosureMirror = ClosureMirror; | |
125 exports.LibraryMirror = LibraryMirror; | |
126 exports.LibraryDependencyMirror = LibraryDependencyMirror; | |
127 exports.CombinatorMirror = CombinatorMirror; | |
128 exports.TypeMirror = TypeMirror; | |
129 exports.ClassMirror = ClassMirror; | |
130 exports.FunctionTypeMirror = FunctionTypeMirror; | |
131 exports.TypeVariableMirror = TypeVariableMirror; | |
132 exports.TypedefMirror = TypedefMirror; | |
133 exports.MethodMirror = MethodMirror; | |
134 exports.VariableMirror = VariableMirror; | |
135 exports.ParameterMirror = ParameterMirror; | |
136 exports.SourceLocation = SourceLocation; | |
137 exports.Comment = Comment; | |
138 exports.MirrorsUsed = MirrorsUsed; | |
139 }); | |
OLD | NEW |