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

Unified Diff: lib/src/source_location.dart

Issue 1929063002: pkg/vm_service_client: add getSourceReport to VMServiceReference (Closed) Base URL: https://github.com/dart-lang/vm_service_client.git@master
Patch Set: code review Created 4 years, 8 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
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";
« lib/src/isolate.dart ('K') | « lib/src/script.dart ('k') | lib/src/source_report.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698