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

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: nits Created 4 years, 7 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 | « lib/src/script.dart ('k') | lib/src/source_report.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
}
« no previous file with comments | « 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