| 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 library dart2js.ir_builder_task; | 5 library dart2js.ir_builder_task; |
| 6 | 6 |
| 7 import '../closure.dart' as closurelib; | 7 import '../closure.dart' as closurelib; |
| 8 import '../closure.dart' hide ClosureScope; | 8 import '../closure.dart' hide ClosureScope; |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| 11 import '../dart2jslib.dart'; | 11 import '../dart2jslib.dart'; |
| 12 import '../elements/elements.dart'; | 12 import '../elements/elements.dart'; |
| 13 import '../elements/modelx.dart' show SynthesizedConstructorElementX, | 13 import '../elements/modelx.dart' show SynthesizedConstructorElementX, |
| 14 ConstructorBodyElementX, FunctionSignatureX; | 14 ConstructorBodyElementX, FunctionSignatureX; |
| 15 import '../io/source_information.dart'; | 15 import '../io/source_information.dart'; |
| 16 import '../js_backend/js_backend.dart' show JavaScriptBackend; | 16 import '../js_backend/js_backend.dart' show JavaScriptBackend; |
| 17 import '../resolution/semantic_visitor.dart'; | 17 import '../resolution/semantic_visitor.dart'; |
| 18 import '../resolution/operators.dart' as op; | 18 import '../resolution/operators.dart' as op; |
| 19 import '../tree/tree.dart' as ast; | 19 import '../tree/tree.dart' as ast; |
| 20 import '../types/types.dart' show TypeMask; |
| 20 import '../universe/universe.dart' show SelectorKind, CallStructure; | 21 import '../universe/universe.dart' show SelectorKind, CallStructure; |
| 21 import 'cps_ir_nodes.dart' as ir; | 22 import 'cps_ir_nodes.dart' as ir; |
| 22 import 'cps_ir_builder.dart'; | 23 import 'cps_ir_builder.dart'; |
| 23 | 24 |
| 24 typedef void IrBuilderCallback(Element element, ir.FunctionDefinition irNode); | 25 typedef void IrBuilderCallback(Element element, ir.FunctionDefinition irNode); |
| 25 | 26 |
| 26 /// This task provides the interface to build IR nodes from [ast.Node]s, which | 27 /// This task provides the interface to build IR nodes from [ast.Node]s, which |
| 27 /// is used from the [CpsFunctionCompiler] to generate code. | 28 /// is used from the [CpsFunctionCompiler] to generate code. |
| 28 /// | 29 /// |
| 29 /// This class is mainly there to correctly measure how long building the IR | 30 /// This class is mainly there to correctly measure how long building the IR |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 /// For the JS backend, normalizes order of named arguments. | 160 /// For the JS backend, normalizes order of named arguments. |
| 160 /// | 161 /// |
| 161 /// For the Dart backend, returns [arguments]. | 162 /// For the Dart backend, returns [arguments]. |
| 162 List<ir.Primitive> normalizeDynamicArguments( | 163 List<ir.Primitive> normalizeDynamicArguments( |
| 163 CallStructure callStructure, | 164 CallStructure callStructure, |
| 164 List<ir.Primitive> arguments); | 165 List<ir.Primitive> arguments); |
| 165 | 166 |
| 166 /// Read the value of [field]. | 167 /// Read the value of [field]. |
| 167 ir.Primitive buildStaticFieldGet(FieldElement field, SourceInformation src); | 168 ir.Primitive buildStaticFieldGet(FieldElement field, SourceInformation src); |
| 168 | 169 |
| 169 /// Creates a [TypedSelector] variant of [newSelector] using the type of | |
| 170 /// [oldSelector], if available. | |
| 171 /// | |
| 172 /// This is needed to preserve inferred receiver types when creating new | |
| 173 /// selectors. | |
| 174 Selector useSelectorType(Selector newSelector, Selector oldSelector) { | |
| 175 // TODO(asgerf,johnniwinther): This works but it is brittle. | |
| 176 // We should decouple selectors from inferred receiver type masks. | |
| 177 // TODO(asgerf): Use this whenever we create a selector for a dynamic call. | |
| 178 if (oldSelector is TypedSelector) { | |
| 179 return new TypedSelector(oldSelector.mask, newSelector, compiler.world); | |
| 180 } else { | |
| 181 return newSelector; | |
| 182 } | |
| 183 } | |
| 184 | |
| 185 /// Like [useSelectorType], except the original typed selector is obtained | |
| 186 /// from the [node]. | |
| 187 Selector useSelectorTypeOfNode(Selector newSelector, ast.Send node) { | |
| 188 return useSelectorType(newSelector, elements.getSelector(node)); | |
| 189 } | |
| 190 | |
| 191 ir.FunctionDefinition _makeFunctionBody(FunctionElement element, | 170 ir.FunctionDefinition _makeFunctionBody(FunctionElement element, |
| 192 ast.FunctionExpression node) { | 171 ast.FunctionExpression node) { |
| 193 FunctionSignature signature = element.functionSignature; | 172 FunctionSignature signature = element.functionSignature; |
| 194 List<Local> parameters = <Local>[]; | 173 List<Local> parameters = <Local>[]; |
| 195 signature.orderedForEachParameter( | 174 signature.orderedForEachParameter( |
| 196 (LocalParameterElement e) => parameters.add(e)); | 175 (LocalParameterElement e) => parameters.add(e)); |
| 197 | 176 |
| 198 if (element.isFactoryConstructor) { | 177 if (element.isFactoryConstructor) { |
| 199 // Type arguments are passed in as extra parameters. | 178 // Type arguments are passed in as extra parameters. |
| 200 for (DartType typeVariable in element.enclosingClass.typeVariables) { | 179 for (DartType typeVariable in element.enclosingClass.typeVariables) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 ast.VariableDefinitions variableDeclaration = | 306 ast.VariableDefinitions variableDeclaration = |
| 328 identifier.asVariableDefinitions(); | 307 identifier.asVariableDefinitions(); |
| 329 Element variableElement = elements.getForInVariable(node); | 308 Element variableElement = elements.getForInVariable(node); |
| 330 Selector selector = elements.getSelector(identifier); | 309 Selector selector = elements.getSelector(identifier); |
| 331 | 310 |
| 332 irBuilder.buildForIn( | 311 irBuilder.buildForIn( |
| 333 buildExpression: subbuild(node.expression), | 312 buildExpression: subbuild(node.expression), |
| 334 buildVariableDeclaration: subbuild(variableDeclaration), | 313 buildVariableDeclaration: subbuild(variableDeclaration), |
| 335 variableElement: variableElement, | 314 variableElement: variableElement, |
| 336 variableSelector: selector, | 315 variableSelector: selector, |
| 316 variableMask: elements.getTypeMask(node), |
| 317 currentMask: elements.getCurrentTypeMask(node), |
| 318 moveNextMask: elements.getMoveNextTypeMask(node), |
| 319 iteratorMask: elements.getIteratorTypeMask(node), |
| 337 buildBody: subbuild(node.body), | 320 buildBody: subbuild(node.body), |
| 338 target: elements.getTargetDefinition(node), | 321 target: elements.getTargetDefinition(node), |
| 339 closureScope: getClosureScopeForNode(node)); | 322 closureScope: getClosureScopeForNode(node)); |
| 340 } | 323 } |
| 341 | 324 |
| 342 ir.Primitive visitVariableDefinitions(ast.VariableDefinitions node) { | 325 ir.Primitive visitVariableDefinitions(ast.VariableDefinitions node) { |
| 343 assert(irBuilder.isOpen); | 326 assert(irBuilder.isOpen); |
| 344 if (node.modifiers.isConst) { | 327 if (node.modifiers.isConst) { |
| 345 for (ast.SendSet definition in node.definitions.nodes) { | 328 for (ast.SendSet definition in node.definitions.nodes) { |
| 346 assert(!definition.arguments.isEmpty); | 329 assert(!definition.arguments.isEmpty); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 } | 557 } |
| 575 | 558 |
| 576 @override | 559 @override |
| 577 ir.Primitive handleDynamicGet( | 560 ir.Primitive handleDynamicGet( |
| 578 ast.Send node, | 561 ast.Send node, |
| 579 ast.Node receiver, | 562 ast.Node receiver, |
| 580 Selector selector, | 563 Selector selector, |
| 581 _) { | 564 _) { |
| 582 return irBuilder.buildDynamicGet( | 565 return irBuilder.buildDynamicGet( |
| 583 translateReceiver(receiver), | 566 translateReceiver(receiver), |
| 584 selector); | 567 selector, |
| 568 elements.getTypeMask(node)); |
| 585 } | 569 } |
| 586 | 570 |
| 587 @override | 571 @override |
| 588 ir.Primitive visitIfNotNullDynamicPropertyGet( | 572 ir.Primitive visitIfNotNullDynamicPropertyGet( |
| 589 ast.Send node, | 573 ast.Send node, |
| 590 ast.Node receiver, | 574 ast.Node receiver, |
| 591 Selector selector, | 575 Selector selector, |
| 592 _) { | 576 _) { |
| 593 ir.Primitive target = visit(receiver); | 577 ir.Primitive target = visit(receiver); |
| 594 return irBuilder.buildIfNotNullSend( | 578 return irBuilder.buildIfNotNullSend( |
| 595 target, | 579 target, |
| 596 nested(() => irBuilder.buildDynamicGet(target, selector))); | 580 nested(() => irBuilder.buildDynamicGet( |
| 581 target, selector, elements.getTypeMask(node)))); |
| 597 } | 582 } |
| 598 | 583 |
| 599 @override | 584 @override |
| 600 ir.Primitive visitDynamicTypeLiteralGet( | 585 ir.Primitive visitDynamicTypeLiteralGet( |
| 601 ast.Send node, | 586 ast.Send node, |
| 602 ConstantExpression constant, | 587 ConstantExpression constant, |
| 603 _) { | 588 _) { |
| 604 return buildConstant(constant); | 589 return buildConstant(constant); |
| 605 } | 590 } |
| 606 | 591 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 ast.Send node, | 656 ast.Send node, |
| 672 MethodElement method, | 657 MethodElement method, |
| 673 _) { | 658 _) { |
| 674 return irBuilder.buildSuperMethodGet(method); | 659 return irBuilder.buildSuperMethodGet(method); |
| 675 } | 660 } |
| 676 | 661 |
| 677 @override | 662 @override |
| 678 ir.Primitive visitUnresolvedSuperGet( | 663 ir.Primitive visitUnresolvedSuperGet( |
| 679 ast.Send node, | 664 ast.Send node, |
| 680 Element element, _) { | 665 Element element, _) { |
| 681 return buildInstanceNoSuchMethod(elements.getSelector(node), []); | 666 return buildInstanceNoSuchMethod( |
| 667 elements.getSelector(node), elements.getTypeMask(node), []); |
| 682 } | 668 } |
| 683 | 669 |
| 684 @override | 670 @override |
| 685 ir.Primitive visitThisGet(ast.Identifier node, _) { | 671 ir.Primitive visitThisGet(ast.Identifier node, _) { |
| 686 if (irBuilder.state.thisParameter == null) { | 672 if (irBuilder.state.thisParameter == null) { |
| 687 // TODO(asgerf,johnniwinther): Should be in a visitInvalidThis method. | 673 // TODO(asgerf,johnniwinther): Should be in a visitInvalidThis method. |
| 688 // 'this' in static context. Just translate to null. | 674 // 'this' in static context. Just translate to null. |
| 689 assert(compiler.compilationFailed); | 675 assert(compiler.compilationFailed); |
| 690 return irBuilder.buildNullConstant(); | 676 return irBuilder.buildNullConstant(); |
| 691 } | 677 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 | 741 |
| 756 @override | 742 @override |
| 757 ir.Primitive visitIsNot(ast.Send node, | 743 ir.Primitive visitIsNot(ast.Send node, |
| 758 ast.Node expression, DartType type, _) { | 744 ast.Node expression, DartType type, _) { |
| 759 ir.Primitive value = visit(expression); | 745 ir.Primitive value = visit(expression); |
| 760 ir.Primitive check = irBuilder.buildTypeOperator( | 746 ir.Primitive check = irBuilder.buildTypeOperator( |
| 761 value, type, isTypeTest: true); | 747 value, type, isTypeTest: true); |
| 762 return irBuilder.buildNegation(check); | 748 return irBuilder.buildNegation(check); |
| 763 } | 749 } |
| 764 | 750 |
| 765 ir.Primitive translateBinary(ast.Node left, | 751 ir.Primitive translateBinary(ast.Send node, |
| 752 ast.Node left, |
| 766 op.BinaryOperator operator, | 753 op.BinaryOperator operator, |
| 767 ast.Node right) { | 754 ast.Node right) { |
| 768 Selector selector = new Selector.binaryOperator(operator.selectorName); | 755 Selector selector = new Selector.binaryOperator(operator.selectorName); |
| 769 ir.Primitive receiver = visit(left); | 756 ir.Primitive receiver = visit(left); |
| 770 List<ir.Primitive> arguments = <ir.Primitive>[visit(right)]; | 757 List<ir.Primitive> arguments = <ir.Primitive>[visit(right)]; |
| 771 arguments = normalizeDynamicArguments(selector.callStructure, arguments); | 758 arguments = normalizeDynamicArguments(selector.callStructure, arguments); |
| 772 return irBuilder.buildDynamicInvocation(receiver, selector, arguments); | 759 return irBuilder.buildDynamicInvocation( |
| 760 receiver, selector, elements.getTypeMask(node), arguments); |
| 773 } | 761 } |
| 774 | 762 |
| 775 @override | 763 @override |
| 776 ir.Primitive visitBinary(ast.Send node, | 764 ir.Primitive visitBinary(ast.Send node, |
| 777 ast.Node left, | 765 ast.Node left, |
| 778 op.BinaryOperator operator, | 766 op.BinaryOperator operator, |
| 779 ast.Node right, _) { | 767 ast.Node right, _) { |
| 780 return translateBinary(left, operator, right); | 768 return translateBinary(node, left, operator, right); |
| 781 } | 769 } |
| 782 | 770 |
| 783 @override | 771 @override |
| 784 ir.Primitive visitIndex(ast.Send node, | 772 ir.Primitive visitIndex(ast.Send node, |
| 785 ast.Node receiver, | 773 ast.Node receiver, |
| 786 ast.Node index, _) { | 774 ast.Node index, _) { |
| 787 Selector selector = new Selector.index(); | 775 Selector selector = new Selector.index(); |
| 788 ir.Primitive target = visit(receiver); | 776 ir.Primitive target = visit(receiver); |
| 789 List<ir.Primitive> arguments = <ir.Primitive>[visit(index)]; | 777 List<ir.Primitive> arguments = <ir.Primitive>[visit(index)]; |
| 790 arguments = normalizeDynamicArguments(selector.callStructure, arguments); | 778 arguments = normalizeDynamicArguments(selector.callStructure, arguments); |
| 791 return irBuilder.buildDynamicInvocation(target, selector, arguments); | 779 return irBuilder.buildDynamicInvocation( |
| 780 target, selector, elements.getTypeMask(node), arguments); |
| 792 } | 781 } |
| 793 | 782 |
| 794 ir.Primitive translateSuperBinary(FunctionElement function, | 783 ir.Primitive translateSuperBinary(FunctionElement function, |
| 795 op.BinaryOperator operator, | 784 op.BinaryOperator operator, |
| 796 ast.Node argument) { | 785 ast.Node argument) { |
| 797 CallStructure callStructure = CallStructure.ONE_ARG; | 786 CallStructure callStructure = CallStructure.ONE_ARG; |
| 798 List<ir.Primitive> arguments = <ir.Primitive>[visit(argument)]; | 787 List<ir.Primitive> arguments = <ir.Primitive>[visit(argument)]; |
| 799 arguments = normalizeDynamicArguments(callStructure, arguments); | 788 arguments = normalizeDynamicArguments(callStructure, arguments); |
| 800 return irBuilder.buildSuperMethodInvocation( | 789 return irBuilder.buildSuperMethodInvocation( |
| 801 function, callStructure, arguments); | 790 function, callStructure, arguments); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 819 _) { | 808 _) { |
| 820 return irBuilder.buildSuperIndex(function, visit(index)); | 809 return irBuilder.buildSuperIndex(function, visit(index)); |
| 821 } | 810 } |
| 822 | 811 |
| 823 @override | 812 @override |
| 824 ir.Primitive visitEquals( | 813 ir.Primitive visitEquals( |
| 825 ast.Send node, | 814 ast.Send node, |
| 826 ast.Node left, | 815 ast.Node left, |
| 827 ast.Node right, | 816 ast.Node right, |
| 828 _) { | 817 _) { |
| 829 return translateBinary(left, op.BinaryOperator.EQ, right); | 818 return translateBinary(node, left, op.BinaryOperator.EQ, right); |
| 830 } | 819 } |
| 831 | 820 |
| 832 @override | 821 @override |
| 833 ir.Primitive visitSuperEquals( | 822 ir.Primitive visitSuperEquals( |
| 834 ast.Send node, | 823 ast.Send node, |
| 835 FunctionElement function, | 824 FunctionElement function, |
| 836 ast.Node argument, | 825 ast.Node argument, |
| 837 _) { | 826 _) { |
| 838 return translateSuperBinary(function, op.BinaryOperator.EQ, argument); | 827 return translateSuperBinary(function, op.BinaryOperator.EQ, argument); |
| 839 } | 828 } |
| 840 | 829 |
| 841 @override | 830 @override |
| 842 ir.Primitive visitNot( | 831 ir.Primitive visitNot( |
| 843 ast.Send node, | 832 ast.Send node, |
| 844 ast.Node expression, | 833 ast.Node expression, |
| 845 _) { | 834 _) { |
| 846 return irBuilder.buildNegation(visit(expression)); | 835 return irBuilder.buildNegation(visit(expression)); |
| 847 } | 836 } |
| 848 | 837 |
| 849 @override | 838 @override |
| 850 ir.Primitive visitNotEquals( | 839 ir.Primitive visitNotEquals( |
| 851 ast.Send node, | 840 ast.Send node, |
| 852 ast.Node left, | 841 ast.Node left, |
| 853 ast.Node right, | 842 ast.Node right, |
| 854 _) { | 843 _) { |
| 855 return irBuilder.buildNegation( | 844 return irBuilder.buildNegation( |
| 856 translateBinary(left, op.BinaryOperator.NOT_EQ, right)); | 845 translateBinary(node, left, op.BinaryOperator.NOT_EQ, right)); |
| 857 } | 846 } |
| 858 | 847 |
| 859 @override | 848 @override |
| 860 ir.Primitive visitSuperNotEquals( | 849 ir.Primitive visitSuperNotEquals( |
| 861 ast.Send node, | 850 ast.Send node, |
| 862 FunctionElement function, | 851 FunctionElement function, |
| 863 ast.Node argument, | 852 ast.Node argument, |
| 864 _) { | 853 _) { |
| 865 return irBuilder.buildNegation( | 854 return irBuilder.buildNegation( |
| 866 translateSuperBinary(function, op.BinaryOperator.NOT_EQ, argument)); | 855 translateSuperBinary(function, op.BinaryOperator.NOT_EQ, argument)); |
| 867 } | 856 } |
| 868 | 857 |
| 869 @override | 858 @override |
| 870 ir.Primitive visitUnary(ast.Send node, | 859 ir.Primitive visitUnary(ast.Send node, |
| 871 op.UnaryOperator operator, ast.Node expression, _) { | 860 op.UnaryOperator operator, ast.Node expression, _) { |
| 872 // TODO(johnniwinther): Clean up the creation of selectors. | 861 // TODO(johnniwinther): Clean up the creation of selectors. |
| 873 Selector selector = operator.selector; | 862 Selector selector = operator.selector; |
| 874 ir.Primitive receiver = translateReceiver(expression); | 863 ir.Primitive receiver = translateReceiver(expression); |
| 875 return irBuilder.buildDynamicInvocation(receiver, selector, const []); | 864 return irBuilder.buildDynamicInvocation( |
| 865 receiver, selector, elements.getTypeMask(node), const []); |
| 876 } | 866 } |
| 877 | 867 |
| 878 @override | 868 @override |
| 879 ir.Primitive visitSuperUnary( | 869 ir.Primitive visitSuperUnary( |
| 880 ast.Send node, | 870 ast.Send node, |
| 881 op.UnaryOperator operator, | 871 op.UnaryOperator operator, |
| 882 FunctionElement function, | 872 FunctionElement function, |
| 883 _) { | 873 _) { |
| 884 return irBuilder.buildSuperMethodInvocation( | 874 return irBuilder.buildSuperMethodInvocation( |
| 885 function, CallStructure.NO_ARGS, const []); | 875 function, CallStructure.NO_ARGS, const []); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 } | 912 } |
| 923 | 913 |
| 924 @override | 914 @override |
| 925 ir.Primitive handleDynamicInvoke( | 915 ir.Primitive handleDynamicInvoke( |
| 926 ast.Send node, | 916 ast.Send node, |
| 927 ast.Node receiver, | 917 ast.Node receiver, |
| 928 ast.NodeList arguments, | 918 ast.NodeList arguments, |
| 929 Selector selector, | 919 Selector selector, |
| 930 _) { | 920 _) { |
| 931 return irBuilder.buildDynamicInvocation( | 921 return irBuilder.buildDynamicInvocation( |
| 932 translateReceiver(receiver), selector, | 922 translateReceiver(receiver), selector, elements.getTypeMask(node), |
| 933 translateDynamicArguments(arguments, selector.callStructure)); | 923 translateDynamicArguments(arguments, selector.callStructure)); |
| 934 } | 924 } |
| 935 | 925 |
| 936 @override | 926 @override |
| 937 ir.Primitive visitIfNotNullDynamicPropertyInvoke( | 927 ir.Primitive visitIfNotNullDynamicPropertyInvoke( |
| 938 ast.Send node, | 928 ast.Send node, |
| 939 ast.Node receiver, | 929 ast.Node receiver, |
| 940 ast.NodeList arguments, | 930 ast.NodeList arguments, |
| 941 Selector selector, | 931 Selector selector, |
| 942 _) { | 932 _) { |
| 943 ir.Primitive target = visit(receiver); | 933 ir.Primitive target = visit(receiver); |
| 944 return irBuilder.buildIfNotNullSend( | 934 return irBuilder.buildIfNotNullSend( |
| 945 target, | 935 target, |
| 946 nested(() => irBuilder.buildDynamicInvocation( | 936 nested(() => irBuilder.buildDynamicInvocation( |
| 947 target, selector, | 937 target, selector, elements.getTypeMask(node), |
| 948 translateDynamicArguments(arguments, selector.callStructure)))); | 938 translateDynamicArguments(arguments, selector.callStructure)))); |
| 949 } | 939 } |
| 950 | 940 |
| 951 ir.Primitive handleLocalInvoke( | 941 ir.Primitive handleLocalInvoke( |
| 952 ast.Send node, | 942 ast.Send node, |
| 953 LocalElement element, | 943 LocalElement element, |
| 954 ast.NodeList arguments, | 944 ast.NodeList arguments, |
| 955 CallStructure callStructure, | 945 CallStructure callStructure, |
| 956 _) { | 946 _) { |
| 957 return irBuilder.buildLocalVariableInvocation(element, callStructure, | 947 return irBuilder.buildLocalVariableInvocation(element, callStructure, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 } | 1059 } |
| 1070 | 1060 |
| 1071 @override | 1061 @override |
| 1072 ir.Primitive visitSuperMethodIncompatibleInvoke( | 1062 ir.Primitive visitSuperMethodIncompatibleInvoke( |
| 1073 ast.Send node, | 1063 ast.Send node, |
| 1074 MethodElement method, | 1064 MethodElement method, |
| 1075 ast.NodeList arguments, | 1065 ast.NodeList arguments, |
| 1076 CallStructure callStructure, _) { | 1066 CallStructure callStructure, _) { |
| 1077 return buildInstanceNoSuchMethod( | 1067 return buildInstanceNoSuchMethod( |
| 1078 elements.getSelector(node), | 1068 elements.getSelector(node), |
| 1069 elements.getTypeMask(node), |
| 1079 translateDynamicArguments(arguments, callStructure)); | 1070 translateDynamicArguments(arguments, callStructure)); |
| 1080 } | 1071 } |
| 1081 | 1072 |
| 1082 @override | 1073 @override |
| 1083 ir.Primitive visitUnresolvedSuperInvoke( | 1074 ir.Primitive visitUnresolvedSuperInvoke( |
| 1084 ast.Send node, | 1075 ast.Send node, |
| 1085 Element element, | 1076 Element element, |
| 1086 ast.NodeList arguments, | 1077 ast.NodeList arguments, |
| 1087 Selector selector, _) { | 1078 Selector selector, _) { |
| 1088 return buildInstanceNoSuchMethod( | 1079 return buildInstanceNoSuchMethod( |
| 1089 elements.getSelector(node), | 1080 elements.getSelector(node), |
| 1081 elements.getTypeMask(node), |
| 1090 translateDynamicArguments(arguments, selector.callStructure)); | 1082 translateDynamicArguments(arguments, selector.callStructure)); |
| 1091 } | 1083 } |
| 1092 | 1084 |
| 1093 @override | 1085 @override |
| 1094 ir.Primitive visitThisInvoke( | 1086 ir.Primitive visitThisInvoke( |
| 1095 ast.Send node, | 1087 ast.Send node, |
| 1096 ast.NodeList arguments, | 1088 ast.NodeList arguments, |
| 1097 CallStructure callStructure, | 1089 CallStructure callStructure, |
| 1098 _) { | 1090 _) { |
| 1099 return translateCallInvoke(irBuilder.buildThis(), arguments, callStructure); | 1091 return translateCallInvoke(irBuilder.buildThis(), arguments, callStructure); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1113 } | 1105 } |
| 1114 | 1106 |
| 1115 @override | 1107 @override |
| 1116 ir.Primitive visitIndexSet( | 1108 ir.Primitive visitIndexSet( |
| 1117 ast.SendSet node, | 1109 ast.SendSet node, |
| 1118 ast.Node receiver, | 1110 ast.Node receiver, |
| 1119 ast.Node index, | 1111 ast.Node index, |
| 1120 ast.Node rhs, | 1112 ast.Node rhs, |
| 1121 _) { | 1113 _) { |
| 1122 return irBuilder.buildDynamicIndexSet( | 1114 return irBuilder.buildDynamicIndexSet( |
| 1123 visit(receiver), visit(index), visit(rhs)); | 1115 visit(receiver), elements.getTypeMask(node), visit(index), visit(rhs)); |
| 1124 } | 1116 } |
| 1125 | 1117 |
| 1126 @override | 1118 @override |
| 1127 ir.Primitive visitSuperIndexSet( | 1119 ir.Primitive visitSuperIndexSet( |
| 1128 ast.SendSet node, | 1120 ast.SendSet node, |
| 1129 FunctionElement function, | 1121 FunctionElement function, |
| 1130 ast.Node index, | 1122 ast.Node index, |
| 1131 ast.Node rhs, | 1123 ast.Node rhs, |
| 1132 _) { | 1124 _) { |
| 1133 return irBuilder.buildSuperIndexSet(function, visit(index), visit(rhs)); | 1125 return irBuilder.buildSuperIndexSet(function, visit(index), visit(rhs)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1153 new Selector.binaryOperator(operator.selectorName); | 1145 new Selector.binaryOperator(operator.selectorName); |
| 1154 ir.Primitive rhsValue; | 1146 ir.Primitive rhsValue; |
| 1155 if (rhs.kind == CompoundKind.ASSIGNMENT) { | 1147 if (rhs.kind == CompoundKind.ASSIGNMENT) { |
| 1156 rhsValue = visit(rhs.rhs); | 1148 rhsValue = visit(rhs.rhs); |
| 1157 } else { | 1149 } else { |
| 1158 rhsValue = irBuilder.buildIntegerConstant(1); | 1150 rhsValue = irBuilder.buildIntegerConstant(1); |
| 1159 } | 1151 } |
| 1160 List<ir.Primitive> arguments = <ir.Primitive>[rhsValue]; | 1152 List<ir.Primitive> arguments = <ir.Primitive>[rhsValue]; |
| 1161 arguments = normalizeDynamicArguments( | 1153 arguments = normalizeDynamicArguments( |
| 1162 operatorSelector.callStructure, arguments); | 1154 operatorSelector.callStructure, arguments); |
| 1155 // TODO(johnniwinther): Find the type mask for the operation. |
| 1163 ir.Primitive result = | 1156 ir.Primitive result = |
| 1164 irBuilder.buildDynamicInvocation(value, operatorSelector, arguments); | 1157 irBuilder.buildDynamicInvocation( |
| 1158 value, operatorSelector, null, arguments); |
| 1165 setValue(result); | 1159 setValue(result); |
| 1166 return rhs.kind == CompoundKind.POSTFIX ? value : result; | 1160 return rhs.kind == CompoundKind.POSTFIX ? value : result; |
| 1167 } | 1161 } |
| 1168 | 1162 |
| 1169 @override | 1163 @override |
| 1170 ir.Primitive handleDynamicSet( | 1164 ir.Primitive handleDynamicSet( |
| 1171 ast.SendSet node, | 1165 ast.SendSet node, |
| 1172 ast.Node receiver, | 1166 ast.Node receiver, |
| 1173 Selector selector, | 1167 Selector selector, |
| 1174 ast.Node rhs, | 1168 ast.Node rhs, |
| 1175 _) { | 1169 _) { |
| 1176 return irBuilder.buildDynamicSet( | 1170 return irBuilder.buildDynamicSet( |
| 1177 translateReceiver(receiver), | 1171 translateReceiver(receiver), |
| 1178 selector, | 1172 selector, |
| 1173 elements.getTypeMask(node), |
| 1179 visit(rhs)); | 1174 visit(rhs)); |
| 1180 } | 1175 } |
| 1181 | 1176 |
| 1182 @override | 1177 @override |
| 1183 ir.Primitive visitIfNotNullDynamicPropertySet( | 1178 ir.Primitive visitIfNotNullDynamicPropertySet( |
| 1184 ast.SendSet node, | 1179 ast.SendSet node, |
| 1185 ast.Node receiver, | 1180 ast.Node receiver, |
| 1186 Selector selector, | 1181 Selector selector, |
| 1187 ast.Node rhs, | 1182 ast.Node rhs, |
| 1188 _) { | 1183 _) { |
| 1189 ir.Primitive target = visit(receiver); | 1184 ir.Primitive target = visit(receiver); |
| 1190 return irBuilder.buildIfNotNullSend( | 1185 return irBuilder.buildIfNotNullSend( |
| 1191 target, | 1186 target, |
| 1192 nested(() => irBuilder.buildDynamicSet(target, selector, visit(rhs)))); | 1187 nested(() => irBuilder.buildDynamicSet( |
| 1188 target, selector, elements.getTypeMask(node), visit(rhs)))); |
| 1193 } | 1189 } |
| 1194 | 1190 |
| 1195 @override | 1191 @override |
| 1196 ir.Primitive handleLocalSet( | 1192 ir.Primitive handleLocalSet( |
| 1197 ast.SendSet node, | 1193 ast.SendSet node, |
| 1198 LocalElement element, | 1194 LocalElement element, |
| 1199 ast.Node rhs, | 1195 ast.Node rhs, |
| 1200 _) { | 1196 _) { |
| 1201 return irBuilder.buildLocalVariableSet(element, visit(rhs)); | 1197 return irBuilder.buildLocalVariableSet(element, visit(rhs)); |
| 1202 } | 1198 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 CompoundRhs rhs, | 1250 CompoundRhs rhs, |
| 1255 arg) { | 1251 arg) { |
| 1256 return translateCompounds( | 1252 return translateCompounds( |
| 1257 getValue: () => buildConstant(constant), | 1253 getValue: () => buildConstant(constant), |
| 1258 rhs: rhs, | 1254 rhs: rhs, |
| 1259 setValue: (value) {}); // The binary operator will throw before this. | 1255 setValue: (value) {}); // The binary operator will throw before this. |
| 1260 } | 1256 } |
| 1261 | 1257 |
| 1262 @override | 1258 @override |
| 1263 ir.Primitive handleDynamicCompounds( | 1259 ir.Primitive handleDynamicCompounds( |
| 1264 ast.Send node, | 1260 ast.SendSet node, |
| 1265 ast.Node receiver, | 1261 ast.Node receiver, |
| 1266 CompoundRhs rhs, | 1262 CompoundRhs rhs, |
| 1267 Selector getterSelector, | 1263 Selector getterSelector, |
| 1268 Selector setterSelector, | 1264 Selector setterSelector, |
| 1269 arg) { | 1265 arg) { |
| 1270 ir.Primitive target = translateReceiver(receiver); | 1266 ir.Primitive target = translateReceiver(receiver); |
| 1271 ir.Primitive helper() { | 1267 ir.Primitive helper() { |
| 1272 return translateCompounds( | 1268 return translateCompounds( |
| 1273 getValue: () => irBuilder.buildDynamicGet(target, getterSelector), | 1269 getValue: () => irBuilder.buildDynamicGet( |
| 1270 target, |
| 1271 getterSelector, |
| 1272 elements.getGetterTypeMaskInComplexSendSet(node)), |
| 1274 rhs: rhs, | 1273 rhs: rhs, |
| 1275 setValue: (ir.Primitive result) { | 1274 setValue: (ir.Primitive result) { |
| 1276 irBuilder.buildDynamicSet(target, setterSelector, result); | 1275 irBuilder.buildDynamicSet( |
| 1276 target, setterSelector, elements.getTypeMask(node), result); |
| 1277 }); | 1277 }); |
| 1278 } | 1278 } |
| 1279 return node.isConditional | 1279 return node.isConditional |
| 1280 ? irBuilder.buildIfNotNullSend(target, nested(helper)) | 1280 ? irBuilder.buildIfNotNullSend(target, nested(helper)) |
| 1281 : helper(); | 1281 : helper(); |
| 1282 } | 1282 } |
| 1283 | 1283 |
| 1284 ir.Primitive buildLocalNoSuchSetter(Local local, ir.Primitive value) { | 1284 ir.Primitive buildLocalNoSuchSetter(Local local, ir.Primitive value) { |
| 1285 Selector selector = new Selector.setter(local.name, null); | 1285 Selector selector = new Selector.setter(local.name, null); |
| 1286 return buildStaticNoSuchMethod(selector, [value]); | 1286 return buildStaticNoSuchMethod(selector, [value]); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 case CompoundSetter.SETTER: | 1354 case CompoundSetter.SETTER: |
| 1355 return irBuilder.buildStaticSetterSet(setter, result); | 1355 return irBuilder.buildStaticSetterSet(setter, result); |
| 1356 case CompoundSetter.INVALID: | 1356 case CompoundSetter.INVALID: |
| 1357 // TODO(johnniwinther): Ensure [setter] is non null. | 1357 // TODO(johnniwinther): Ensure [setter] is non null. |
| 1358 return buildStaticNoSuchSetter( | 1358 return buildStaticNoSuchSetter( |
| 1359 setter != null ? setter : getter, result); | 1359 setter != null ? setter : getter, result); |
| 1360 } | 1360 } |
| 1361 }); | 1361 }); |
| 1362 } | 1362 } |
| 1363 | 1363 |
| 1364 ir.Primitive buildSuperNoSuchGetter(Element element) { | 1364 ir.Primitive buildSuperNoSuchGetter(Element element, TypeMask mask) { |
| 1365 return buildInstanceNoSuchMethod( | 1365 return buildInstanceNoSuchMethod( |
| 1366 new Selector.getter(element.name, element.library), | 1366 new Selector.getter(element.name, element.library), |
| 1367 mask, |
| 1367 const <ir.Primitive>[]); | 1368 const <ir.Primitive>[]); |
| 1368 } | 1369 } |
| 1369 | 1370 |
| 1370 ir.Primitive buildSuperNoSuchSetter(Element element, ir.Primitive value) { | 1371 ir.Primitive buildSuperNoSuchSetter(Element element, |
| 1372 TypeMask mask, |
| 1373 ir.Primitive value) { |
| 1371 return buildInstanceNoSuchMethod( | 1374 return buildInstanceNoSuchMethod( |
| 1372 new Selector.setter(element.name, element.library), | 1375 new Selector.setter(element.name, element.library), |
| 1376 mask, |
| 1373 <ir.Primitive>[value]); | 1377 <ir.Primitive>[value]); |
| 1374 } | 1378 } |
| 1375 | 1379 |
| 1376 @override | 1380 @override |
| 1377 ir.Primitive handleSuperCompounds( | 1381 ir.Primitive handleSuperCompounds( |
| 1378 ast.SendSet node, | 1382 ast.SendSet node, |
| 1379 Element getter, | 1383 Element getter, |
| 1380 CompoundGetter getterKind, | 1384 CompoundGetter getterKind, |
| 1381 Element setter, | 1385 Element setter, |
| 1382 CompoundSetter setterKind, | 1386 CompoundSetter setterKind, |
| 1383 CompoundRhs rhs, | 1387 CompoundRhs rhs, |
| 1384 arg) { | 1388 arg) { |
| 1385 return translateCompounds( | 1389 return translateCompounds( |
| 1386 getValue: () { | 1390 getValue: () { |
| 1387 switch (getterKind) { | 1391 switch (getterKind) { |
| 1388 case CompoundGetter.FIELD: | 1392 case CompoundGetter.FIELD: |
| 1389 return irBuilder.buildSuperFieldGet(getter); | 1393 return irBuilder.buildSuperFieldGet(getter); |
| 1390 case CompoundGetter.GETTER: | 1394 case CompoundGetter.GETTER: |
| 1391 return irBuilder.buildSuperGetterGet(getter); | 1395 return irBuilder.buildSuperGetterGet(getter); |
| 1392 case CompoundGetter.METHOD: | 1396 case CompoundGetter.METHOD: |
| 1393 return irBuilder.buildSuperMethodGet(getter); | 1397 return irBuilder.buildSuperMethodGet(getter); |
| 1394 case CompoundGetter.UNRESOLVED: | 1398 case CompoundGetter.UNRESOLVED: |
| 1395 // TODO(johnniwinther): Ensure [getter] is not null. | 1399 // TODO(johnniwinther): Ensure [getter] is not null. |
| 1396 return buildSuperNoSuchGetter(getter != null ? getter : setter); | 1400 return buildSuperNoSuchGetter( |
| 1401 getter != null ? getter : setter, |
| 1402 elements.getGetterTypeMaskInComplexSendSet(node)); |
| 1397 } | 1403 } |
| 1398 }, | 1404 }, |
| 1399 rhs: rhs, | 1405 rhs: rhs, |
| 1400 setValue: (ir.Primitive result) { | 1406 setValue: (ir.Primitive result) { |
| 1401 switch (setterKind) { | 1407 switch (setterKind) { |
| 1402 case CompoundSetter.FIELD: | 1408 case CompoundSetter.FIELD: |
| 1403 return irBuilder.buildSuperFieldSet(setter, result); | 1409 return irBuilder.buildSuperFieldSet(setter, result); |
| 1404 case CompoundSetter.SETTER: | 1410 case CompoundSetter.SETTER: |
| 1405 return irBuilder.buildSuperSetterSet(setter, result); | 1411 return irBuilder.buildSuperSetterSet(setter, result); |
| 1406 case CompoundSetter.INVALID: | 1412 case CompoundSetter.INVALID: |
| 1407 return buildSuperNoSuchSetter(setter, result); | 1413 return buildSuperNoSuchSetter(setter, elements.getTypeMask(node),
result); |
| 1408 } | 1414 } |
| 1409 }); | 1415 }); |
| 1410 } | 1416 } |
| 1411 | 1417 |
| 1412 @override | 1418 @override |
| 1413 ir.Primitive handleTypeVariableTypeLiteralCompounds( | 1419 ir.Primitive handleTypeVariableTypeLiteralCompounds( |
| 1414 ast.SendSet node, | 1420 ast.SendSet node, |
| 1415 TypeVariableElement typeVariable, | 1421 TypeVariableElement typeVariable, |
| 1416 CompoundRhs rhs, | 1422 CompoundRhs rhs, |
| 1417 arg) { | 1423 arg) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1429 CompoundRhs rhs, | 1435 CompoundRhs rhs, |
| 1430 arg) { | 1436 arg) { |
| 1431 ir.Primitive target = visit(receiver); | 1437 ir.Primitive target = visit(receiver); |
| 1432 ir.Primitive indexValue = visit(index); | 1438 ir.Primitive indexValue = visit(index); |
| 1433 return translateCompounds( | 1439 return translateCompounds( |
| 1434 getValue: () { | 1440 getValue: () { |
| 1435 Selector selector = new Selector.index(); | 1441 Selector selector = new Selector.index(); |
| 1436 List<ir.Primitive> arguments = <ir.Primitive>[indexValue]; | 1442 List<ir.Primitive> arguments = <ir.Primitive>[indexValue]; |
| 1437 arguments = | 1443 arguments = |
| 1438 normalizeDynamicArguments(selector.callStructure, arguments); | 1444 normalizeDynamicArguments(selector.callStructure, arguments); |
| 1439 return irBuilder.buildDynamicInvocation(target, selector, arguments); | 1445 return irBuilder.buildDynamicInvocation( |
| 1446 target, |
| 1447 selector, |
| 1448 elements.getGetterTypeMaskInComplexSendSet(node), |
| 1449 arguments); |
| 1440 }, | 1450 }, |
| 1441 rhs: rhs, | 1451 rhs: rhs, |
| 1442 setValue: (ir.Primitive result) { | 1452 setValue: (ir.Primitive result) { |
| 1443 irBuilder.buildDynamicIndexSet(target, indexValue, result); | 1453 irBuilder.buildDynamicIndexSet( |
| 1454 target, |
| 1455 elements.getTypeMask(node), |
| 1456 indexValue, |
| 1457 result); |
| 1444 }); | 1458 }); |
| 1445 } | 1459 } |
| 1446 | 1460 |
| 1447 @override | 1461 @override |
| 1448 ir.Primitive handleSuperIndexCompounds( | 1462 ir.Primitive handleSuperIndexCompounds( |
| 1449 ast.SendSet node, | 1463 ast.SendSet node, |
| 1450 Element indexFunction, | 1464 Element indexFunction, |
| 1451 Element indexSetFunction, | 1465 Element indexSetFunction, |
| 1452 ast.Node index, | 1466 ast.Node index, |
| 1453 CompoundRhs rhs, | 1467 CompoundRhs rhs, |
| 1454 arg, | 1468 arg, |
| 1455 {bool isGetterValid, | 1469 {bool isGetterValid, |
| 1456 bool isSetterValid}) { | 1470 bool isSetterValid}) { |
| 1457 ir.Primitive indexValue = visit(index); | 1471 ir.Primitive indexValue = visit(index); |
| 1458 return translateCompounds( | 1472 return translateCompounds( |
| 1459 getValue: () { | 1473 getValue: () { |
| 1460 if (isGetterValid) { | 1474 if (isGetterValid) { |
| 1461 return irBuilder.buildSuperIndex(indexFunction, indexValue); | 1475 return irBuilder.buildSuperIndex(indexFunction, indexValue); |
| 1462 } else { | 1476 } else { |
| 1463 return buildInstanceNoSuchMethod( | 1477 return buildInstanceNoSuchMethod( |
| 1464 new Selector.index(), <ir.Primitive>[indexValue]); | 1478 new Selector.index(), |
| 1479 elements.getGetterTypeMaskInComplexSendSet(node), |
| 1480 <ir.Primitive>[indexValue]); |
| 1465 } | 1481 } |
| 1466 }, | 1482 }, |
| 1467 rhs: rhs, | 1483 rhs: rhs, |
| 1468 setValue: (ir.Primitive result) { | 1484 setValue: (ir.Primitive result) { |
| 1469 if (isSetterValid) { | 1485 if (isSetterValid) { |
| 1470 irBuilder.buildSuperIndexSet(indexSetFunction, indexValue, result); | 1486 irBuilder.buildSuperIndexSet(indexSetFunction, indexValue, result); |
| 1471 } else { | 1487 } else { |
| 1472 buildInstanceNoSuchMethod( | 1488 buildInstanceNoSuchMethod( |
| 1473 new Selector.indexSet(), <ir.Primitive>[indexValue, result]); | 1489 new Selector.indexSet(), |
| 1490 elements.getTypeMask(node), |
| 1491 <ir.Primitive>[indexValue, result]); |
| 1474 } | 1492 } |
| 1475 }); | 1493 }); |
| 1476 } | 1494 } |
| 1477 | 1495 |
| 1478 ir.Primitive visitStringJuxtaposition(ast.StringJuxtaposition node) { | 1496 ir.Primitive visitStringJuxtaposition(ast.StringJuxtaposition node) { |
| 1479 assert(irBuilder.isOpen); | 1497 assert(irBuilder.isOpen); |
| 1480 ir.Primitive first = visit(node.first); | 1498 ir.Primitive first = visit(node.first); |
| 1481 ir.Primitive second = visit(node.second); | 1499 ir.Primitive second = visit(node.second); |
| 1482 return irBuilder.buildStringConcatenation([first, second]); | 1500 return irBuilder.buildStringConcatenation([first, second]); |
| 1483 } | 1501 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1506 // statements. | 1524 // statements. |
| 1507 return irBuilder.buildNonTailThrow(visit(node.expression)); | 1525 return irBuilder.buildNonTailThrow(visit(node.expression)); |
| 1508 } | 1526 } |
| 1509 | 1527 |
| 1510 ir.Primitive buildStaticNoSuchMethod( | 1528 ir.Primitive buildStaticNoSuchMethod( |
| 1511 Selector selector, | 1529 Selector selector, |
| 1512 List<ir.Primitive> arguments); | 1530 List<ir.Primitive> arguments); |
| 1513 | 1531 |
| 1514 ir.Primitive buildInstanceNoSuchMethod( | 1532 ir.Primitive buildInstanceNoSuchMethod( |
| 1515 Selector selector, | 1533 Selector selector, |
| 1534 TypeMask mask, |
| 1516 List<ir.Primitive> arguments); | 1535 List<ir.Primitive> arguments); |
| 1517 | 1536 |
| 1518 ir.Primitive buildRuntimeError(String message); | 1537 ir.Primitive buildRuntimeError(String message); |
| 1519 | 1538 |
| 1520 ir.Primitive buildAbstractClassInstantiationError(ClassElement element); | 1539 ir.Primitive buildAbstractClassInstantiationError(ClassElement element); |
| 1521 | 1540 |
| 1522 @override | 1541 @override |
| 1523 ir.Primitive errorInvalidAssert( | 1542 ir.Primitive errorInvalidAssert( |
| 1524 ast.Send node, | 1543 ast.Send node, |
| 1525 ast.NodeList arguments, _) { | 1544 ast.NodeList arguments, _) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 ast.Node rhs, _) { | 1643 ast.Node rhs, _) { |
| 1625 return buildStaticNoSuchMethod(elements.getSelector(node), [visit(rhs)]); | 1644 return buildStaticNoSuchMethod(elements.getSelector(node), [visit(rhs)]); |
| 1626 } | 1645 } |
| 1627 | 1646 |
| 1628 @override | 1647 @override |
| 1629 ir.Primitive visitUnresolvedSuperIndex( | 1648 ir.Primitive visitUnresolvedSuperIndex( |
| 1630 ast.Send node, | 1649 ast.Send node, |
| 1631 Element function, | 1650 Element function, |
| 1632 ast.Node index, _) { | 1651 ast.Node index, _) { |
| 1633 // Assume the index getter is missing. | 1652 // Assume the index getter is missing. |
| 1634 Selector selector = useSelectorTypeOfNode(new Selector.index(), node); | 1653 return buildInstanceNoSuchMethod( |
| 1635 return buildInstanceNoSuchMethod(selector, [visit(index)]); | 1654 new Selector.index(), elements.getTypeMask(node), [visit(index)]); |
| 1636 } | 1655 } |
| 1637 | 1656 |
| 1638 @override | 1657 @override |
| 1639 ir.Primitive visitUnresolvedSuperBinary( | 1658 ir.Primitive visitUnresolvedSuperBinary( |
| 1640 ast.Send node, | 1659 ast.Send node, |
| 1641 Element element, | 1660 Element element, |
| 1642 op.BinaryOperator operator, | 1661 op.BinaryOperator operator, |
| 1643 ast.Node argument, _) { | 1662 ast.Node argument, _) { |
| 1644 return buildInstanceNoSuchMethod( | 1663 return buildInstanceNoSuchMethod( |
| 1645 elements.getSelector(node), | 1664 elements.getSelector(node), |
| 1665 elements.getTypeMask(node), |
| 1646 [visit(argument)]); | 1666 [visit(argument)]); |
| 1647 } | 1667 } |
| 1648 | 1668 |
| 1649 @override | 1669 @override |
| 1650 ir.Primitive visitUnresolvedSuperUnary( | 1670 ir.Primitive visitUnresolvedSuperUnary( |
| 1651 ast.Send node, | 1671 ast.Send node, |
| 1652 op.UnaryOperator operator, | 1672 op.UnaryOperator operator, |
| 1653 Element element, _) { | 1673 Element element, _) { |
| 1654 return buildInstanceNoSuchMethod(elements.getSelector(node), []); | 1674 return buildInstanceNoSuchMethod( |
| 1675 elements.getSelector(node), elements.getTypeMask(node), []); |
| 1655 } | 1676 } |
| 1656 | 1677 |
| 1657 @override | 1678 @override |
| 1658 ir.Primitive errorUndefinedBinaryExpression( | 1679 ir.Primitive errorUndefinedBinaryExpression( |
| 1659 ast.Send node, | 1680 ast.Send node, |
| 1660 ast.Node left, | 1681 ast.Node left, |
| 1661 ast.Operator operator, | 1682 ast.Operator operator, |
| 1662 ast.Node right, _) { | 1683 ast.Node right, _) { |
| 1663 assert(compiler.compilationFailed); | 1684 assert(compiler.compilationFailed); |
| 1664 return irBuilder.buildNullConstant(); | 1685 return irBuilder.buildNullConstant(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 return buildStaticNoSuchMethod( | 1753 return buildStaticNoSuchMethod( |
| 1733 new Selector.setter(field.name, field.library), | 1754 new Selector.setter(field.name, field.library), |
| 1734 [visit(rhs)]); | 1755 [visit(rhs)]); |
| 1735 } | 1756 } |
| 1736 | 1757 |
| 1737 @override | 1758 @override |
| 1738 ir.Primitive visitFinalSuperFieldSet( | 1759 ir.Primitive visitFinalSuperFieldSet( |
| 1739 ast.SendSet node, | 1760 ast.SendSet node, |
| 1740 FieldElement field, | 1761 FieldElement field, |
| 1741 ast.Node rhs, _) { | 1762 ast.Node rhs, _) { |
| 1742 Selector selector = useSelectorTypeOfNode( | 1763 return buildInstanceNoSuchMethod( |
| 1743 new Selector.setter(field.name, field.library), | 1764 new Selector.setter(field.name, field.library), |
| 1744 node); | 1765 elements.getTypeMask(node), |
| 1745 return buildInstanceNoSuchMethod(selector, [visit(rhs)]); | 1766 [visit(rhs)]); |
| 1746 } | 1767 } |
| 1747 | 1768 |
| 1748 @override | 1769 @override |
| 1749 ir.Primitive handleImmutableLocalSet( | 1770 ir.Primitive handleImmutableLocalSet( |
| 1750 ast.SendSet node, | 1771 ast.SendSet node, |
| 1751 LocalElement local, | 1772 LocalElement local, |
| 1752 ast.Node rhs, _) { | 1773 ast.Node rhs, _) { |
| 1753 return buildStaticNoSuchMethod( | 1774 return buildStaticNoSuchMethod( |
| 1754 new Selector.setter(local.name, null), | 1775 new Selector.setter(local.name, null), |
| 1755 [visit(rhs)]); | 1776 [visit(rhs)]); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 new Selector(SelectorKind.CALL, name, callStructure), | 1821 new Selector(SelectorKind.CALL, name, callStructure), |
| 1801 args); | 1822 args); |
| 1802 } | 1823 } |
| 1803 | 1824 |
| 1804 @override | 1825 @override |
| 1805 ir.Primitive visitSuperGetterSet( | 1826 ir.Primitive visitSuperGetterSet( |
| 1806 ast.SendSet node, | 1827 ast.SendSet node, |
| 1807 FunctionElement getter, | 1828 FunctionElement getter, |
| 1808 ast.Node rhs, | 1829 ast.Node rhs, |
| 1809 _) { | 1830 _) { |
| 1810 Selector selector = useSelectorTypeOfNode( | 1831 return buildInstanceNoSuchMethod( |
| 1811 new Selector.setter(getter.name, getter.library), | 1832 new Selector.setter(getter.name, getter.library), |
| 1812 node); | 1833 elements.getTypeMask(node), |
| 1813 return buildInstanceNoSuchMethod(selector, [visit(rhs)]); | 1834 [visit(rhs)]); |
| 1814 } | 1835 } |
| 1815 | 1836 |
| 1816 @override | 1837 @override |
| 1817 ir.Primitive visitSuperMethodSet( | 1838 ir.Primitive visitSuperMethodSet( |
| 1818 ast.Send node, | 1839 ast.Send node, |
| 1819 MethodElement method, | 1840 MethodElement method, |
| 1820 ast.Node rhs, | 1841 ast.Node rhs, |
| 1821 _) { | 1842 _) { |
| 1822 Selector selector = useSelectorTypeOfNode( | 1843 return buildInstanceNoSuchMethod( |
| 1823 new Selector.setter(method.name, method.library), | 1844 new Selector.setter(method.name, method.library), |
| 1824 node); | 1845 elements.getTypeMask(node), |
| 1825 return buildInstanceNoSuchMethod(selector, [visit(rhs)]); | 1846 [visit(rhs)]); |
| 1826 } | 1847 } |
| 1827 | 1848 |
| 1828 @override | 1849 @override |
| 1829 ir.Primitive visitSuperSetterGet( | 1850 ir.Primitive visitSuperSetterGet( |
| 1830 ast.Send node, | 1851 ast.Send node, |
| 1831 FunctionElement setter, _) { | 1852 FunctionElement setter, _) { |
| 1832 Selector selector = useSelectorTypeOfNode( | 1853 return buildInstanceNoSuchMethod( |
| 1833 new Selector.setter(setter.name, setter.library), | 1854 new Selector.setter(setter.name, setter.library), |
| 1834 node); | 1855 elements.getTypeMask(node), |
| 1835 return buildInstanceNoSuchMethod(selector, []); | 1856 []); |
| 1836 } | 1857 } |
| 1837 | 1858 |
| 1838 @override | 1859 @override |
| 1839 ir.Primitive visitSuperSetterInvoke( | 1860 ir.Primitive visitSuperSetterInvoke( |
| 1840 ast.Send node, | 1861 ast.Send node, |
| 1841 FunctionElement setter, | 1862 FunctionElement setter, |
| 1842 ast.NodeList arguments, | 1863 ast.NodeList arguments, |
| 1843 CallStructure callStructure, _) { | 1864 CallStructure callStructure, _) { |
| 1844 List<ir.Primitive> args = | 1865 List<ir.Primitive> args = |
| 1845 translateDynamicArguments(arguments, callStructure); | 1866 translateDynamicArguments(arguments, callStructure); |
| 1846 Name name = new Name(setter.name, setter.library); | 1867 Name name = new Name(setter.name, setter.library); |
| 1847 Selector selector = useSelectorTypeOfNode( | 1868 return buildInstanceNoSuchMethod( |
| 1848 new Selector(SelectorKind.CALL, name, callStructure), | 1869 new Selector(SelectorKind.CALL, name, callStructure), |
| 1849 node); | 1870 elements.getTypeMask(node), |
| 1850 return buildInstanceNoSuchMethod(selector, args); | 1871 args); |
| 1851 } | 1872 } |
| 1852 | 1873 |
| 1853 ir.FunctionDefinition nullIfGiveup(ir.FunctionDefinition action()) { | 1874 ir.FunctionDefinition nullIfGiveup(ir.FunctionDefinition action()) { |
| 1854 try { | 1875 try { |
| 1855 return action(); | 1876 return action(); |
| 1856 } catch(e) { | 1877 } catch(e) { |
| 1857 if (e == ABORT_IRNODE_BUILDER) { | 1878 if (e == ABORT_IRNODE_BUILDER) { |
| 1858 return null; | 1879 return null; |
| 1859 } | 1880 } |
| 1860 rethrow; | 1881 rethrow; |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2758 ir.Primitive argumentList = irBuilder.buildListLiteral(null, arguments); | 2779 ir.Primitive argumentList = irBuilder.buildListLiteral(null, arguments); |
| 2759 ir.Primitive expectedArgumentNames = irBuilder.buildNullConstant(); | 2780 ir.Primitive expectedArgumentNames = irBuilder.buildNullConstant(); |
| 2760 return irBuilder.buildStaticFunctionInvocation( | 2781 return irBuilder.buildStaticFunctionInvocation( |
| 2761 thrower, | 2782 thrower, |
| 2762 new CallStructure.unnamed(4), | 2783 new CallStructure.unnamed(4), |
| 2763 [receiver, name, argumentList, expectedArgumentNames]); | 2784 [receiver, name, argumentList, expectedArgumentNames]); |
| 2764 } | 2785 } |
| 2765 | 2786 |
| 2766 @override | 2787 @override |
| 2767 ir.Primitive buildInstanceNoSuchMethod(Selector selector, | 2788 ir.Primitive buildInstanceNoSuchMethod(Selector selector, |
| 2789 TypeMask mask, |
| 2768 List<ir.Primitive> arguments) { | 2790 List<ir.Primitive> arguments) { |
| 2769 return irBuilder.buildDynamicInvocation( | 2791 return irBuilder.buildDynamicInvocation( |
| 2770 irBuilder.buildThis(), | 2792 irBuilder.buildThis(), |
| 2771 useSelectorType(compiler.noSuchMethodSelector, selector), | 2793 compiler.noSuchMethodSelector, |
| 2794 mask, |
| 2772 [irBuilder.buildInvocationMirror(selector, arguments)]); | 2795 [irBuilder.buildInvocationMirror(selector, arguments)]); |
| 2773 } | 2796 } |
| 2774 | 2797 |
| 2775 @override | 2798 @override |
| 2776 ir.Primitive buildRuntimeError(String message) { | 2799 ir.Primitive buildRuntimeError(String message) { |
| 2777 return irBuilder.buildStaticFunctionInvocation( | 2800 return irBuilder.buildStaticFunctionInvocation( |
| 2778 backend.getThrowRuntimeError(), | 2801 backend.getThrowRuntimeError(), |
| 2779 new CallStructure.unnamed(1), | 2802 new CallStructure.unnamed(1), |
| 2780 [irBuilder.buildStringConstant(message)]); | 2803 [irBuilder.buildStringConstant(message)]); |
| 2781 } | 2804 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2857 } | 2880 } |
| 2858 | 2881 |
| 2859 processSetStatic(ir.SetStatic node) { | 2882 processSetStatic(ir.SetStatic node) { |
| 2860 node.body = replacementFor(node.body); | 2883 node.body = replacementFor(node.body); |
| 2861 } | 2884 } |
| 2862 | 2885 |
| 2863 processContinuation(ir.Continuation node) { | 2886 processContinuation(ir.Continuation node) { |
| 2864 node.body = replacementFor(node.body); | 2887 node.body = replacementFor(node.body); |
| 2865 } | 2888 } |
| 2866 } | 2889 } |
| OLD | NEW |