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