| 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 /// Source information system mapping that attempts a semantic mapping between | 5 /// Source information system mapping that attempts a semantic mapping between |
| 6 /// offsets of JavaScript code points to offsets of Dart code points. | 6 /// offsets of JavaScript code points to offsets of Dart code points. |
| 7 | 7 |
| 8 library dart2js.source_information.position; | 8 library dart2js.source_information.position; |
| 9 | 9 |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 class PositionTraceListener extends TraceListener | 515 class PositionTraceListener extends TraceListener |
| 516 with NodeToSourceInformationMixin { | 516 with NodeToSourceInformationMixin { |
| 517 final SourceMapper sourceMapper; | 517 final SourceMapper sourceMapper; |
| 518 | 518 |
| 519 PositionTraceListener(this.sourceMapper); | 519 PositionTraceListener(this.sourceMapper); |
| 520 | 520 |
| 521 @override | 521 @override |
| 522 void onStep(js.Node node, Offset offset, StepKind kind) { | 522 void onStep(js.Node node, Offset offset, StepKind kind) { |
| 523 SourceInformation sourceInformation = computeSourceInformation(node); | 523 SourceInformation sourceInformation = computeSourceInformation(node); |
| 524 if (sourceInformation == null) return; | 524 if (sourceInformation == null) return; |
| 525 int codeLocation = offset.subexpressionOffset; | 525 int codeLocation = offset.value; |
| 526 if (codeLocation == null) return; | 526 if (codeLocation == null) return; |
| 527 | 527 |
| 528 void registerPosition(SourcePositionKind sourcePositionKind) { | 528 void registerPosition(SourcePositionKind sourcePositionKind) { |
| 529 SourceLocation sourceLocation = | 529 SourceLocation sourceLocation = |
| 530 getSourceLocation(sourceInformation, sourcePositionKind); | 530 getSourceLocation(sourceInformation, sourcePositionKind); |
| 531 if (sourceLocation != null) { | 531 if (sourceLocation != null) { |
| 532 sourceMapper.register(node, codeLocation, sourceLocation); | 532 sourceMapper.register(node, codeLocation, sourceLocation); |
| 533 } | 533 } |
| 534 } | 534 } |
| 535 | 535 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 /// ^ // the left-to-right offset of the `baz()` call | 669 /// ^ // the left-to-right offset of the `baz()` call |
| 670 /// | 670 /// |
| 671 /// Here, `baz()` is executed before `foo()` so we need to use 'f' as its best | 671 /// Here, `baz()` is executed before `foo()` so we need to use 'f' as its best |
| 672 /// position under the restriction. | 672 /// position under the restriction. |
| 673 /// | 673 /// |
| 674 final int leftToRightOffset; | 674 final int leftToRightOffset; |
| 675 | 675 |
| 676 Offset( | 676 Offset( |
| 677 this.statementOffset, this.leftToRightOffset, this.subexpressionOffset); | 677 this.statementOffset, this.leftToRightOffset, this.subexpressionOffset); |
| 678 | 678 |
| 679 int get value => subexpressionOffset; |
| 680 |
| 679 String toString() { | 681 String toString() { |
| 680 return 'Offset[statementOffset=$statementOffset,' | 682 return 'Offset[statementOffset=$statementOffset,' |
| 681 'leftToRightOffset=$leftToRightOffset,' | 683 'leftToRightOffset=$leftToRightOffset,' |
| 682 'subexpressionOffset=$subexpressionOffset]'; | 684 'subexpressionOffset=$subexpressionOffset]'; |
| 683 } | 685 } |
| 684 } | 686 } |
| 685 | 687 |
| 686 enum BranchKind { CONDITION, LOOP, CATCH, FINALLY, CASE, } | 688 enum BranchKind { CONDITION, LOOP, CATCH, FINALLY, CASE, } |
| 687 | 689 |
| 688 enum StepKind { | 690 enum StepKind { |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 | 1279 |
| 1278 @override | 1280 @override |
| 1279 CodePosition operator [](js.Node node) { | 1281 CodePosition operator [](js.Node node) { |
| 1280 CodePosition codePosition = codePositions[node]; | 1282 CodePosition codePosition = codePositions[node]; |
| 1281 if (codePosition == null) { | 1283 if (codePosition == null) { |
| 1282 coverage.registerNodesWithoutOffset(node); | 1284 coverage.registerNodesWithoutOffset(node); |
| 1283 } | 1285 } |
| 1284 return codePosition; | 1286 return codePosition; |
| 1285 } | 1287 } |
| 1286 } | 1288 } |
| OLD | NEW |