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

Side by Side Diff: lib/runtime/dart/mirrors.js

Issue 1355893003: Rewire DDC to use the analyzer task model (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Fix for identifiers Created 5 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
OLDNEW
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, [dart.dynamic]) ); 11 return dart.dcall(this.libraries.values[dartx.singleWhere], dart.fn(librar y => dart.equals(dart.dload(library, 'simpleName'), libraryName), core.bool, [da rt.dynamic]));
12 } 12 }
13 static getName(symbol) { 13 static getName(symbol) {
14 return _js_mirrors.getName(symbol); 14 return dart.dcall(_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 dart.dcall(_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 dart.dcall(_js_mirrors.reflect, reflectee);
36 } 36 }
37 dart.fn(reflect, () => dart.definiteFunctionType(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, dart.dynamic)) { 39 if (!dart.is(key, core.Type) || dart.equals(key, dart.dynamic)) {
40 dart.throw(new core.ArgumentError(`${key} does not denote a class`)); 40 dart.throw(new core.ArgumentError(`${key} does not denote a class`));
41 } 41 }
42 let tm = reflectType(key); 42 let tm = dart.dcall(reflectType, key);
43 if (!dart.is(tm, ClassMirror)) { 43 if (!dart.is(tm, ClassMirror)) {
44 dart.throw(new core.ArgumentError(`${key} does not denote a class`)); 44 dart.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.definiteFunctionType(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, dart.dynamic)) { 50 if (dart.equals(key, dart.dynamic)) {
51 return currentMirrorSystem().dynamicType; 51 return dart.dcall(currentMirrorSystem).dynamicType;
52 } 52 }
53 return _js_mirrors.reflectType(key); 53 return dart.dcall(_js_mirrors.reflectType, key);
54 } 54 }
55 dart.fn(reflectType, () => dart.definiteFunctionType(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 {}
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698