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

Unified Diff: pkg/js_ast/lib/src/printer.dart

Issue 1196433002: Create and test source mapping for invocations. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Update comments. Created 5 years, 6 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/js_ast/lib/src/printer.dart
diff --git a/pkg/js_ast/lib/src/printer.dart b/pkg/js_ast/lib/src/printer.dart
index c2deb1eefc2d591c29d19d193ba37b8e1c87e7f8..dfdc594619ac6376984d37b2845bd87bea917a9e 100644
--- a/pkg/js_ast/lib/src/printer.dart
+++ b/pkg/js_ast/lib/src/printer.dart
@@ -360,7 +360,9 @@ class Printer implements NodeVisitor {
out("else");
if (elsePart is If) {
pendingSpace = true;
+ startNode(elsePart);
ifOut(elsePart, false);
+ endNode(elsePart);
} else {
blockBody(unwrapBlockIfSingleStatement(elsePart),
needsSeparation: true, needsNewline: true);
@@ -628,7 +630,10 @@ class Printer implements NodeVisitor {
VarCollector vars = new VarCollector();
vars.visitFunctionDeclaration(declaration);
indent();
- functionOut(declaration.function, declaration.name, vars);
+ startNode(declaration.function);
+ currentNode.closingPosition =
+ functionOut(declaration.function, declaration.name, vars);
+ endNode(declaration.function);
lineOut();
}
@@ -924,7 +929,9 @@ class Printer implements NodeVisitor {
if (isValidJavaScriptId(fieldWithQuotes)) {
if (access.receiver is LiteralNumber) out(" ", isWhitespace: true);
out(".");
+ startNode(selector);
out(fieldWithQuotes.substring(1, fieldWithQuotes.length - 1));
+ endNode(selector);
return;
}
}
@@ -1012,7 +1019,9 @@ class Printer implements NodeVisitor {
// in last position. Otherwise `[,]` (having length 1) would become
// equal to `[]` (the empty array)
// and [1,,] (array with 1 and a hole) would become [1,] = [1].
+ startNode(element);
out(",");
+ endNode(element);
continue;
}
if (i != 0) spaceOut();
@@ -1059,6 +1068,7 @@ class Printer implements NodeVisitor {
@override
void visitProperty(Property node) {
+ startNode(node.name);
if (node.name is LiteralString) {
LiteralString nameString = node.name;
String name = nameString.value;
@@ -1072,6 +1082,7 @@ class Printer implements NodeVisitor {
LiteralNumber nameNumber = node.name;
out(nameNumber.value);
}
+ endNode(node.name);
out(":");
spaceOut();
visitNestedExpression(node.value, ASSIGNMENT,

Powered by Google App Engine
This is Rietveld 408576698