OLD | NEW |
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 part of debugger; | 5 part of debugger; |
6 | 6 |
7 class DebuggerLocation { | 7 class DebuggerLocation { |
8 DebuggerLocation.file(this.script, this.line, this.col); | 8 DebuggerLocation.file(this.script, this.line, this.col); |
9 DebuggerLocation.func(this.function); | 9 DebuggerLocation.func(this.function); |
10 DebuggerLocation.error(this.errorMessage); | 10 DebuggerLocation.error(this.errorMessage); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 if (scriptName != null) { | 91 if (scriptName != null) { |
92 // Resolve the script. | 92 // Resolve the script. |
93 var scripts = await _lookupScript(debugger.isolate, scriptName); | 93 var scripts = await _lookupScript(debugger.isolate, scriptName); |
94 if (scripts.length == 0) { | 94 if (scripts.length == 0) { |
95 return new DebuggerLocation.error("Script '${scriptName}' not found"); | 95 return new DebuggerLocation.error("Script '${scriptName}' not found"); |
96 } else if (scripts.length == 1) { | 96 } else if (scripts.length == 1) { |
97 return new DebuggerLocation.file(scripts[0], line, col); | 97 return new DebuggerLocation.file(scripts[0], line, col); |
98 } else { | 98 } else { |
99 // TODO(turnidge): Allow the user to disambiguate. | 99 // TODO(turnidge): Allow the user to disambiguate. |
100 return new DebuggerLocation.error("Script '${scriptName}' is ambigous"); | 100 return |
| 101 new DebuggerLocation.error("Script '${scriptName}' is ambiguous"); |
101 } | 102 } |
102 } else { | 103 } else { |
103 // No script provided. Default to top of stack for now. | 104 // No script provided. Default to top of stack for now. |
104 var frame = await _currentFrame(debugger); | 105 var frame = await _currentFrame(debugger); |
105 if (frame == null) { | 106 if (frame == null) { |
106 return new Future.value(new DebuggerLocation.error( | 107 return new Future.value(new DebuggerLocation.error( |
107 'A script must be provided when the stack is empty')); | 108 'A script must be provided when the stack is empty')); |
108 } | 109 } |
109 Script script = frame.location.script; | 110 Script script = frame.location.script; |
110 await script.load(); | 111 await script.load(); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 247 } |
247 } | 248 } |
248 if (functions.length == 0) { | 249 if (functions.length == 0) { |
249 return new DebuggerLocation.error( | 250 return new DebuggerLocation.error( |
250 "Function '${match.group(0)}' not found"); | 251 "Function '${match.group(0)}' not found"); |
251 } else if (functions.length == 1) { | 252 } else if (functions.length == 1) { |
252 return new DebuggerLocation.func(functions[0]); | 253 return new DebuggerLocation.func(functions[0]); |
253 } else { | 254 } else { |
254 // TODO(turnidge): Allow the user to disambiguate. | 255 // TODO(turnidge): Allow the user to disambiguate. |
255 return new DebuggerLocation.error( | 256 return new DebuggerLocation.error( |
256 "Function '${match.group(0)}' is ambigous"); | 257 "Function '${match.group(0)}' is ambiguous"); |
257 } | 258 } |
258 return new DebuggerLocation.error('foo'); | 259 return new DebuggerLocation.error('foo'); |
259 }); | 260 }); |
260 } | 261 } |
261 | 262 |
262 static RegExp partialSourceLocMatcher = | 263 static RegExp partialSourceLocMatcher = |
263 new RegExp(r'^([^\d:]?[^:]+[:]?)?(\d+)?([:]\d*)?'); | 264 new RegExp(r'^([^\d:]?[^:]+[:]?)?(\d+)?([:]\d*)?'); |
264 static RegExp partialFunctionMatcher = new RegExp(r'^([^.]*)([.][^.]*)?'); | 265 static RegExp partialFunctionMatcher = new RegExp(r'^([^.]*)([.][^.]*)?'); |
265 | 266 |
266 /// Completes a partial source location description. | 267 /// Completes a partial source location description. |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 return 'invalid source location (${errorMessage})'; | 446 return 'invalid source location (${errorMessage})'; |
446 } | 447 } |
447 | 448 |
448 Script script; | 449 Script script; |
449 int line; | 450 int line; |
450 int col; | 451 int col; |
451 ServiceFunction function; | 452 ServiceFunction function; |
452 String errorMessage; | 453 String errorMessage; |
453 bool get valid => (errorMessage == null); | 454 bool get valid => (errorMessage == null); |
454 } | 455 } |
OLD | NEW |