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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 922023002: Implement DeclarationMirror.location for all but ParameterMirrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors_impl.dart
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index acdfaff295936b07068476e83bfb5c8aab2029e3..b8067e418ee1f2557948b54dc2c1bd17e490417f 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -80,6 +80,9 @@ String _makeSignatureString(TypeMirror returnType,
return buf.toString();
}
+SourceLocation _location(reflectee)
+ native "DeclarationMirror_location";
+
List _metadata(reflectee)
native 'DeclarationMirror_metadata';
@@ -325,9 +328,9 @@ class _SyntheticAccessor implements MethodMirror {
[new _SyntheticSetterParameter(this, this._target)]);
}
+ SourceLocation get location => null;
List<InstanceMirror> get metadata => emptyList;
String get source => null;
- SourceLocation get location => null;
}
class _SyntheticSetterParameter implements ParameterMirror {
@@ -349,8 +352,8 @@ class _SyntheticSetterParameter implements ParameterMirror {
bool get isPrivate => false;
bool get hasDefaultValue => false;
InstanceMirror get defaultValue => null;
+ SourceLocation get location => null;
List<InstanceMirror> get metadata => emptyList;
- SourceLocation get location => throw new UnimplementedError();
}
abstract class _LocalObjectMirror extends _LocalMirror implements ObjectMirror {
@@ -637,7 +640,7 @@ class _LocalClassMirror extends _LocalObjectMirror
final bool isTopLevel = true;
SourceLocation get location {
- throw new UnimplementedError('ClassMirror.location is not implemented');
+ return _location(_reflectee);
}
ClassMirror _trueSuperclassField;
@@ -1044,6 +1047,10 @@ abstract class _LocalDeclarationMirror extends _LocalMirror
bool get isPrivate => _n(simpleName).startsWith('_');
+ SourceLocation get location {
+ return _location(_reflectee);
+ }
+
List<InstanceMirror> get metadata {
// Get the metadata objects, convert them into InstanceMirrors using
// reflect() and then make them into a Dart list.
@@ -1076,11 +1083,6 @@ class _LocalTypeVariableMirror extends _LocalDeclarationMirror
bool get isStatic => false;
bool get isTopLevel => false;
- SourceLocation get location {
- throw new UnimplementedError(
- 'TypeVariableMirror.location is not implemented');
- }
-
TypeMirror _upperBound = null;
TypeMirror get upperBound {
if (_upperBound == null) {
@@ -1155,10 +1157,6 @@ class _LocalTypedefMirror extends _LocalDeclarationMirror
return _owner;
}
- SourceLocation get location {
- throw new UnimplementedError('TypedefMirror.location is not implemented');
- }
-
TypeMirror _referent = null;
TypeMirror get referent {
if (_referent == null) {
@@ -1264,10 +1262,6 @@ class _LocalLibraryMirror extends _LocalObjectMirror implements LibraryMirror {
Type get _instantiator => null;
- SourceLocation get location {
- throw new UnimplementedError('LibraryMirror.location is not implemented');
- }
-
Map<Symbol, DeclarationMirror> _declarations;
Map<Symbol, DeclarationMirror> get declarations {
if (_declarations != null) return _declarations;
@@ -1283,6 +1277,10 @@ class _LocalLibraryMirror extends _LocalObjectMirror implements LibraryMirror {
return _cachedMembers;
}
+ SourceLocation get location {
+ return _location(_reflectee);
+ }
+
List<InstanceMirror> get metadata {
// Get the metadata objects, convert them into InstanceMirrors using
// reflect() and then make them into a Dart list.
@@ -1400,14 +1398,6 @@ class _LocalMethodMirror extends _LocalDeclarationMirror
bool get isTopLevel => owner is LibraryMirror;
bool get isSynthetic => false;
- SourceLocation _location;
- SourceLocation get location {
- if (_location == null) {
- _location = _MethodMirror_location(_reflectee);
- }
- return _location;
- }
-
Type get _instantiator {
var o = owner;
while (o is MethodMirror) o = o.owner;
@@ -1490,9 +1480,6 @@ class _LocalMethodMirror extends _LocalDeclarationMirror
static String _MethodMirror_source(reflectee)
native "MethodMirror_source";
-
- static SourceLocation _MethodMirror_location(reflectee)
- native "MethodMirror_location";
}
class _LocalVariableMirror extends _LocalDeclarationMirror
@@ -1513,10 +1500,6 @@ class _LocalVariableMirror extends _LocalDeclarationMirror
bool get isTopLevel => owner is LibraryMirror;
- SourceLocation get location {
- throw new UnimplementedError('VariableMirror.location is not implemented');
- }
-
Type get _instantiator {
return owner._instantiator;
}
@@ -1574,6 +1557,10 @@ class _LocalParameterMirror extends _LocalVariableMirror
bool get hasDefaultValue => _defaultValueReflectee != null;
+ SourceLocation get location {
+ throw new UnsupportedError("ParameterMirror.location unimplemented");
+ }
+
List<InstanceMirror> get metadata {
if (_unmirroredMetadata == null) return emptyList;
return new UnmodifiableListView(_unmirroredMetadata.map(reflect));
@@ -1611,6 +1598,7 @@ class _SpecialTypeMirror extends _LocalMirror
DeclarationMirror get owner => null;
+ SourceLocation get location => null;
List<InstanceMirror> get metadata => emptyList;
bool get hasReflectedType => simpleName == #dynamic;
@@ -1625,10 +1613,6 @@ class _SpecialTypeMirror extends _LocalMirror
bool get isOriginalDeclaration => true;
TypeMirror get originalDeclaration => this;
- SourceLocation get location {
- throw new UnimplementedError('TypeMirror.location is not implemented');
- }
-
Symbol get qualifiedName => simpleName;
// TODO(11955): Remove once dynamicType and voidType are canonical objects in
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698