Index: lib/src/source_location.dart |
diff --git a/lib/src/source_location.dart b/lib/src/source_location.dart |
index cfe265129fb50efcd7869f58335dfefd1cb32732..821ffeb090e03cfd09a1ecf163229247d89c32d5 100644 |
--- a/lib/src/source_location.dart |
+++ b/lib/src/source_location.dart |
@@ -6,13 +6,16 @@ import 'breakpoint.dart'; |
import 'scope.dart'; |
import 'script.dart'; |
-VMSourceLocation newVMSourceLocation(Scope scope, |
- Map json) { |
+VMSourceLocation newVMSourceLocation(Scope scope, Map json) { |
if (json == null) return null; |
assert(json["type"] == "SourceLocation"); |
return new VMSourceLocation._(scope, json); |
} |
+VMSourceLocation newVMSourceLocationFromPosition( |
+ VMScriptRef script, int tokenPos, int endTokenPos) => |
+ new VMSourceLocation._fromPositions(script, tokenPos, endTokenPos); |
+ |
/// A location or span of code in a Dart script. |
class VMSourceLocation implements VMBreakpointLocation { |
/// The script containing the source location. |
@@ -34,6 +37,12 @@ class VMSourceLocation implements VMBreakpointLocation { |
end = newVMScriptToken( |
scope.isolateId, json["script"]["id"], json["endTokenPos"]); |
+ VMSourceLocation._fromPositions( |
+ VMScriptRef script, int tokenPos, int endTokenPos) |
+ : this.script = script, |
+ token = newVMScriptTokenFromPosition(script, tokenPos), |
+ end = newVMScriptTokenFromPosition(script, endTokenPos); |
+ |
String toString() => |
end == null ? "$script at $token" : "$script from $token to $end"; |
} |