Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: pkg/compiler/lib/src/io/position_information.dart

Issue 2654023003: Add no-info mappings at start of out.js and after mapped functions (Closed)
Patch Set: fixes Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/io/source_information.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/io/source_information.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698