Index: lib/src/source_location.dart |
diff --git a/lib/src/source_location.dart b/lib/src/source_location.dart |
index cfe265129fb50efcd7869f58335dfefd1cb32732..2767a2f13a90510edf8447d186e409fc7c1b44b8 100644 |
--- a/lib/src/source_location.dart |
+++ b/lib/src/source_location.dart |
@@ -6,13 +6,18 @@ 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); |
+ |
+ var script = newVMScriptRef(scope, json["script"]); |
+ return new VMSourceLocation._(script, json["tokenPos"], json["endTokenPos"]); |
} |
+VMSourceLocation newVMSourceLocationFromLocation( |
+ VMScriptRef script, int tokenPos, int endTokenPos) => |
+ new VMSourceLocation._(script, tokenPos, endTokenPos); |
+ |
/// A location or span of code in a Dart script. |
class VMSourceLocation implements VMBreakpointLocation { |
/// The script containing the source location. |
@@ -27,12 +32,10 @@ class VMSourceLocation implements VMBreakpointLocation { |
/// The final token of the location, or `null` if this is not a span. |
final VMScriptToken end; |
- VMSourceLocation._(Scope scope, Map json) |
- : script = newVMScriptRef(scope, json["script"]), |
- token = newVMScriptToken( |
- scope.isolateId, json["script"]["id"], json["tokenPos"]), |
- end = newVMScriptToken( |
- scope.isolateId, json["script"]["id"], json["endTokenPos"]); |
+ VMSourceLocation._(VMScriptRef script, int tokenPos, int endTokenPos) |
+ : this.script = script, |
+ token = newVMScriptTokenFromScript(script, tokenPos), |
+ end = newVMScriptTokenFromScript(script, endTokenPos); |
String toString() => |
end == null ? "$script at $token" : "$script from $token to $end"; |