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