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

Unified Diff: pkg/analyzer/lib/src/dart/ast/ast.dart

Issue 1925173002: Add a (public) utility method to clean-up code (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/analyzer/lib/dart/ast/ast.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/ast/ast.dart
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 2825ef56b73733f1ccd3369cfdee168878951e51..08f5056a1b0188b5ae27a270251748c533bc9a49 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -4063,6 +4063,9 @@ abstract class ExpressionImpl extends AstNodeImpl implements Expression {
}
return null;
}
+
+ @override
+ Expression get unParenthesized => this;
}
/**
@@ -7915,6 +7918,17 @@ class ParenthesizedExpressionImpl extends ExpressionImpl
int get precedence => 15;
@override
+ Expression get unParenthesized {
+ // This is somewhat inefficient, but it avoids a stack overflow in the
+ // degenerate case.
+ Expression expression = _expression;
+ while (expression is ParenthesizedExpressionImpl) {
+ expression = (expression as ParenthesizedExpressionImpl)._expression;
+ }
+ return expression;
+ }
+
+ @override
dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
visitor.visitParenthesizedExpression(this);
« no previous file with comments | « pkg/analyzer/lib/dart/ast/ast.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698