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

Unified Diff: lib/runtime/dart/_js_mirrors.js

Issue 1252953003: Implement more of dart:mirrors (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Address comments Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: lib/runtime/dart/_js_mirrors.js
diff --git a/lib/runtime/dart/_js_mirrors.js b/lib/runtime/dart/_js_mirrors.js
index e9d97229cd45429841850ca94a93fe050e67cff4..0051e8d903bb719ca3e9e7d054be26413772bca2 100644
--- a/lib/runtime/dart/_js_mirrors.js
+++ b/lib/runtime/dart/_js_mirrors.js
@@ -53,6 +53,15 @@ dart_library.library('dart/_js_mirrors', null, /* Imports */[
_(reflectee) {
this.reflectee = reflectee;
}
+ get type() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.type unimplemented"));
+ }
+ get hasReflectee() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.hasReflectee unimplemented"));
+ }
+ delegate(invocation) {
+ return dart.throw(new core.UnimplementedError("ClassMirror.delegate unimplemented"));
+ }
getField(symbol) {
let name = getName(symbol);
let field = _dload(this.reflectee, name);
@@ -60,8 +69,8 @@ dart_library.library('dart/_js_mirrors', null, /* Imports */[
}
setField(symbol, value) {
let name = getName(symbol);
- let field = _dput(this.reflectee, name, value);
- return new JsInstanceMirror._(field);
+ _dput(this.reflectee, name, value);
+ return new JsInstanceMirror._(value);
}
invoke(symbol, args, namedArgs) {
if (namedArgs === void 0)
@@ -87,6 +96,7 @@ dart_library.library('dart/_js_mirrors', null, /* Imports */[
dart.setSignature(JsInstanceMirror, {
constructors: () => ({_: [JsInstanceMirror, [core.Object]]}),
methods: () => ({
+ delegate: [dart.dynamic, [core.Invocation]],
getField: [mirrors.InstanceMirror, [core.Symbol]],
setField: [mirrors.InstanceMirror, [core.Symbol, core.Object]],
invoke: [mirrors.InstanceMirror, [core.Symbol, core.List], [core.Map$(core.Symbol, dart.dynamic)]],
@@ -121,35 +131,204 @@ dart_library.library('dart/_js_mirrors', null, /* Imports */[
let instance = new this[_cls](...args);
return new JsInstanceMirror._(instance);
}
+ get superinterfaces() {
+ let interfaces = this[_cls][dart.implements];
+ if (interfaces == null) {
+ return dart.list([], mirrors.ClassMirror);
+ }
+ dart.throw(new core.UnimplementedError("ClassMirror.superinterfaces unimplemented"));
+ }
+ getField(fieldName) {
+ return dart.throw(new core.UnimplementedError("ClassMirror.getField unimplemented"));
+ }
+ invoke(memberName, positionalArguments, namedArguments) {
+ if (namedArguments === void 0)
+ namedArguments = null;
+ return dart.throw(new core.UnimplementedError("ClassMirror.invoke unimplemented"));
+ }
+ isAssignableTo(other) {
+ return dart.throw(new core.UnimplementedError("ClassMirror.isAssignable unimplemented"));
+ }
+ isSubclassOf(other) {
+ return dart.throw(new core.UnimplementedError("ClassMirror.isSubclassOf unimplemented"));
+ }
+ isSubtypeOf(other) {
+ return dart.throw(new core.UnimplementedError("ClassMirror.isSubtypeOf unimplemented"));
+ }
+ setField(fieldName, value) {
+ return dart.throw(new core.UnimplementedError("ClassMirror.setField unimplemented"));
+ }
+ get hasReflectedType() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.hasReflectedType unimplemented"));
+ }
+ get instanceMembers() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.instanceMembers unimplemented"));
+ }
+ get isAbstract() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.isAbstract unimplemented"));
+ }
+ get isEnum() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.isEnum unimplemented"));
+ }
+ get isOriginalDeclaration() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.isOriginalDeclaration unimplemented"));
+ }
+ get isPrivate() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.isPrivate unimplemented"));
+ }
+ get isTopLevel() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.isTopLevel unimplemented"));
+ }
+ get location() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.location unimplemented"));
+ }
+ get mixin() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.mixin unimplemented"));
+ }
+ get originalDeclaration() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.originalDeclaration unimplemented"));
+ }
+ get owner() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.owner unimplemented"));
+ }
+ get qualifiedName() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.qualifiedName unimplemented"));
+ }
+ get reflectedType() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.reflectedType unimplemented"));
+ }
+ get staticMembers() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.staticMembers unimplemented"));
+ }
+ get superclass() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.superclass unimplemented"));
+ }
+ get typeArguments() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.typeArguments unimplemented"));
+ }
+ get typeVariables() {
+ return dart.throw(new core.UnimplementedError("ClassMirror.typeVariables unimplemented"));
+ }
}
JsClassMirror[dart.implements] = () => [mirrors.ClassMirror];
dart.defineNamedConstructor(JsClassMirror, '_');
dart.setSignature(JsClassMirror, {
constructors: () => ({_: [JsClassMirror, [core.Type]]}),
- methods: () => ({newInstance: [mirrors.InstanceMirror, [core.Symbol, core.List], [core.Map$(core.Symbol, dart.dynamic)]]})
+ methods: () => ({
+ newInstance: [mirrors.InstanceMirror, [core.Symbol, core.List], [core.Map$(core.Symbol, dart.dynamic)]],
+ getField: [mirrors.InstanceMirror, [core.Symbol]],
+ invoke: [mirrors.InstanceMirror, [core.Symbol, core.List], [core.Map$(core.Symbol, dart.dynamic)]],
+ isAssignableTo: [core.bool, [mirrors.TypeMirror]],
+ isSubclassOf: [core.bool, [mirrors.ClassMirror]],
+ isSubtypeOf: [core.bool, [mirrors.TypeMirror]],
+ setField: [mirrors.InstanceMirror, [core.Symbol, core.Object]]
+ })
});
class JsTypeMirror extends core.Object {
_(reflectedType) {
this.reflectedType = reflectedType;
+ this.hasReflectedType = true;
+ }
+ isAssignableTo(other) {
+ return dart.throw(new core.UnimplementedError("TypeMirror.isAssignable unimplemented"));
+ }
+ isSubtypeOf(other) {
+ return dart.throw(new core.UnimplementedError("TypeMirror.isSubtypeOf unimplemented"));
+ }
+ get isOriginalDeclaration() {
+ return dart.throw(new core.UnimplementedError("TypeMirror.isOriginalDeclaration unimplemented"));
+ }
+ get isPrivate() {
+ return dart.throw(new core.UnimplementedError("TypeMirror.isPrivate unimplemented"));
+ }
+ get isTopLevel() {
+ return dart.throw(new core.UnimplementedError("TypeMirror.isTopLevel unimplemented"));
+ }
+ get location() {
+ return dart.throw(new core.UnimplementedError("TypeMirror.location unimplemented"));
+ }
+ get metadata() {
+ return dart.throw(new core.UnimplementedError("TypeMirror.metadata unimplemented"));
+ }
+ get originalDeclaration() {
+ return dart.throw(new core.UnimplementedError("TypeMirror.originalDeclaration unimplemented"));
+ }
+ get owner() {
+ return dart.throw(new core.UnimplementedError("TypeMirror.owner unimplemented"));
+ }
+ get qualifiedName() {
+ return dart.throw(new core.UnimplementedError("TypeMirror.qualifiedName unimplemented"));
+ }
+ get simpleName() {
+ return dart.throw(new core.UnimplementedError("TypeMirror.simpleName unimplemented"));
+ }
+ get typeArguments() {
+ return dart.throw(new core.UnimplementedError("TypeMirror.typeArguments unimplemented"));
+ }
+ get typeVariables() {
+ return dart.throw(new core.UnimplementedError("TypeMirror.typeVariables unimplemented"));
}
}
JsTypeMirror[dart.implements] = () => [mirrors.TypeMirror];
dart.defineNamedConstructor(JsTypeMirror, '_');
dart.setSignature(JsTypeMirror, {
- constructors: () => ({_: [JsTypeMirror, [core.Type]]})
+ constructors: () => ({_: [JsTypeMirror, [core.Type]]}),
+ methods: () => ({
+ isAssignableTo: [core.bool, [mirrors.TypeMirror]],
+ isSubtypeOf: [core.bool, [mirrors.TypeMirror]]
+ })
});
let _name = Symbol('_name');
class JsParameterMirror extends core.Object {
- _(name, t) {
- this.metadata = dart.list([], mirrors.InstanceMirror);
+ _(name, t, annotations) {
this[_name] = name;
this.type = new JsTypeMirror._(t);
+ this.metadata = core.List$(mirrors.InstanceMirror).from(annotations[dartx.map](dart.fn(a => new JsInstanceMirror._(a), JsInstanceMirror, [dart.dynamic])));
+ }
+ get defaultValue() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.defaultValues unimplemented"));
+ }
+ get hasDefaultValue() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.hasDefaultValue unimplemented"));
+ }
+ get isConst() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.isConst unimplemented"));
+ }
+ get isFinal() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.isFinal unimplemented"));
+ }
+ get isNamed() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.isNamed unimplemented"));
+ }
+ get isOptional() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.isOptional unimplemented"));
+ }
+ get isPrivate() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.isPrivate unimplemented"));
+ }
+ get isStatic() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.isStatic unimplemented"));
+ }
+ get isTopLevel() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.isTopLevel unimplemented"));
+ }
+ get location() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.location unimplemented"));
+ }
+ get owner() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.owner unimplemented"));
+ }
+ get qualifiedName() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.qualifiedName unimplemented"));
+ }
+ get simpleName() {
+ return dart.throw(new core.UnimplementedError("ParameterMirror.simpleName unimplemented"));
}
}
JsParameterMirror[dart.implements] = () => [mirrors.ParameterMirror];
dart.defineNamedConstructor(JsParameterMirror, '_');
dart.setSignature(JsParameterMirror, {
- constructors: () => ({_: [JsParameterMirror, [core.String, core.Type]]})
+ constructors: () => ({_: [JsParameterMirror, [core.String, core.Type, core.List]]})
});
let _method = Symbol('_method');
let _params = Symbol('_params');
@@ -177,16 +356,81 @@ dart_library.library('dart/_js_mirrors', null, /* Imports */[
let params = core.List$(mirrors.ParameterMirror).new(dart.notNull(args[dartx.length]) + dart.notNull(opts[dartx.length]));
for (let i = 0; dart.notNull(i) < dart.notNull(args[dartx.length]); i = dart.notNull(i) + 1) {
let type = args[dartx.get](i);
- let param = new JsParameterMirror._('', dart.as(type, core.Type));
+ let metadata = dart.dindex(dart.dload(ftype, 'metadata'), i);
+ let param = new JsParameterMirror._('', dart.as(type, core.Type), dart.as(metadata, core.List));
params[dartx.set](i, param);
}
for (let i = 0; dart.notNull(i) < dart.notNull(opts[dartx.length]); i = dart.notNull(i) + 1) {
let type = opts[dartx.get](i);
- let param = new JsParameterMirror._('', dart.as(type, core.Type));
+ let metadata = dart.dindex(dart.dload(ftype, 'metadata'), dart.notNull(args[dartx.length]) + dart.notNull(i));
+ let param = new JsParameterMirror._('', dart.as(type, core.Type), dart.as(metadata, core.List));
params[dartx.set](dart.notNull(i) + dart.notNull(args[dartx.length]), param);
}
return params;
}
+ get isAbstract() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isAbstract unimplemented"));
+ }
+ get isConstConstructor() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isConstConstructor unimplemented"));
+ }
+ get isConstructor() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isConstructor unimplemented"));
+ }
+ get isFactoryConstructor() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isFactoryConstructor unimplemented"));
+ }
+ get isGenerativeConstructor() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isGenerativeConstructor unimplemented"));
+ }
+ get isGetter() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isGetter unimplemented"));
+ }
+ get isOperator() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isOperator unimplemented"));
+ }
+ get isPrivate() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isPrivate unimplemented"));
+ }
+ get isRedirectingConstructor() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isRedirectingConstructor unimplemented"));
+ }
+ get isRegularMethod() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isRegularMethod unimplemented"));
+ }
+ get isSetter() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isSetter unimplemented"));
+ }
+ get isStatic() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isStatic unimplemented"));
+ }
+ get isSynthetic() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isSynthetic unimplemented"));
+ }
+ get isTopLevel() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.isTopLevel unimplemented"));
+ }
+ get location() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.location unimplemented"));
+ }
+ get metadata() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.metadata unimplemented"));
+ }
+ get owner() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.owner unimplemented"));
+ }
+ get qualifiedName() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.qualifiedName unimplemented"));
+ }
+ get returnType() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.returnType unimplemented"));
+ }
+ get simpleName() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.simpleName unimplemented"));
+ }
+ get source() {
+ return dart.throw(new core.UnimplementedError("MethodMirror.source unimplemented"));
+ }
}
JsMethodMirror[dart.implements] = () => [mirrors.MethodMirror];
dart.defineNamedConstructor(JsMethodMirror, '_');
« no previous file with comments | « lib/runtime/_types.js ('k') | lib/runtime/dart_utils.js » ('j') | lib/runtime/dart_utils.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698