Chromium Code Reviews| 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( |
|
nweiz
2016/05/04 23:05:51
Similarly, I'd call this "FromPositions".
kevmoo
2016/05/05 20:46:26
Done.
|
| + VMScriptRef script, int tokenPos, int endTokenPos) => |
|
nweiz
2016/05/04 23:05:51
Indent +4.
kevmoo
2016/05/05 20:46:26
Done.
|
| + 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) |
|
nweiz
2016/05/04 23:05:51
Rather than changing the calling convention for th
kevmoo
2016/05/05 20:46:26
Done.
|
| + : this.script = script, |
| + token = newVMScriptTokenFromScript(script, tokenPos), |
| + end = newVMScriptTokenFromScript(script, endTokenPos); |
| String toString() => |
| end == null ? "$script at $token" : "$script from $token to $end"; |