OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library script_inset_element; | 5 library script_inset_element; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'observatory_element.dart'; | 9 import 'observatory_element.dart'; |
10 import 'service_ref.dart'; | 10 import 'service_ref.dart'; |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 } | 432 } |
433 | 433 |
434 void computeAnnotations() { | 434 void computeAnnotations() { |
435 _startLine = (startPos != null | 435 _startLine = (startPos != null |
436 ? script.tokenToLine(startPos) | 436 ? script.tokenToLine(startPos) |
437 : 1 + script.lineOffset); | 437 : 1 + script.lineOffset); |
438 _currentLine = (currentPos != null | 438 _currentLine = (currentPos != null |
439 ? script.tokenToLine(currentPos) | 439 ? script.tokenToLine(currentPos) |
440 : null); | 440 : null); |
441 _currentCol = (currentPos != null | 441 _currentCol = (currentPos != null |
442 ? (script.tokenToCol(currentPos) - 1) // make this 0-based. | 442 ? (script.tokenToCol(currentPos)) |
443 : null); | 443 : null); |
| 444 if (_currentCol != null) { |
| 445 _currentCol--; // make this 0-based. |
| 446 } |
| 447 |
444 _endLine = (endPos != null | 448 _endLine = (endPos != null |
445 ? script.tokenToLine(endPos) | 449 ? script.tokenToLine(endPos) |
446 : script.lines.length + script.lineOffset); | 450 : script.lines.length + script.lineOffset); |
447 | 451 |
448 annotations.clear(); | 452 annotations.clear(); |
449 | 453 |
450 addCurrentExecutionAnnotation(); | 454 addCurrentExecutionAnnotation(); |
451 | 455 |
452 if (!inDebuggerContext && script.library != null) { | 456 if (!inDebuggerContext && script.library != null) { |
453 loadDeclarationsOfLibrary(script.library); | 457 loadDeclarationsOfLibrary(script.library); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 variable['value'])); | 561 variable['value'])); |
558 } | 562 } |
559 } | 563 } |
560 } | 564 } |
561 } | 565 } |
562 | 566 |
563 Element linesTable() { | 567 Element linesTable() { |
564 var table = new DivElement(); | 568 var table = new DivElement(); |
565 table.classes.add("sourceTable"); | 569 table.classes.add("sourceTable"); |
566 | 570 |
| 571 if (_startLine == null || _endLine == null) { |
| 572 return table; |
| 573 } |
| 574 |
567 annotationsCursor = 0; | 575 annotationsCursor = 0; |
568 | 576 |
569 int blankLineCount = 0; | 577 int blankLineCount = 0; |
570 for (int i = _startLine; i <= _endLine; i++) { | 578 for (int i = _startLine; i <= _endLine; i++) { |
571 var line = script.getLine(i); | 579 var line = script.getLine(i); |
572 if (line.isBlank) { | 580 if (line.isBlank) { |
573 // Try to introduce elipses if there are 4 or more contiguous | 581 // Try to introduce elipses if there are 4 or more contiguous |
574 // blank lines. | 582 // blank lines. |
575 blankLineCount++; | 583 blankLineCount++; |
576 } else { | 584 } else { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 class SourceInsetElement extends PolymerElement { | 769 class SourceInsetElement extends PolymerElement { |
762 SourceInsetElement.created() : super.created(); | 770 SourceInsetElement.created() : super.created(); |
763 | 771 |
764 @published SourceLocation location; | 772 @published SourceLocation location; |
765 @published String height = null; | 773 @published String height = null; |
766 @published int currentPos; | 774 @published int currentPos; |
767 @published bool inDebuggerContext = false; | 775 @published bool inDebuggerContext = false; |
768 @published ObservableList variables; | 776 @published ObservableList variables; |
769 } | 777 } |
770 | 778 |
OLD | NEW |