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

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

Issue 2682813005: Add NoSourceLocationMarker in old source-info engine. (Closed)
Patch Set: Cleanup. Created 3 years, 10 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
Index: pkg/compiler/lib/src/io/start_end_information.dart
diff --git a/pkg/compiler/lib/src/io/start_end_information.dart b/pkg/compiler/lib/src/io/start_end_information.dart
index f7d4dce1369fc7e34041cc999e43ae1d866742e3..71a3aec938bfb458bc3b69a14b6d9375f79f6cf2 100644
--- a/pkg/compiler/lib/src/io/start_end_information.dart
+++ b/pkg/compiler/lib/src/io/start_end_information.dart
@@ -129,8 +129,27 @@ class StartEndSourceInformationProcessor extends SourceInformationProcessor {
/// registered for the top-most node with source information.
bool hasRegisteredRoot = false;
+ /// The root of the tree. Used to add a [NoSourceLocationMarker] to the start
+ /// of the output.
+ js.Node root;
+
+ /// The root of the current subtree with source information. Used to add
+ /// [NoSourceLocationMarker] after areas with source information.
+ js.Node subRoot;
+
StartEndSourceInformationProcessor(this.sourceMapper);
+ void onStartPosition(js.Node node, int startPosition) {
+ if (root == null) {
+ root = node;
+ sourceMapper.register(
+ node, startPosition, const NoSourceLocationMarker());
+ }
+ if (subRoot == null && node.sourceInformation != null) {
+ subRoot = node;
+ }
+ }
+
@override
void onPositions(
js.Node node, int startPosition, int endPosition, int closingPosition) {
@@ -145,6 +164,11 @@ class StartEndSourceInformationProcessor extends SourceInformationProcessor {
sourceMapper.register(node, endPosition, null);
hasRegisteredRoot = true;
}
+ if (node == subRoot) {
+ sourceMapper.register(
+ node, endPosition, const NoSourceLocationMarker());
+ subRoot = null;
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698