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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 211243009: Implement MethodMirror.location in the VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add to api and fix type warnings Created 6 years, 9 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 4da4e96c6cf9894b304de8cb2cedcf5307f1ab72..9983abba1410f3288f11f6f7bb3cdefdbc63ff3d 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -142,6 +142,21 @@ class _LocalMirrorSystem extends MirrorSystem {
String toString() => "MirrorSystem for isolate '${isolate.debugName}'";
}
+class _SourceLocation implements SourceLocation {
+ _SourceLocation(uriString, this.line, this.column)
+ : this.sourceUri = Uri.parse(uriString);
+
+ // Line and column positions are 1-origin, or 0 if unknown.
+ final int line;
+ final int column;
+
+ final Uri sourceUri;
+
+ String toString() {
+ return column == 0 ? "$sourceUri:$line" : "$sourceUri:$line:$column";
+ }
+}
+
abstract class _LocalMirror implements Mirror {}
class _LocalIsolateMirror extends _LocalMirror implements IsolateMirror {
@@ -195,7 +210,7 @@ class _SyntheticAccessor implements MethodMirror {
List<InstanceMirror> get metadata => emptyList;
String get source => null;
- SourceLocation get location => throw new UnimplementedError();
+ SourceLocation get location => null;
}
class _SyntheticSetterParameter implements ParameterMirror {
@@ -1301,8 +1316,12 @@ class _LocalMethodMirror extends _LocalDeclarationMirror
bool get isTopLevel => owner is LibraryMirror;
bool get isSynthetic => false;
+ SourceLocation _location;
SourceLocation get location {
- throw new UnimplementedError('MethodMirror.location is not implemented');
+ if (_location == null) {
+ _location = _MethodMirror_location(_reflectee);
+ }
+ return _location;
}
Type get _instantiator {
@@ -1387,6 +1406,9 @@ class _LocalMethodMirror extends _LocalDeclarationMirror
static String _MethodMirror_source(reflectee)
native "MethodMirror_source";
+
+ static SourceLocation _MethodMirror_location(reflectee)
+ native "MethodMirror_location";
}
class _LocalVariableMirror extends _LocalDeclarationMirror
« 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