| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library tree_ir_builder; | 5 library tree_ir_builder; |
| 6 | 6 |
| 7 import '../diagnostics/invariant.dart' show | 7 import '../diagnostics/invariant.dart' show |
| 8 InternalErrorFunction; | 8 InternalErrorFunction; |
| 9 import '../diagnostics/spannable.dart' show | 9 import '../diagnostics/spannable.dart' show |
| 10 CURRENT_ELEMENT_SPANNABLE; | 10 CURRENT_ELEMENT_SPANNABLE; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 List<Expression> arguments = translateArguments(node.arguments); | 385 List<Expression> arguments = translateArguments(node.arguments); |
| 386 Expression invoke = new InvokeMethodDirectly(receiver, node.target, | 386 Expression invoke = new InvokeMethodDirectly(receiver, node.target, |
| 387 node.selector, arguments, node.sourceInformation); | 387 node.selector, arguments, node.sourceInformation); |
| 388 return makeCallExpression(node, invoke); | 388 return makeCallExpression(node, invoke); |
| 389 } | 389 } |
| 390 | 390 |
| 391 NodeCallback visitTypeCast(cps_ir.TypeCast node) { | 391 NodeCallback visitTypeCast(cps_ir.TypeCast node) { |
| 392 Expression value = getVariableUse(node.value); | 392 Expression value = getVariableUse(node.value); |
| 393 List<Expression> typeArgs = translateArguments(node.typeArguments); | 393 List<Expression> typeArgs = translateArguments(node.typeArguments); |
| 394 Expression expression = | 394 Expression expression = |
| 395 new TypeOperator(value, node.type, typeArgs, isTypeTest: false); | 395 new TypeOperator(value, node.dartType, typeArgs, isTypeTest: false); |
| 396 return makeCallExpression(node, expression); | 396 return makeCallExpression(node, expression); |
| 397 } | 397 } |
| 398 | 398 |
| 399 NodeCallback visitInvokeConstructor(cps_ir.InvokeConstructor node) { | 399 NodeCallback visitInvokeConstructor(cps_ir.InvokeConstructor node) { |
| 400 List<Expression> arguments = translateArguments(node.arguments); | 400 List<Expression> arguments = translateArguments(node.arguments); |
| 401 Expression invoke = new InvokeConstructor( | 401 Expression invoke = new InvokeConstructor( |
| 402 node.type, | 402 node.dartType, |
| 403 node.target, | 403 node.target, |
| 404 node.selector, | 404 node.selector, |
| 405 arguments, | 405 arguments, |
| 406 node.sourceInformation); | 406 node.sourceInformation); |
| 407 return makeCallExpression(node, invoke); | 407 return makeCallExpression(node, invoke); |
| 408 } | 408 } |
| 409 | 409 |
| 410 NodeCallback visitForeignCode(cps_ir.ForeignCode node) { | 410 NodeCallback visitForeignCode(cps_ir.ForeignCode node) { |
| 411 if (node.codeTemplate.isExpression) { | 411 if (node.codeTemplate.isExpression) { |
| 412 Expression foreignCode = new ForeignExpression( | 412 Expression foreignCode = new ForeignExpression( |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 Expression value = getVariableUse(node.value); | 573 Expression value = getVariableUse(node.value); |
| 574 return new Assign(variable, value); | 574 return new Assign(variable, value); |
| 575 } | 575 } |
| 576 | 576 |
| 577 Expression visitConstant(cps_ir.Constant node) { | 577 Expression visitConstant(cps_ir.Constant node) { |
| 578 return new Constant(node.value, sourceInformation: node.sourceInformation); | 578 return new Constant(node.value, sourceInformation: node.sourceInformation); |
| 579 } | 579 } |
| 580 | 580 |
| 581 Expression visitLiteralList(cps_ir.LiteralList node) { | 581 Expression visitLiteralList(cps_ir.LiteralList node) { |
| 582 return new LiteralList( | 582 return new LiteralList( |
| 583 node.type, | 583 node.dartType, |
| 584 translateArguments(node.values)); | 584 translateArguments(node.values)); |
| 585 } | 585 } |
| 586 | 586 |
| 587 Expression visitLiteralMap(cps_ir.LiteralMap node) { | 587 Expression visitLiteralMap(cps_ir.LiteralMap node) { |
| 588 return new LiteralMap( | 588 return new LiteralMap( |
| 589 node.type, | 589 node.dartType, |
| 590 new List<LiteralMapEntry>.generate(node.entries.length, (int index) { | 590 new List<LiteralMapEntry>.generate(node.entries.length, (int index) { |
| 591 return new LiteralMapEntry( | 591 return new LiteralMapEntry( |
| 592 getVariableUse(node.entries[index].key), | 592 getVariableUse(node.entries[index].key), |
| 593 getVariableUse(node.entries[index].value)); | 593 getVariableUse(node.entries[index].value)); |
| 594 }) | 594 }) |
| 595 ); | 595 ); |
| 596 } | 596 } |
| 597 | 597 |
| 598 FunctionDefinition makeSubFunction(cps_ir.FunctionDefinition function) { | 598 FunctionDefinition makeSubFunction(cps_ir.FunctionDefinition function) { |
| 599 return createInnerBuilder().buildFunction(function); | 599 return createInnerBuilder().buildFunction(function); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 618 | 618 |
| 619 Expression visitTypeExpression(cps_ir.TypeExpression node) { | 619 Expression visitTypeExpression(cps_ir.TypeExpression node) { |
| 620 return new TypeExpression( | 620 return new TypeExpression( |
| 621 node.dartType, | 621 node.dartType, |
| 622 node.arguments.map(getVariableUse).toList()); | 622 node.arguments.map(getVariableUse).toList()); |
| 623 } | 623 } |
| 624 | 624 |
| 625 Expression visitTypeTest(cps_ir.TypeTest node) { | 625 Expression visitTypeTest(cps_ir.TypeTest node) { |
| 626 Expression value = getVariableUse(node.value); | 626 Expression value = getVariableUse(node.value); |
| 627 List<Expression> typeArgs = translateArguments(node.typeArguments); | 627 List<Expression> typeArgs = translateArguments(node.typeArguments); |
| 628 return new TypeOperator(value, node.type, typeArgs, isTypeTest: true); | 628 return new TypeOperator(value, node.dartType, typeArgs, isTypeTest: true); |
| 629 } | 629 } |
| 630 | 630 |
| 631 Expression visitGetStatic(cps_ir.GetStatic node) { | 631 Expression visitGetStatic(cps_ir.GetStatic node) { |
| 632 return new GetStatic(node.element, node.sourceInformation); | 632 return new GetStatic(node.element, node.sourceInformation); |
| 633 } | 633 } |
| 634 | 634 |
| 635 Expression visitSetStatic(cps_ir.SetStatic node) { | 635 Expression visitSetStatic(cps_ir.SetStatic node) { |
| 636 return new SetStatic( | 636 return new SetStatic( |
| 637 node.element, | 637 node.element, |
| 638 getVariableUse(node.value), | 638 getVariableUse(node.value), |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 } | 687 } |
| 688 | 688 |
| 689 visitFunctionDefinition(cps_ir.FunctionDefinition node) { | 689 visitFunctionDefinition(cps_ir.FunctionDefinition node) { |
| 690 unexpectedNode(node); | 690 unexpectedNode(node); |
| 691 } | 691 } |
| 692 visitParameter(cps_ir.Parameter node) => unexpectedNode(node); | 692 visitParameter(cps_ir.Parameter node) => unexpectedNode(node); |
| 693 visitContinuation(cps_ir.Continuation node) => unexpectedNode(node); | 693 visitContinuation(cps_ir.Continuation node) => unexpectedNode(node); |
| 694 visitMutableVariable(cps_ir.MutableVariable node) => unexpectedNode(node); | 694 visitMutableVariable(cps_ir.MutableVariable node) => unexpectedNode(node); |
| 695 } | 695 } |
| 696 | 696 |
| OLD | NEW |