| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 await _lookupScript(debugger.isolate, scriptName, allowPrefix:false); | 394 await _lookupScript(debugger.isolate, scriptName, allowPrefix:false); |
| 395 if (scripts.isEmpty) { | 395 if (scripts.isEmpty) { |
| 396 return []; | 396 return []; |
| 397 } | 397 } |
| 398 var script = scripts[0]; | 398 var script = scripts[0]; |
| 399 await script.load(); | 399 await script.load(); |
| 400 if (!lineStrComplete) { | 400 if (!lineStrComplete) { |
| 401 // Complete the line. | 401 // Complete the line. |
| 402 var sharedPrefix = '${script.name}:'; | 402 var sharedPrefix = '${script.name}:'; |
| 403 List completions = []; | 403 List completions = []; |
| 404 for (var line in script.lines) { | 404 var report = await script.isolate.getSourceReport( |
| 405 if (line.possibleBpt) { | 405 [Isolate.kPossibleBreakpointsReport], script); |
| 406 var currentLineStr = line.line.toString(); | 406 Set<int> possibleBpts = getPossibleBreakpointLines(report, script); |
| 407 if (currentLineStr.startsWith(lineStr)) { | 407 for (var line in possibleBpts) { |
| 408 completions.add('${sharedPrefix}${currentLineStr} '); | 408 var currentLineStr = line.toString(); |
| 409 completions.add('${sharedPrefix}${currentLineStr}:'); | 409 if (currentLineStr.startsWith(lineStr)) { |
| 410 } | 410 completions.add('${sharedPrefix}${currentLineStr} '); |
| 411 completions.add('${sharedPrefix}${currentLineStr}:'); |
| 411 } | 412 } |
| 412 } | 413 } |
| 413 return completions; | 414 return completions; |
| 414 | 415 |
| 415 } else { | 416 } else { |
| 416 // Complete the column. | 417 // Complete the column. |
| 417 int lineNum = int.parse(lineStr); | 418 int lineNum = int.parse(lineStr); |
| 418 var scriptLine = script.getLine(lineNum); | 419 var scriptLine = script.getLine(lineNum); |
| 419 if (!scriptLine.possibleBpt) { | |
| 420 return []; | |
| 421 } | |
| 422 var sharedPrefix = '${script.name}:${lineStr}:'; | 420 var sharedPrefix = '${script.name}:${lineStr}:'; |
| 423 List completions = []; | 421 List completions = []; |
| 424 int maxCol = scriptLine.text.trimRight().runes.length; | 422 int maxCol = scriptLine.text.trimRight().runes.length; |
| 425 for (int i = 1; i <= maxCol; i++) { | 423 for (int i = 1; i <= maxCol; i++) { |
| 426 var currentColStr = i.toString(); | 424 var currentColStr = i.toString(); |
| 427 if (currentColStr.startsWith(colStr)) { | 425 if (currentColStr.startsWith(colStr)) { |
| 428 completions.add('${sharedPrefix}${currentColStr} '); | 426 completions.add('${sharedPrefix}${currentColStr} '); |
| 429 } | 427 } |
| 430 } | 428 } |
| 431 return completions; | 429 return completions; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 446 return 'invalid source location (${errorMessage})'; | 444 return 'invalid source location (${errorMessage})'; |
| 447 } | 445 } |
| 448 | 446 |
| 449 Script script; | 447 Script script; |
| 450 int line; | 448 int line; |
| 451 int col; | 449 int col; |
| 452 ServiceFunction function; | 450 ServiceFunction function; |
| 453 String errorMessage; | 451 String errorMessage; |
| 454 bool get valid => (errorMessage == null); | 452 bool get valid => (errorMessage == null); |
| 455 } | 453 } |
| OLD | NEW |