Index: pkg/compiler/lib/src/js/js.dart |
diff --git a/pkg/compiler/lib/src/js/js.dart b/pkg/compiler/lib/src/js/js.dart |
index ec8766a836457af3dfe0b7432ac499c3292616d6..062f3397d88648293895c2c27dc501cdb409c8cd 100644 |
--- a/pkg/compiler/lib/src/js/js.dart |
+++ b/pkg/compiler/lib/src/js/js.dart |
@@ -33,6 +33,7 @@ class Dart2JSJavaScriptPrintingContext implements JavaScriptPrintingContext { |
final leg.Compiler compiler; |
final DumpInfoTask monitor; |
final CodeBuffer outBuffer = new CodeBuffer(); |
+ Node rootNode; |
Dart2JSJavaScriptPrintingContext(leg.Compiler this.compiler, |
DumpInfoTask this.monitor); |
@@ -45,19 +46,31 @@ class Dart2JSJavaScriptPrintingContext implements JavaScriptPrintingContext { |
outBuffer.add(string); |
} |
- void enterNode(Node node) { |
+ void enterNode(Node node, int start) { |
SourceInformation sourceInformation = node.sourceInformation; |
if (sourceInformation != null) { |
- sourceInformation.beginMapping(outBuffer); |
+ if (rootNode == null) { |
+ rootNode = node; |
+ } |
+ if (sourceInformation.startPosition != null) { |
+ outBuffer.addSourceLocation(start, sourceInformation.startPosition); |
+ } |
} |
- if (monitor != null) monitor.enteringAst(node, outBuffer.length); |
} |
- void exitNode(Node node) { |
- if (monitor != null) monitor.exitingAst(node, outBuffer.length); |
+ void exitNode(Node node, int start, int end, int delimiter) { |
SourceInformation sourceInformation = node.sourceInformation; |
if (sourceInformation != null) { |
- sourceInformation.endMapping(outBuffer); |
+ if (sourceInformation.endPosition != null) { |
+ outBuffer.addSourceLocation(end, sourceInformation.endPosition); |
+ } |
+ if (rootNode == node) { |
+ outBuffer.addSourceLocation(end, null); |
+ rootNode = null; |
+ } |
+ } |
+ if (monitor != null) { |
+ monitor.recordAstSize(node, end - start); |
} |
} |
} |