| Index: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
|
| diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
|
| index adeed902955e427251375a1042b784ffdbcd28e9..7a11f83cb85b306493862583a39f61568211dcc6 100644
|
| --- a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
|
| +++ b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
|
| @@ -150,9 +150,8 @@ class Assign extends Expression {
|
| accept(ExpressionVisitor v) => v.visitAssign(this);
|
| accept1(ExpressionVisitor1 v, arg) => v.visitAssign(this, arg);
|
|
|
| - static ExpressionStatement makeStatement(Variable variable,
|
| - Expression value,
|
| - [Statement next]) {
|
| + static ExpressionStatement makeStatement(Variable variable, Expression value,
|
| + [Statement next]) {
|
| return new ExpressionStatement(new Assign(variable, value), next);
|
| }
|
| }
|
| @@ -176,7 +175,7 @@ class InvokeStatic extends Expression implements Invoke {
|
| final SourceInformation sourceInformation;
|
|
|
| InvokeStatic(this.target, this.selector, this.arguments,
|
| - [this.sourceInformation]);
|
| + [this.sourceInformation]);
|
|
|
| accept(ExpressionVisitor visitor) => visitor.visitInvokeStatic(this);
|
| accept1(ExpressionVisitor1 visitor, arg) {
|
| @@ -200,11 +199,8 @@ class InvokeMethod extends Expression implements Invoke {
|
| /// If true, it is known that the receiver cannot be `null`.
|
| bool receiverIsNotNull = false;
|
|
|
| - InvokeMethod(this.receiver,
|
| - this.selector,
|
| - this.mask,
|
| - this.arguments,
|
| - this.sourceInformation) {
|
| + InvokeMethod(this.receiver, this.selector, this.mask, this.arguments,
|
| + this.sourceInformation) {
|
| assert(receiver != null);
|
| }
|
|
|
| @@ -245,12 +241,14 @@ class InvokeConstructor extends Expression implements Invoke {
|
| final List<Expression> arguments;
|
| final Selector selector;
|
| final SourceInformation sourceInformation;
|
| +
|
| /// TODO(karlklose): get rid of this field. Instead use the constant's
|
| /// expression to find the constructor to be called in dart2dart.
|
| final values.ConstantValue constant;
|
|
|
| InvokeConstructor(this.type, this.target, this.selector, this.arguments,
|
| - this.sourceInformation, [this.constant]);
|
| + this.sourceInformation,
|
| + [this.constant]);
|
|
|
| ClassElement get targetClass => target.enclosingElement;
|
|
|
| @@ -272,10 +270,8 @@ class OneShotInterceptor extends Expression implements Invoke {
|
| final List<Expression> arguments;
|
| final SourceInformation sourceInformation;
|
|
|
| - OneShotInterceptor(this.selector,
|
| - this.mask,
|
| - this.arguments,
|
| - this.sourceInformation);
|
| + OneShotInterceptor(
|
| + this.selector, this.mask, this.arguments, this.sourceInformation);
|
|
|
| accept(ExpressionVisitor visitor) => visitor.visitOneShotInterceptor(this);
|
| accept1(ExpressionVisitor1 visitor, arg) {
|
| @@ -330,7 +326,7 @@ class TypeOperator extends Expression {
|
| final bool isTypeTest;
|
|
|
| TypeOperator(this.value, this.type, this.typeArguments,
|
| - {bool this.isTypeTest});
|
| + {bool this.isTypeTest});
|
|
|
| accept(ExpressionVisitor visitor) => visitor.visitTypeOperator(this);
|
| accept1(ExpressionVisitor1 visitor, arg) {
|
| @@ -356,6 +352,7 @@ class ApplyBuiltinOperator extends Expression {
|
| accept(ExpressionVisitor visitor) {
|
| return visitor.visitApplyBuiltinOperator(this);
|
| }
|
| +
|
| accept1(ExpressionVisitor1 visitor, arg) {
|
| return visitor.visitApplyBuiltinOperator(this, arg);
|
| }
|
| @@ -368,14 +365,13 @@ class ApplyBuiltinMethod extends Expression {
|
|
|
| bool receiverIsNotNull;
|
|
|
| - ApplyBuiltinMethod(this.method,
|
| - this.receiver,
|
| - this.arguments,
|
| - {this.receiverIsNotNull: false});
|
| + ApplyBuiltinMethod(this.method, this.receiver, this.arguments,
|
| + {this.receiverIsNotNull: false});
|
|
|
| accept(ExpressionVisitor visitor) {
|
| return visitor.visitApplyBuiltinMethod(this);
|
| }
|
| +
|
| accept1(ExpressionVisitor1 visitor, arg) {
|
| return visitor.visitApplyBuiltinMethod(this, arg);
|
| }
|
| @@ -395,7 +391,7 @@ class Conditional extends Expression {
|
| }
|
|
|
| String toString() => 'Conditional(condition=$condition,thenExpression='
|
| - '$thenExpression,elseExpression=$elseExpression)';
|
| + '$thenExpression,elseExpression=$elseExpression)';
|
| }
|
|
|
| /// An && or || expression. The operator is internally represented as a boolean
|
| @@ -460,8 +456,7 @@ class LabeledStatement extends JumpTarget {
|
| }
|
|
|
| /// A [WhileTrue] or [For] loop.
|
| -abstract class Loop extends JumpTarget {
|
| -}
|
| +abstract class Loop extends JumpTarget {}
|
|
|
| /**
|
| * A labeled while(true) loop.
|
| @@ -501,11 +496,7 @@ class For extends Loop {
|
| Statement body;
|
| Statement next;
|
|
|
| - For(this.label,
|
| - this.condition,
|
| - this.updates,
|
| - this.body,
|
| - this.next) {
|
| + For(this.label, this.condition, this.updates, this.body, this.next) {
|
| assert(label.binding == null);
|
| label.binding = this;
|
| }
|
| @@ -608,10 +599,8 @@ class If extends Statement {
|
| Statement get next => null;
|
| void set next(Statement s) => throw 'UNREACHABLE';
|
|
|
| - If(this.condition,
|
| - this.thenStatement,
|
| - this.elseStatement,
|
| - this.sourceInformation);
|
| + If(this.condition, this.thenStatement, this.elseStatement,
|
| + this.sourceInformation);
|
|
|
| accept(StatementVisitor visitor) => visitor.visitIf(this);
|
| accept1(StatementVisitor1 visitor, arg) => visitor.visitIf(this, arg);
|
| @@ -667,10 +656,7 @@ class FunctionDefinition extends Node {
|
| Statement body;
|
|
|
| /// Creates a function definition and updates `writeCount` for [parameters].
|
| - FunctionDefinition(
|
| - this.element,
|
| - this.parameters,
|
| - this.body,
|
| + FunctionDefinition(this.element, this.parameters, this.body,
|
| {this.sourceInformation}) {
|
| for (Variable param in parameters) {
|
| param.writeCount++; // Being a parameter counts as a write.
|
| @@ -689,8 +675,8 @@ class CreateInstance extends Expression {
|
| Expression typeInformation;
|
| SourceInformation sourceInformation;
|
|
|
| - CreateInstance(this.classElement, this.arguments,
|
| - this.typeInformation, this.sourceInformation);
|
| + CreateInstance(this.classElement, this.arguments, this.typeInformation,
|
| + this.sourceInformation);
|
|
|
| accept(ExpressionVisitor visitor) => visitor.visitCreateInstance(this);
|
| accept1(ExpressionVisitor1 visitor, arg) {
|
| @@ -704,10 +690,7 @@ class GetField extends Expression {
|
| bool objectIsNotNull;
|
| SourceInformation sourceInformation;
|
|
|
| - GetField(
|
| - this.object,
|
| - this.field,
|
| - this.sourceInformation,
|
| + GetField(this.object, this.field, this.sourceInformation,
|
| {this.objectIsNotNull: false});
|
|
|
| accept(ExpressionVisitor visitor) => visitor.visitGetField(this);
|
| @@ -724,18 +707,13 @@ class SetField extends Expression {
|
| /// operator. The operator must be a compoundable operator.
|
| BuiltinOperator compound;
|
|
|
| - SetField(
|
| - this.object,
|
| - this.field,
|
| - this.value,
|
| - this.sourceInformation,
|
| + SetField(this.object, this.field, this.value, this.sourceInformation,
|
| {this.compound});
|
|
|
| accept(ExpressionVisitor visitor) => visitor.visitSetField(this);
|
| accept1(ExpressionVisitor1 visitor, arg) => visitor.visitSetField(this, arg);
|
| }
|
|
|
| -
|
| /// Read the type test property from [object]. The value is truthy/fasly rather
|
| /// than bool. [object] must not be `null`.
|
| class GetTypeTestProperty extends Expression {
|
| @@ -744,8 +722,7 @@ class GetTypeTestProperty extends Expression {
|
|
|
| GetTypeTestProperty(this.object, this.dartType);
|
|
|
| - accept(ExpressionVisitor visitor) =>
|
| - visitor.visitGetTypeTestProperty(this);
|
| + accept(ExpressionVisitor visitor) => visitor.visitGetTypeTestProperty(this);
|
| accept1(ExpressionVisitor1 visitor, arg) =>
|
| visitor.visitGetTypeTestProperty(this, arg);
|
| }
|
| @@ -875,31 +852,27 @@ class ForeignCode extends Node {
|
| final types.TypeMask type;
|
| final List<Expression> arguments;
|
| final native.NativeBehavior nativeBehavior;
|
| - final List<bool> nullableArguments; // One 'bit' per argument.
|
| + final List<bool> nullableArguments; // One 'bit' per argument.
|
| final Element dependency;
|
| final SourceInformation sourceInformation;
|
|
|
| - ForeignCode(
|
| - this.codeTemplate,
|
| - this.type,
|
| - this.arguments,
|
| - this.nativeBehavior,
|
| - this.nullableArguments,
|
| - this.dependency,
|
| - this.sourceInformation) {
|
| + ForeignCode(this.codeTemplate, this.type, this.arguments, this.nativeBehavior,
|
| + this.nullableArguments, this.dependency, this.sourceInformation) {
|
| assert(arguments.length == nullableArguments.length);
|
| }
|
| }
|
|
|
| class ForeignExpression extends ForeignCode implements Expression {
|
| ForeignExpression(
|
| - js.Template codeTemplate, types.TypeMask type,
|
| - List<Expression> arguments, native.NativeBehavior nativeBehavior,
|
| + js.Template codeTemplate,
|
| + types.TypeMask type,
|
| + List<Expression> arguments,
|
| + native.NativeBehavior nativeBehavior,
|
| List<bool> nullableArguments,
|
| Element dependency,
|
| SourceInformation sourceInformation)
|
| : super(codeTemplate, type, arguments, nativeBehavior, nullableArguments,
|
| - dependency, sourceInformation);
|
| + dependency, sourceInformation);
|
|
|
| accept(ExpressionVisitor visitor) {
|
| return visitor.visitForeignExpression(this);
|
| @@ -912,13 +885,15 @@ class ForeignExpression extends ForeignCode implements Expression {
|
|
|
| class ForeignStatement extends ForeignCode implements Statement {
|
| ForeignStatement(
|
| - js.Template codeTemplate, types.TypeMask type,
|
| - List<Expression> arguments, native.NativeBehavior nativeBehavior,
|
| + js.Template codeTemplate,
|
| + types.TypeMask type,
|
| + List<Expression> arguments,
|
| + native.NativeBehavior nativeBehavior,
|
| List<bool> nullableArguments,
|
| Element dependency,
|
| SourceInformation sourceInformation)
|
| : super(codeTemplate, type, arguments, nativeBehavior, nullableArguments,
|
| - dependency, sourceInformation);
|
| + dependency, sourceInformation);
|
|
|
| accept(StatementVisitor visitor) {
|
| return visitor.visitForeignStatement(this);
|
| @@ -993,8 +968,14 @@ class ReceiverCheck extends Statement {
|
| Statement next;
|
| SourceInformation sourceInformation;
|
|
|
| - ReceiverCheck({this.condition, this.value, this.selector, this.useSelector,
|
| - this.useInvoke, this.next, this.sourceInformation});
|
| + ReceiverCheck(
|
| + {this.condition,
|
| + this.value,
|
| + this.selector,
|
| + this.useSelector,
|
| + this.useInvoke,
|
| + this.next,
|
| + this.sourceInformation});
|
|
|
| accept(StatementVisitor visitor) {
|
| return visitor.visitReceiverCheck(this);
|
| @@ -1239,8 +1220,7 @@ abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor {
|
| visitExpression(node.value);
|
| }
|
|
|
| - visitGetStatic(GetStatic node) {
|
| - }
|
| + visitGetStatic(GetStatic node) {}
|
|
|
| visitSetStatic(SetStatic node) {
|
| visitExpression(node.value);
|
| @@ -1250,8 +1230,7 @@ abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor {
|
| visitExpression(node.object);
|
| }
|
|
|
| - visitCreateBox(CreateBox node) {
|
| - }
|
| + visitCreateBox(CreateBox node) {}
|
|
|
| visitCreateInstance(CreateInstance node) {
|
| node.arguments.forEach(visitExpression);
|
| @@ -1274,8 +1253,7 @@ abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor {
|
| node.arguments.forEach(visitExpression);
|
| }
|
|
|
| - visitUnreachable(Unreachable node) {
|
| - }
|
| + visitUnreachable(Unreachable node) {}
|
|
|
| visitApplyBuiltinOperator(ApplyBuiltinOperator node) {
|
| node.arguments.forEach(visitExpression);
|
| @@ -1328,10 +1306,10 @@ abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor {
|
| }
|
| }
|
|
|
| -abstract class Transformer implements ExpressionVisitor<Expression>,
|
| - StatementVisitor<Statement> {
|
| - Expression visitExpression(Expression e) => e.accept(this);
|
| - Statement visitStatement(Statement s) => s.accept(this);
|
| +abstract class Transformer
|
| + implements ExpressionVisitor<Expression>, StatementVisitor<Statement> {
|
| + Expression visitExpression(Expression e) => e.accept(this);
|
| + Statement visitStatement(Statement s) => s.accept(this);
|
| }
|
|
|
| class RecursiveTransformer extends Transformer {
|
| @@ -1600,8 +1578,9 @@ class FallthroughTarget {
|
|
|
| /// A stack machine for tracking fallthrough while traversing the Tree IR.
|
| class FallthroughStack {
|
| - final List<FallthroughTarget> _stack =
|
| - <FallthroughTarget>[new FallthroughTarget(null)];
|
| + final List<FallthroughTarget> _stack = <FallthroughTarget>[
|
| + new FallthroughTarget(null)
|
| + ];
|
|
|
| /// Set a new fallthrough target.
|
| void push(Statement newFallthrough) {
|
|
|