Index: pkg/compiler/lib/src/io/position_information.dart |
diff --git a/pkg/compiler/lib/src/io/position_information.dart b/pkg/compiler/lib/src/io/position_information.dart |
index a3169300993e9c8237ebb0892032c24c8155196e..17e83978dd51fbd065e305e29977e4b029724188 100644 |
--- a/pkg/compiler/lib/src/io/position_information.dart |
+++ b/pkg/compiler/lib/src/io/position_information.dart |
@@ -520,11 +520,17 @@ class PositionTraceListener extends TraceListener |
@override |
void onStep(js.Node node, Offset offset, StepKind kind) { |
- SourceInformation sourceInformation = computeSourceInformation(node); |
- if (sourceInformation == null) return; |
int codeLocation = offset.value; |
if (codeLocation == null) return; |
+ if (kind == StepKind.NO_INFO) { |
+ sourceMapper.register(node, codeLocation, const NoSourceLocationMarker()); |
+ return; |
+ } |
+ |
+ SourceInformation sourceInformation = computeSourceInformation(node); |
+ if (sourceInformation == null) return; |
+ |
void registerPosition(SourcePositionKind sourcePositionKind) { |
SourceLocation sourceLocation = |
getSourceLocation(sourceInformation, sourcePositionKind); |
@@ -562,6 +568,8 @@ class PositionTraceListener extends TraceListener |
case StepKind.SWITCH_EXPRESSION: |
registerPosition(SourcePositionKind.START); |
break; |
+ case StepKind.NO_INFO: |
+ break; |
} |
} |
} |
@@ -710,6 +718,7 @@ enum StepKind { |
WHILE_CONDITION, |
DO_CONDITION, |
SWITCH_EXPRESSION, |
+ NO_INFO, |
} |
/// Listener for the [JavaScriptTracer]. |
@@ -775,14 +784,20 @@ class JavaScriptTracer extends js.BaseVisitor { |
} |
} |
- void notifyStep(js.Node node, Offset offset, StepKind kind) { |
- if (active) { |
+ void notifyStep(js.Node node, Offset offset, StepKind kind, |
+ {bool force: false}) { |
+ if (active || force) { |
listeners.forEach((listener) => listener.onStep(node, offset, kind)); |
} |
} |
void apply(js.Node node) { |
notifyStart(node); |
+ |
+ int startPosition = getSyntaxOffset(node, kind: CodePositionKind.START); |
+ Offset startOffset = getOffsetForNode(node, startPosition); |
+ notifyStep(node, startOffset, StepKind.NO_INFO, force: true); |
+ |
node.accept(this); |
notifyEnd(node); |
} |
@@ -829,6 +844,11 @@ class JavaScriptTracer extends js.BaseVisitor { |
statementOffset = getSyntaxOffset(node, kind: CodePositionKind.CLOSING); |
Offset exitOffset = getOffsetForNode(node, statementOffset); |
notifyStep(node, exitOffset, StepKind.FUN_EXIT); |
+ if (active && !activeBefore) { |
+ int endPosition = getSyntaxOffset(node, kind: CodePositionKind.END); |
+ Offset endOffset = getOffsetForNode(node, endPosition); |
+ notifyStep(node, endOffset, StepKind.NO_INFO); |
+ } |
active = activeBefore; |
} |