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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'breakpoint.dart'; 5 import 'breakpoint.dart';
6 import 'scope.dart'; 6 import 'scope.dart';
7 import 'script.dart'; 7 import 'script.dart';
8 8
9 VMSourceLocation newVMSourceLocation(Scope scope, 9 VMSourceLocation newVMSourceLocation(Scope scope, Map json) {
10 Map json) {
11 if (json == null) return null; 10 if (json == null) return null;
12 assert(json["type"] == "SourceLocation"); 11 assert(json["type"] == "SourceLocation");
13 return new VMSourceLocation._(scope, json); 12
13 var script = newVMScriptRef(scope, json["script"]);
14 return new VMSourceLocation._(script, json["tokenPos"], json["endTokenPos"]);
14 } 15 }
15 16
17 VMSourceLocation newVMSourceLocationFromLocation(
18 VMScriptRef script, int tokenPos, int endTokenPos) =>
19 new VMSourceLocation._(script, tokenPos, endTokenPos);
20
16 /// A location or span of code in a Dart script. 21 /// A location or span of code in a Dart script.
17 class VMSourceLocation implements VMBreakpointLocation { 22 class VMSourceLocation implements VMBreakpointLocation {
18 /// The script containing the source location. 23 /// The script containing the source location.
19 final VMScriptRef script; 24 final VMScriptRef script;
20 25
21 /// The canonical source URI of [script]. 26 /// The canonical source URI of [script].
22 Uri get uri => script.uri; 27 Uri get uri => script.uri;
23 28
24 /// If this is a span, this represents the start of that span. 29 /// If this is a span, this represents the start of that span.
25 final VMScriptToken token; 30 final VMScriptToken token;
26 31
27 /// The final token of the location, or `null` if this is not a span. 32 /// The final token of the location, or `null` if this is not a span.
28 final VMScriptToken end; 33 final VMScriptToken end;
29 34
30 VMSourceLocation._(Scope scope, Map json) 35 VMSourceLocation._(VMScriptRef script, int tokenPos, int endTokenPos)
31 : script = newVMScriptRef(scope, json["script"]), 36 : this.script = script,
32 token = newVMScriptToken( 37 token = newVMScriptTokenFromScript(script, tokenPos),
33 scope.isolateId, json["script"]["id"], json["tokenPos"]), 38 end = newVMScriptTokenFromScript(script, endTokenPos);
34 end = newVMScriptToken(
35 scope.isolateId, json["script"]["id"], json["endTokenPos"]);
36 39
37 String toString() => 40 String toString() =>
38 end == null ? "$script at $token" : "$script from $token to $end"; 41 end == null ? "$script at $token" : "$script from $token to $end";
39 } 42 }
OLDNEW
« 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