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

Side by Side Diff: tool/input_sdk/private/js_mirrors.dart

Issue 1489043002: More mirrors (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Cleanup Created 5 years 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
« no previous file with comments | « lib/runtime/dart/_js_mirrors.js ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart._js_mirrors; 5 library dart._js_mirrors;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 import 'dart:_foreign_helper' show JS; 8 import 'dart:_foreign_helper' show JS;
9 import 'dart:_internal' as _internal; 9 import 'dart:_internal' as _internal;
10 10
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 InstanceMirror newInstance(Symbol constructorName, List args, 113 InstanceMirror newInstance(Symbol constructorName, List args,
114 [Map<Symbol, dynamic> namedArgs]) { 114 [Map<Symbol, dynamic> namedArgs]) {
115 // TODO(vsm): Support named constructors and named arguments. 115 // TODO(vsm): Support named constructors and named arguments.
116 assert(getName(constructorName) == ""); 116 assert(getName(constructorName) == "");
117 assert(namedArgs == null || namedArgs.isEmpty); 117 assert(namedArgs == null || namedArgs.isEmpty);
118 var instance = JS('', 'new #(...#)', _cls, args); 118 var instance = JS('', 'new #(...#)', _cls, args);
119 return new JsInstanceMirror._(instance); 119 return new JsInstanceMirror._(instance);
120 } 120 }
121 121
122 List<ClassMirror> get superinterfaces { 122 List<ClassMirror> get superinterfaces {
123 var interfaces = JS('Function', '#[dart.implements]', _cls); 123 var interfaceThunk = JS('Function', '#[dart.implements]', _cls);
124 if (interfaces == null) { 124 if (interfaceThunk == null) {
125 return []; 125 return [];
126 } else {
127 List<Type> interfaces = interfaceThunk();
128 return interfaces.map((t) => new JsClassMirror._(t)).toList();
126 } 129 }
127 throw new UnimplementedError("ClassMirror.superinterfaces unimplemented");
128 } 130 }
129 131
130 // TODO(vsm): Implement 132 // TODO(vsm): Implement
131 InstanceMirror getField(Symbol fieldName) => 133 InstanceMirror getField(Symbol fieldName) =>
132 throw new UnimplementedError("ClassMirror.getField unimplemented"); 134 throw new UnimplementedError("ClassMirror.getField unimplemented");
133 InstanceMirror invoke(Symbol memberName, List positionalArguments, 135 InstanceMirror invoke(Symbol memberName, List positionalArguments,
134 [Map<Symbol, dynamic> namedArguments]) => 136 [Map<Symbol, dynamic> namedArguments]) =>
135 throw new UnimplementedError("ClassMirror.invoke unimplemented"); 137 throw new UnimplementedError("ClassMirror.invoke unimplemented");
136 bool isAssignableTo(TypeMirror other) => 138 bool isAssignableTo(TypeMirror other) =>
137 throw new UnimplementedError("ClassMirror.isAssignable unimplemented"); 139 throw new UnimplementedError("ClassMirror.isAssignable unimplemented");
(...skipping 14 matching lines...) Expand all
152 bool get isOriginalDeclaration => throw new UnimplementedError( 154 bool get isOriginalDeclaration => throw new UnimplementedError(
153 "ClassMirror.isOriginalDeclaration unimplemented"); 155 "ClassMirror.isOriginalDeclaration unimplemented");
154 bool get isPrivate => 156 bool get isPrivate =>
155 throw new UnimplementedError("ClassMirror.isPrivate unimplemented"); 157 throw new UnimplementedError("ClassMirror.isPrivate unimplemented");
156 bool get isTopLevel => 158 bool get isTopLevel =>
157 throw new UnimplementedError("ClassMirror.isTopLevel unimplemented"); 159 throw new UnimplementedError("ClassMirror.isTopLevel unimplemented");
158 SourceLocation get location => 160 SourceLocation get location =>
159 throw new UnimplementedError("ClassMirror.location unimplemented"); 161 throw new UnimplementedError("ClassMirror.location unimplemented");
160 ClassMirror get mixin => 162 ClassMirror get mixin =>
161 throw new UnimplementedError("ClassMirror.mixin unimplemented"); 163 throw new UnimplementedError("ClassMirror.mixin unimplemented");
162 TypeMirror get originalDeclaration => throw new UnimplementedError( 164 TypeMirror get originalDeclaration {
163 "ClassMirror.originalDeclaration unimplemented"); 165 // TODO(vsm): Handle generic case. How should we represent an original
166 // declaration for a generic class?
167 return this;
168 }
164 DeclarationMirror get owner => 169 DeclarationMirror get owner =>
165 throw new UnimplementedError("ClassMirror.owner unimplemented"); 170 throw new UnimplementedError("ClassMirror.owner unimplemented");
166 Symbol get qualifiedName => 171 Symbol get qualifiedName =>
167 throw new UnimplementedError("ClassMirror.qualifiedName unimplemented"); 172 throw new UnimplementedError("ClassMirror.qualifiedName unimplemented");
168 Type get reflectedType => 173 Type get reflectedType { return _cls; }
169 throw new UnimplementedError("ClassMirror.reflectedType unimplemented");
170 Map<Symbol, MethodMirror> get staticMembers => 174 Map<Symbol, MethodMirror> get staticMembers =>
171 throw new UnimplementedError("ClassMirror.staticMembers unimplemented"); 175 throw new UnimplementedError("ClassMirror.staticMembers unimplemented");
172 ClassMirror get superclass => 176 ClassMirror get superclass {
173 throw new UnimplementedError("ClassMirror.superclass unimplemented"); 177 if (_cls == Object) {
178 return null;
179 } else {
180 return new JsClassMirror._(JS('Type', '#.__proto__', _cls));
181 }
182 }
174 List<TypeMirror> get typeArguments => 183 List<TypeMirror> get typeArguments =>
175 throw new UnimplementedError("ClassMirror.typeArguments unimplemented"); 184 throw new UnimplementedError("ClassMirror.typeArguments unimplemented");
176 List<TypeVariableMirror> get typeVariables => 185 List<TypeVariableMirror> get typeVariables =>
177 throw new UnimplementedError("ClassMirror.typeVariables unimplemented"); 186 throw new UnimplementedError("ClassMirror.typeVariables unimplemented");
178 } 187 }
179 188
180 class JsTypeMirror implements TypeMirror { 189 class JsTypeMirror implements TypeMirror {
181 // TODO(vsm): Support original declarations, etc., where there is no actual 190 // TODO(vsm): Support original declarations, etc., where there is no actual
182 // reflected type. 191 // reflected type.
183 final Type reflectedType; 192 final Type reflectedType;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 bool get isSetter => 331 bool get isSetter =>
323 throw new UnimplementedError("MethodMirror.isSetter unimplemented"); 332 throw new UnimplementedError("MethodMirror.isSetter unimplemented");
324 bool get isStatic => 333 bool get isStatic =>
325 throw new UnimplementedError("MethodMirror.isStatic unimplemented"); 334 throw new UnimplementedError("MethodMirror.isStatic unimplemented");
326 bool get isSynthetic => 335 bool get isSynthetic =>
327 throw new UnimplementedError("MethodMirror.isSynthetic unimplemented"); 336 throw new UnimplementedError("MethodMirror.isSynthetic unimplemented");
328 bool get isTopLevel => 337 bool get isTopLevel =>
329 throw new UnimplementedError("MethodMirror.isTopLevel unimplemented"); 338 throw new UnimplementedError("MethodMirror.isTopLevel unimplemented");
330 SourceLocation get location => 339 SourceLocation get location =>
331 throw new UnimplementedError("MethodMirror.location unimplemented"); 340 throw new UnimplementedError("MethodMirror.location unimplemented");
332 List<InstanceMirror> get metadata => 341 List<InstanceMirror> get metadata {
333 throw new UnimplementedError("MethodMirror.metadata unimplemented"); 342 // TODO(vsm): Parse and store method metadata
343 return <InstanceMirror>[];
344 }
334 DeclarationMirror get owner => 345 DeclarationMirror get owner =>
335 throw new UnimplementedError("MethodMirror.owner unimplemented"); 346 throw new UnimplementedError("MethodMirror.owner unimplemented");
336 Symbol get qualifiedName => 347 Symbol get qualifiedName =>
337 throw new UnimplementedError("MethodMirror.qualifiedName unimplemented"); 348 throw new UnimplementedError("MethodMirror.qualifiedName unimplemented");
338 TypeMirror get returnType => 349 TypeMirror get returnType =>
339 throw new UnimplementedError("MethodMirror.returnType unimplemented"); 350 throw new UnimplementedError("MethodMirror.returnType unimplemented");
340 Symbol get simpleName => 351 Symbol get simpleName =>
341 throw new UnimplementedError("MethodMirror.simpleName unimplemented"); 352 throw new UnimplementedError("MethodMirror.simpleName unimplemented");
342 String get source => 353 String get source =>
343 throw new UnimplementedError("MethodMirror.source unimplemented"); 354 throw new UnimplementedError("MethodMirror.source unimplemented");
344 } 355 }
OLDNEW
« no previous file with comments | « lib/runtime/dart/_js_mirrors.js ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698