OLD | NEW |
1 dart_library.library('dart/mirrors', null, /* Imports */[ | 1 dart_library.library('dart/mirrors', null, /* Imports */[ |
2 "dart_runtime/dart", | 2 "dart_runtime/dart", |
3 'dart/core' | 3 'dart/core' |
4 ], /* Lazy imports */[ | 4 ], /* Lazy imports */[ |
5 'dart/_js_mirrors' | 5 'dart/_js_mirrors' |
6 ], function(exports, dart, core, _js_mirrors) { | 6 ], function(exports, dart, core, _js_mirrors) { |
7 'use strict'; | 7 'use strict'; |
8 let dartx = dart.dartx; | 8 let dartx = dart.dartx; |
9 class MirrorSystem extends core.Object { | 9 class MirrorSystem extends core.Object { |
10 findLibrary(libraryName) { | 10 findLibrary(libraryName) { |
11 return this.libraries.values[dartx.singleWhere](dart.fn(library => dart.eq
uals(dart.dload(library, 'simpleName'), libraryName), core.bool, [core.Object]))
; | 11 return this.libraries.values[dartx.singleWhere](dart.fn(library => dart.eq
uals(dart.dload(library, 'simpleName'), libraryName), core.bool, [dart.dynamic])
); |
12 } | 12 } |
13 static getName(symbol) { | 13 static getName(symbol) { |
14 return _js_mirrors.getName(symbol); | 14 return _js_mirrors.getName(symbol); |
15 } | 15 } |
16 static getSymbol(name, library) { | 16 static getSymbol(name, library) { |
17 if (library === void 0) | 17 if (library === void 0) |
18 library = null; | 18 library = null; |
19 return _js_mirrors.getSymbol(name, library); | 19 return _js_mirrors.getSymbol(name, library); |
20 } | 20 } |
21 } | 21 } |
22 dart.setSignature(MirrorSystem, { | 22 dart.setSignature(MirrorSystem, { |
23 methods: () => ({findLibrary: [LibraryMirror, [core.Symbol]]}), | 23 methods: () => ({findLibrary: [LibraryMirror, [core.Symbol]]}), |
24 statics: () => ({ | 24 statics: () => ({ |
25 getName: [core.String, [core.Symbol]], | 25 getName: [core.String, [core.Symbol]], |
26 getSymbol: [core.Symbol, [core.String], [LibraryMirror]] | 26 getSymbol: [core.Symbol, [core.String], [LibraryMirror]] |
27 }), | 27 }), |
28 names: ['getName', 'getSymbol'] | 28 names: ['getName', 'getSymbol'] |
29 }); | 29 }); |
30 function currentMirrorSystem() { | 30 function currentMirrorSystem() { |
31 return dart.as(_js_mirrors.currentJsMirrorSystem, MirrorSystem); | 31 return dart.as(_js_mirrors.currentJsMirrorSystem, MirrorSystem); |
32 } | 32 } |
33 dart.fn(currentMirrorSystem, MirrorSystem, []); | 33 dart.fn(currentMirrorSystem, MirrorSystem, []); |
34 function reflect(reflectee) { | 34 function reflect(reflectee) { |
35 return _js_mirrors.reflect(reflectee); | 35 return _js_mirrors.reflect(reflectee); |
36 } | 36 } |
37 dart.fn(reflect, () => dart.functionType(InstanceMirror, [core.Object])); | 37 dart.fn(reflect, () => dart.definiteFunctionType(InstanceMirror, [core.Object]
)); |
38 function reflectClass(key) { | 38 function reflectClass(key) { |
39 if (!dart.is(key, core.Type) || dart.equals(key, core.Object)) { | 39 if (!dart.is(key, core.Type) || dart.equals(key, dart.dynamic)) { |
40 throw new core.ArgumentError(`${key} does not denote a class`); | 40 throw new core.ArgumentError(`${key} does not denote a class`); |
41 } | 41 } |
42 let tm = reflectType(key); | 42 let tm = reflectType(key); |
43 if (!dart.is(tm, ClassMirror)) { | 43 if (!dart.is(tm, ClassMirror)) { |
44 throw new core.ArgumentError(`${key} does not denote a class`); | 44 throw new core.ArgumentError(`${key} does not denote a class`); |
45 } | 45 } |
46 return dart.as(dart.as(tm, ClassMirror).originalDeclaration, ClassMirror); | 46 return dart.as(dart.as(tm, ClassMirror).originalDeclaration, ClassMirror); |
47 } | 47 } |
48 dart.fn(reflectClass, () => dart.functionType(ClassMirror, [core.Type])); | 48 dart.fn(reflectClass, () => dart.definiteFunctionType(ClassMirror, [core.Type]
)); |
49 function reflectType(key) { | 49 function reflectType(key) { |
50 if (dart.equals(key, core.Object)) { | 50 if (dart.equals(key, dart.dynamic)) { |
51 return currentMirrorSystem().dynamicType; | 51 return currentMirrorSystem().dynamicType; |
52 } | 52 } |
53 return _js_mirrors.reflectType(key); | 53 return _js_mirrors.reflectType(key); |
54 } | 54 } |
55 dart.fn(reflectType, () => dart.functionType(TypeMirror, [core.Type])); | 55 dart.fn(reflectType, () => dart.definiteFunctionType(TypeMirror, [core.Type]))
; |
56 class Mirror extends core.Object {} | 56 class Mirror extends core.Object {} |
57 class IsolateMirror extends core.Object {} | 57 class IsolateMirror extends core.Object {} |
58 IsolateMirror[dart.implements] = () => [Mirror]; | 58 IsolateMirror[dart.implements] = () => [Mirror]; |
59 class DeclarationMirror extends core.Object {} | 59 class DeclarationMirror extends core.Object {} |
60 DeclarationMirror[dart.implements] = () => [Mirror]; | 60 DeclarationMirror[dart.implements] = () => [Mirror]; |
61 class ObjectMirror extends core.Object {} | 61 class ObjectMirror extends core.Object {} |
62 ObjectMirror[dart.implements] = () => [Mirror]; | 62 ObjectMirror[dart.implements] = () => [Mirror]; |
63 class InstanceMirror extends core.Object {} | 63 class InstanceMirror extends core.Object {} |
64 InstanceMirror[dart.implements] = () => [ObjectMirror]; | 64 InstanceMirror[dart.implements] = () => [ObjectMirror]; |
65 class ClosureMirror extends core.Object {} | 65 class ClosureMirror extends core.Object {} |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 let targets = opts && 'targets' in opts ? opts.targets : null; | 102 let targets = opts && 'targets' in opts ? opts.targets : null; |
103 let metaTargets = opts && 'metaTargets' in opts ? opts.metaTargets : null; | 103 let metaTargets = opts && 'metaTargets' in opts ? opts.metaTargets : null; |
104 let override = opts && 'override' in opts ? opts.override : null; | 104 let override = opts && 'override' in opts ? opts.override : null; |
105 this.symbols = symbols; | 105 this.symbols = symbols; |
106 this.targets = targets; | 106 this.targets = targets; |
107 this.metaTargets = metaTargets; | 107 this.metaTargets = metaTargets; |
108 this.override = override; | 108 this.override = override; |
109 } | 109 } |
110 } | 110 } |
111 dart.setSignature(MirrorsUsed, { | 111 dart.setSignature(MirrorsUsed, { |
112 constructors: () => ({MirrorsUsed: [MirrorsUsed, [], {symbols: core.Object,
targets: core.Object, metaTargets: core.Object, override: core.Object}]}) | 112 constructors: () => ({MirrorsUsed: [MirrorsUsed, [], {symbols: dart.dynamic,
targets: dart.dynamic, metaTargets: dart.dynamic, override: dart.dynamic}]}) |
113 }); | 113 }); |
114 // Exports: | 114 // Exports: |
115 exports.MirrorSystem = MirrorSystem; | 115 exports.MirrorSystem = MirrorSystem; |
116 exports.currentMirrorSystem = currentMirrorSystem; | 116 exports.currentMirrorSystem = currentMirrorSystem; |
117 exports.reflect = reflect; | 117 exports.reflect = reflect; |
118 exports.reflectClass = reflectClass; | 118 exports.reflectClass = reflectClass; |
119 exports.reflectType = reflectType; | 119 exports.reflectType = reflectType; |
120 exports.Mirror = Mirror; | 120 exports.Mirror = Mirror; |
121 exports.IsolateMirror = IsolateMirror; | 121 exports.IsolateMirror = IsolateMirror; |
122 exports.DeclarationMirror = DeclarationMirror; | 122 exports.DeclarationMirror = DeclarationMirror; |
123 exports.ObjectMirror = ObjectMirror; | 123 exports.ObjectMirror = ObjectMirror; |
124 exports.InstanceMirror = InstanceMirror; | 124 exports.InstanceMirror = InstanceMirror; |
125 exports.ClosureMirror = ClosureMirror; | 125 exports.ClosureMirror = ClosureMirror; |
126 exports.LibraryMirror = LibraryMirror; | 126 exports.LibraryMirror = LibraryMirror; |
127 exports.LibraryDependencyMirror = LibraryDependencyMirror; | 127 exports.LibraryDependencyMirror = LibraryDependencyMirror; |
128 exports.CombinatorMirror = CombinatorMirror; | 128 exports.CombinatorMirror = CombinatorMirror; |
129 exports.TypeMirror = TypeMirror; | 129 exports.TypeMirror = TypeMirror; |
130 exports.ClassMirror = ClassMirror; | 130 exports.ClassMirror = ClassMirror; |
131 exports.FunctionTypeMirror = FunctionTypeMirror; | 131 exports.FunctionTypeMirror = FunctionTypeMirror; |
132 exports.TypeVariableMirror = TypeVariableMirror; | 132 exports.TypeVariableMirror = TypeVariableMirror; |
133 exports.TypedefMirror = TypedefMirror; | 133 exports.TypedefMirror = TypedefMirror; |
134 exports.MethodMirror = MethodMirror; | 134 exports.MethodMirror = MethodMirror; |
135 exports.VariableMirror = VariableMirror; | 135 exports.VariableMirror = VariableMirror; |
136 exports.ParameterMirror = ParameterMirror; | 136 exports.ParameterMirror = ParameterMirror; |
137 exports.SourceLocation = SourceLocation; | 137 exports.SourceLocation = SourceLocation; |
138 exports.Comment = Comment; | 138 exports.Comment = Comment; |
139 exports.MirrorsUsed = MirrorsUsed; | 139 exports.MirrorsUsed = MirrorsUsed; |
140 }); | 140 }); |
OLD | NEW |