| Index: sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart b/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart
|
| index b5b49d9489204debac99bdde253942b022fd10a1..9fe793057d88db1293663b76917d8cb03b9982a9 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart
|
| @@ -950,6 +950,35 @@ class IrBuilder extends ResolvedVisitor<ir.Primitive> {
|
| }
|
| }
|
|
|
| + ir.Primitive buildNegation(ir.Primitive condition) {
|
| + // ! e is translated as e ? false : true
|
| +
|
| + // Add a continuation parameter for the result of the expression.
|
| + ir.Parameter resultParameter = new ir.Parameter(null);
|
| +
|
| + ir.Continuation joinContinuation = new ir.Continuation([resultParameter]);
|
| + ir.Continuation thenContinuation = new ir.Continuation([]);
|
| + ir.Continuation elseContinuation = new ir.Continuation([]);
|
| +
|
| + ir.Constant trueConstant =
|
| + new ir.Constant(constantSystem.createBool(true));
|
| + ir.Constant falseConstant =
|
| + new ir.Constant(constantSystem.createBool(false));
|
| +
|
| + thenContinuation.body = new ir.LetPrim(falseConstant)
|
| + ..plug(new ir.InvokeContinuation(joinContinuation, [falseConstant]));
|
| + elseContinuation.body = new ir.LetPrim(trueConstant)
|
| + ..plug(new ir.InvokeContinuation(joinContinuation, [trueConstant]));
|
| +
|
| + add(new ir.LetCont(joinContinuation,
|
| + new ir.LetCont(thenContinuation,
|
| + new ir.LetCont(elseContinuation,
|
| + new ir.Branch(new ir.IsTrue(condition),
|
| + thenContinuation,
|
| + elseContinuation)))));
|
| + return resultParameter;
|
| + }
|
| +
|
| ir.Primitive translateLogicalOperator(ast.Operator op,
|
| ast.Expression left,
|
| ast.Expression right) {
|
| @@ -1051,6 +1080,17 @@ class IrBuilder extends ResolvedVisitor<ir.Primitive> {
|
| assert(node.arguments.tail.isEmpty);
|
| return translateLogicalOperator(op, node.receiver, node.arguments.head);
|
| }
|
| + if (op.source == "!") {
|
| + assert(node.receiver != null);
|
| + assert(node.arguments.isEmpty);
|
| + return buildNegation(visit(node.receiver));
|
| + }
|
| + if (op.source == "!=") {
|
| + assert(node.receiver != null);
|
| + assert(!node.arguments.isEmpty);
|
| + assert(node.arguments.tail.isEmpty);
|
| + return buildNegation(visitDynamicSend(node));
|
| + }
|
| return giveup();
|
| }
|
|
|
|
|