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

Unified Diff: pkg/kernel/lib/text/ast_to_text.dart

Issue 2610133002: Non-format-changing kernel offset changes (Closed)
Patch Set: Changed offset variable introduced in various methods in accessors.dart to a named parameter with d… 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 | « pkg/kernel/lib/kernel.dart ('k') | pkg/kernel/lib/transformations/async.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/text/ast_to_text.dart
diff --git a/pkg/kernel/lib/text/ast_to_text.dart b/pkg/kernel/lib/text/ast_to_text.dart
index 18be9de8860b332563538e31d135145a2867ce16..4991490f3f2888a82cf4e1cc4cce639b667e0dc2 100644
--- a/pkg/kernel/lib/text/ast_to_text.dart
+++ b/pkg/kernel/lib/text/ast_to_text.dart
@@ -181,6 +181,7 @@ class Printer extends Visitor<Null> {
int indentation = 0;
int column = 0;
bool showExternal;
+ bool showOffsets;
static int SPACE = 0;
static int WORD = 1;
@@ -190,6 +191,7 @@ class Printer extends Visitor<Null> {
Printer(this.sink,
{NameSystem syntheticNames,
this.showExternal,
+ this.showOffsets,
this.importTable,
this.annotator: const InferredValueAnnotator()})
: this.syntheticNames = syntheticNames ?? new NameSystem();
@@ -198,7 +200,8 @@ class Printer extends Visitor<Null> {
: sink = parent.sink,
syntheticNames = parent.syntheticNames,
annotator = parent.annotator,
- showExternal = parent.showExternal;
+ showExternal = parent.showExternal,
+ showOffsets = parent.showOffsets;
String getLibraryName(Library node) {
return node.name ?? syntheticNames.nameLibrary(node);
@@ -393,6 +396,9 @@ class Printer extends Visitor<Null> {
}
void writeNode(Node node) {
+ if (showOffsets && node is TreeNode) {
+ writeWord("[${node.fileOffset}]");
+ }
node.accept(this);
}
@@ -486,6 +492,7 @@ class Printer extends Visitor<Null> {
if (function.asyncMarker != AsyncMarker.Sync) {
writeSpaced(getAsyncMarkerKeyword(function.asyncMarker));
}
+ if (!function.debuggable) writeSpaced("/* not debuggable */");
if (function.body != null) {
writeFunctionBody(function.body, terminateLine: terminateLine);
} else if (terminateLine) {
@@ -626,6 +633,7 @@ class Printer extends Visitor<Null> {
}
void writeExpression(Expression node, [int minimumPrecedence]) {
+ if (showOffsets) writeWord("[${node.fileOffset}]");
bool needsParenteses = false;
if (minimumPrecedence != null && getPrecedence(node) < minimumPrecedence) {
needsParenteses = true;
@@ -1287,6 +1295,7 @@ class Printer extends Visitor<Null> {
void writeVariableDeclaration(VariableDeclaration node,
{bool useVarKeyword: false}) {
+ if (showOffsets) writeWord("[${node.fileOffset}]");
writeModifier(node.isFinal, 'final');
writeModifier(node.isConst, 'const');
if (node.type != null) {
« no previous file with comments | « pkg/kernel/lib/kernel.dart ('k') | pkg/kernel/lib/transformations/async.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698