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

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: Rebased 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
« no previous file with comments | « pkg/compiler/lib/src/util/indentation.dart ('k') | pkg/js_ast/test/printer_callback_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ff757b4cbd90d87ec1863be0751e3c695f2e6ad4..e5e050bf9a2a60bc030cd4b842fdf97ed74e236d 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,13 +929,17 @@ 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;
}
} else if (selector is Name) {
if (access.receiver is LiteralNumber) out(" ", isWhitespace: true);
out(".");
+ startNode(selector);
out(selector.name);
+ endNode(selector);
return;
}
out("[");
@@ -1022,7 +1031,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();
@@ -1069,6 +1080,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;
@@ -1084,6 +1096,7 @@ class Printer implements NodeVisitor {
LiteralNumber nameNumber = node.name;
out(nameNumber.value);
}
+ endNode(node.name);
out(":");
spaceOut();
visitNestedExpression(node.value, ASSIGNMENT,
« no previous file with comments | « pkg/compiler/lib/src/util/indentation.dart ('k') | pkg/js_ast/test/printer_callback_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698