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

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

Issue 2748103010: Run dartfmt on js_ast (Closed)
Patch Set: Created 3 years, 9 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/js_ast/lib/src/characters.dart ('k') | pkg/js_ast/lib/src/printer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/js_ast/lib/src/nodes.dart
diff --git a/pkg/js_ast/lib/src/nodes.dart b/pkg/js_ast/lib/src/nodes.dart
index 94371a0e688c3ae61dcc7f8bd8fd7b314e02b575..c43a2519687b7d2c7e101952b6bb46498c4db237 100644
--- a/pkg/js_ast/lib/src/nodes.dart
+++ b/pkg/js_ast/lib/src/nodes.dart
@@ -95,8 +95,7 @@ class BaseVisitor<T> implements NodeVisitor<T> {
T visitJump(Statement node) => visitStatement(node);
T visitBlock(Block node) => visitStatement(node);
- T visitExpressionStatement(ExpressionStatement node)
- => visitStatement(node);
+ T visitExpressionStatement(ExpressionStatement node) => visitStatement(node);
T visitEmptyStatement(EmptyStatement node) => visitStatement(node);
T visitIf(If node) => visitStatement(node);
T visitFor(For node) => visitLoop(node);
@@ -109,8 +108,7 @@ class BaseVisitor<T> implements NodeVisitor<T> {
T visitThrow(Throw node) => visitJump(node);
T visitTry(Try node) => visitStatement(node);
T visitSwitch(Switch node) => visitStatement(node);
- T visitFunctionDeclaration(FunctionDeclaration node)
- => visitStatement(node);
+ T visitFunctionDeclaration(FunctionDeclaration node) => visitStatement(node);
T visitLabeledStatement(LabeledStatement node) => visitStatement(node);
T visitLiteralStatement(LiteralStatement node) => visitStatement(node);
@@ -122,8 +120,8 @@ class BaseVisitor<T> implements NodeVisitor<T> {
T visitVariableReference(VariableReference node) => visitExpression(node);
T visitLiteralExpression(LiteralExpression node) => visitExpression(node);
- T visitVariableDeclarationList(VariableDeclarationList node)
- => visitExpression(node);
+ T visitVariableDeclarationList(VariableDeclarationList node) =>
+ visitExpression(node);
T visitAssignment(Assignment node) => visitExpression(node);
T visitVariableInitialization(VariableInitialization node) {
if (node.value != null) {
@@ -132,6 +130,7 @@ class BaseVisitor<T> implements NodeVisitor<T> {
return visitExpression(node);
}
}
+
T visitConditional(Conditional node) => visitExpression(node);
T visitNew(New node) => visitExpression(node);
T visitCall(Call node) => visitExpression(node);
@@ -141,8 +140,8 @@ class BaseVisitor<T> implements NodeVisitor<T> {
T visitAccess(PropertyAccess node) => visitExpression(node);
T visitVariableUse(VariableUse node) => visitVariableReference(node);
- T visitVariableDeclaration(VariableDeclaration node)
- => visitVariableReference(node);
+ T visitVariableDeclaration(VariableDeclaration node) =>
+ visitVariableReference(node);
T visitParameter(Parameter node) => visitVariableDeclaration(node);
T visitThis(This node) => visitParameter(node);
@@ -174,16 +173,16 @@ class BaseVisitor<T> implements NodeVisitor<T> {
T visitInterpolatedNode(InterpolatedNode node) => visitNode(node);
- T visitInterpolatedExpression(InterpolatedExpression node)
- => visitInterpolatedNode(node);
- T visitInterpolatedLiteral(InterpolatedLiteral node)
- => visitInterpolatedNode(node);
- T visitInterpolatedParameter(InterpolatedParameter node)
- => visitInterpolatedNode(node);
- T visitInterpolatedSelector(InterpolatedSelector node)
- => visitInterpolatedNode(node);
- T visitInterpolatedStatement(InterpolatedStatement node)
- => visitInterpolatedNode(node);
+ T visitInterpolatedExpression(InterpolatedExpression node) =>
+ visitInterpolatedNode(node);
+ T visitInterpolatedLiteral(InterpolatedLiteral node) =>
+ visitInterpolatedNode(node);
+ T visitInterpolatedParameter(InterpolatedParameter node) =>
+ visitInterpolatedNode(node);
+ T visitInterpolatedSelector(InterpolatedSelector node) =>
+ visitInterpolatedNode(node);
+ T visitInterpolatedStatement(InterpolatedStatement node) =>
+ visitInterpolatedNode(node);
T visitInterpolatedDeclaration(InterpolatedDeclaration node) {
return visitInterpolatedNode(node);
}
@@ -244,6 +243,7 @@ class Program extends Node {
void visitChildren(NodeVisitor visitor) {
for (Statement statement in body) statement.accept(visitor);
}
+
Program _clone() => new Program(body);
}
@@ -260,6 +260,7 @@ class Block extends Statement {
void visitChildren(NodeVisitor visitor) {
for (Statement statement in statements) statement.accept(visitor);
}
+
Block _clone() => new Block(statements);
}
@@ -270,7 +271,10 @@ class ExpressionStatement extends Statement {
}
accept(NodeVisitor visitor) => visitor.visitExpressionStatement(this);
- void visitChildren(NodeVisitor visitor) { expression.accept(visitor); }
+ void visitChildren(NodeVisitor visitor) {
+ expression.accept(visitor);
+ }
+
ExpressionStatement _clone() => new ExpressionStatement(expression);
}
@@ -290,7 +294,7 @@ class If extends Statement {
If(this.condition, this.then, this.otherwise);
If.noElse(this.condition, this.then) : this.otherwise = new EmptyStatement();
- bool get hasElse => otherwise is !EmptyStatement;
+ bool get hasElse => otherwise is! EmptyStatement;
accept(NodeVisitor visitor) => visitor.visitIf(this);
@@ -377,7 +381,7 @@ class Do extends Loop {
}
class Continue extends Statement {
- final String targetLabel; // Can be null.
+ final String targetLabel; // Can be null.
Continue(this.targetLabel);
@@ -388,7 +392,7 @@ class Continue extends Statement {
}
class Break extends Statement {
- final String targetLabel; // Can be null.
+ final String targetLabel; // Can be null.
Break(this.targetLabel);
@@ -399,7 +403,7 @@ class Break extends Statement {
}
class Return extends Statement {
- final Expression value; // Can be null.
+ final Expression value; // Can be null.
Return([this.value = null]);
@@ -428,8 +432,8 @@ class Throw extends Statement {
class Try extends Statement {
final Block body;
- final Catch catchPart; // Can be null if [finallyPart] is non-null.
- final Block finallyPart; // Can be null if [catchPart] is non-null.
+ final Catch catchPart; // Can be null if [finallyPart] is non-null.
+ final Block finallyPart; // Can be null if [catchPart] is non-null.
Try(this.body, this.catchPart, this.finallyPart) {
assert(catchPart != null || finallyPart != null);
@@ -548,7 +552,7 @@ class LiteralStatement extends Statement {
LiteralStatement(this.code);
accept(NodeVisitor visitor) => visitor.visitLiteralStatement(this);
- void visitChildren(NodeVisitor visitor) { }
+ void visitChildren(NodeVisitor visitor) {}
LiteralStatement _clone() => new LiteralStatement(code);
}
@@ -577,9 +581,7 @@ abstract class Expression extends Node {
Statement toStatement() => new ExpressionStatement(this);
}
-abstract class Declaration implements VariableReference {
-
-}
+abstract class Declaration implements VariableReference {}
/// An implementation of [Name] represents a potentially late bound name in
/// the generated ast.
@@ -660,11 +662,10 @@ class VariableDeclarationList extends Expression {
class Assignment extends Expression {
final Expression leftHandSide;
- final String op; // Null, if the assignment is not compound.
- final Expression value; // May be null, for [VariableInitialization]s.
+ final String op; // Null, if the assignment is not compound.
+ final Expression value; // May be null, for [VariableInitialization]s.
- Assignment(leftHandSide, value)
- : this.compound(leftHandSide, null, value);
+ Assignment(leftHandSide, value) : this.compound(leftHandSide, null, value);
// If `this.op == null` this will be a non-compound assignment.
Assignment.compound(this.leftHandSide, this.op, this.value);
@@ -679,8 +680,7 @@ class Assignment extends Expression {
if (value != null) value.accept(visitor);
}
- Assignment _clone() =>
- new Assignment.compound(leftHandSide, op, value);
+ Assignment _clone() => new Assignment.compound(leftHandSide, op, value);
}
class VariableInitialization extends Assignment {
@@ -721,7 +721,7 @@ class Call extends Expression {
List<Expression> arguments;
Call(this.target, this.arguments,
- {JavaScriptNodeSourceInformation sourceInformation}) {
+ {JavaScriptNodeSourceInformation sourceInformation}) {
this._sourceInformation = sourceInformation;
}
@@ -840,7 +840,6 @@ class Postfix extends Expression {
argument.accept(visitor);
}
-
int get precedenceLevel => UNARY;
}
@@ -902,6 +901,7 @@ class NamedFunction extends Expression {
name.accept(visitor);
function.accept(visitor);
}
+
NamedFunction _clone() => new NamedFunction(name, function);
int get precedenceLevel => LEFT_HAND_SIDE;
@@ -1074,7 +1074,7 @@ class StringConcatenation extends Literal {
}
class LiteralNumber extends Literal {
- final String value; // Must be a valid JavaScript number literal.
+ final String value; // Must be a valid JavaScript number literal.
LiteralNumber(this.value);
@@ -1170,8 +1170,7 @@ class InterpolatedExpression extends Expression with InterpolatedNode {
accept(NodeVisitor visitor) => visitor.visitInterpolatedExpression(this);
void visitChildren(NodeVisitor visitor) {}
- InterpolatedExpression _clone() =>
- new InterpolatedExpression(nameOrPosition);
+ InterpolatedExpression _clone() => new InterpolatedExpression(nameOrPosition);
int get precedenceLevel => PRIMARY;
}
@@ -1186,11 +1185,15 @@ class InterpolatedLiteral extends Literal with InterpolatedNode {
InterpolatedLiteral _clone() => new InterpolatedLiteral(nameOrPosition);
}
-class InterpolatedParameter extends Expression with InterpolatedNode
+class InterpolatedParameter extends Expression
+ with InterpolatedNode
implements Parameter {
final nameOrPosition;
- String get name { throw "InterpolatedParameter.name must not be invoked"; }
+ String get name {
+ throw "InterpolatedParameter.name must not be invoked";
+ }
+
bool get allowRename => false;
InterpolatedParameter(this.nameOrPosition);
@@ -1225,8 +1228,8 @@ class InterpolatedStatement extends Statement with InterpolatedNode {
}
class InterpolatedDeclaration extends Expression
- with InterpolatedNode
- implements Declaration {
+ with InterpolatedNode
+ implements Declaration {
final nameOrPosition;
InterpolatedDeclaration(this.nameOrPosition);
« no previous file with comments | « pkg/js_ast/lib/src/characters.dart ('k') | pkg/js_ast/lib/src/printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698