| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // IrNodes are kept in a separate library to have precise control over their | 5 // IrNodes are kept in a separate library to have precise control over their |
| 6 // dependencies on other parts of the system. | 6 // dependencies on other parts of the system. |
| 7 library dart2js.ir_nodes; | 7 library dart2js.ir_nodes; |
| 8 | 8 |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../constants/values.dart' as values show ConstantValue; | 10 import '../constants/values.dart' as values show ConstantValue; |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 implements ExecutableDefinition { | 728 implements ExecutableDefinition { |
| 729 final FunctionElement element; | 729 final FunctionElement element; |
| 730 /// Mixed list of [Parameter]s and [ClosureVariable]s. | 730 /// Mixed list of [Parameter]s and [ClosureVariable]s. |
| 731 final List<Definition> parameters; | 731 final List<Definition> parameters; |
| 732 final RunnableBody body; | 732 final RunnableBody body; |
| 733 final List<ConstDeclaration> localConstants; | 733 final List<ConstDeclaration> localConstants; |
| 734 | 734 |
| 735 /// Values for optional parameters. | 735 /// Values for optional parameters. |
| 736 final List<ConstantExpression> defaultParameterValues; | 736 final List<ConstantExpression> defaultParameterValues; |
| 737 | 737 |
| 738 /// Closure variables declared by this function. | |
| 739 final List<ClosureVariable> closureVariables; | |
| 740 | |
| 741 FunctionDefinition(this.element, | 738 FunctionDefinition(this.element, |
| 742 this.parameters, | 739 this.parameters, |
| 743 this.body, | 740 this.body, |
| 744 this.localConstants, | 741 this.localConstants, |
| 745 this.defaultParameterValues, | 742 this.defaultParameterValues); |
| 746 this.closureVariables); | |
| 747 | 743 |
| 748 FunctionDefinition.abstract(this.element, | 744 FunctionDefinition.abstract(this.element, |
| 749 this.parameters, | 745 this.parameters, |
| 750 this.defaultParameterValues) | 746 this.defaultParameterValues) |
| 751 : body = null, | 747 : body = null, |
| 752 localConstants = const <ConstDeclaration>[], | 748 localConstants = const <ConstDeclaration>[]; |
| 753 closureVariables = const <ClosureVariable>[]; | |
| 754 | 749 |
| 755 accept(Visitor visitor) => visitor.visitFunctionDefinition(this); | 750 accept(Visitor visitor) => visitor.visitFunctionDefinition(this); |
| 756 applyPass(Pass pass) => pass.rewriteFunctionDefinition(this); | 751 applyPass(Pass pass) => pass.rewriteFunctionDefinition(this); |
| 757 | 752 |
| 758 /// Returns `true` if this function is abstract or external. | 753 /// Returns `true` if this function is abstract or external. |
| 759 /// | 754 /// |
| 760 /// If `true`, [body] is `null` and [localConstants] is empty. | 755 /// If `true`, [body] is `null` and [localConstants] is empty. |
| 761 bool get isAbstract => body == null; | 756 bool get isAbstract => body == null; |
| 762 } | 757 } |
| 763 | 758 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 780 } | 775 } |
| 781 | 776 |
| 782 class ConstructorDefinition extends FunctionDefinition { | 777 class ConstructorDefinition extends FunctionDefinition { |
| 783 final List<Initializer> initializers; | 778 final List<Initializer> initializers; |
| 784 | 779 |
| 785 ConstructorDefinition(ConstructorElement element, | 780 ConstructorDefinition(ConstructorElement element, |
| 786 List<Definition> parameters, | 781 List<Definition> parameters, |
| 787 RunnableBody body, | 782 RunnableBody body, |
| 788 this.initializers, | 783 this.initializers, |
| 789 List<ConstDeclaration> localConstants, | 784 List<ConstDeclaration> localConstants, |
| 790 List<ConstantExpression> defaultParameterValues, | 785 List<ConstantExpression> defaultParameterValues) |
| 791 List<ClosureVariable> closureVariables) | |
| 792 : super(element, parameters, body, localConstants, | 786 : super(element, parameters, body, localConstants, |
| 793 defaultParameterValues, closureVariables); | 787 defaultParameterValues); |
| 794 | 788 |
| 795 // 'Abstract' here means "has no body" and is used to represent external | 789 // 'Abstract' here means "has no body" and is used to represent external |
| 796 // constructors. | 790 // constructors. |
| 797 ConstructorDefinition.abstract( | 791 ConstructorDefinition.abstract( |
| 798 ConstructorElement element, | 792 ConstructorElement element, |
| 799 List<Definition> parameters, | 793 List<Definition> parameters, |
| 800 List<ConstantExpression> defaultParameterValues) | 794 List<ConstantExpression> defaultParameterValues) |
| 801 : initializers = null, | 795 : initializers = null, |
| 802 super.abstract(element, parameters, defaultParameterValues); | 796 super.abstract(element, parameters, defaultParameterValues); |
| 803 | 797 |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 | 1336 |
| 1343 void visitIdentical(Identical node) { | 1337 void visitIdentical(Identical node) { |
| 1344 visitReference(node.left); | 1338 visitReference(node.left); |
| 1345 visitReference(node.right); | 1339 visitReference(node.right); |
| 1346 } | 1340 } |
| 1347 | 1341 |
| 1348 void visitInterceptor(Interceptor node) { | 1342 void visitInterceptor(Interceptor node) { |
| 1349 visitReference(node.input); | 1343 visitReference(node.input); |
| 1350 } | 1344 } |
| 1351 } | 1345 } |
| OLD | NEW |