| 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(identifier), |
| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.Send node, | 751 ir.Primitive translateBinary(ast.Send node, |
| 766 ast.Node left, | 752 ast.Node left, |
| 767 op.BinaryOperator operator, | 753 op.BinaryOperator operator, |
| 768 ast.Node right) { | 754 ast.Node right) { |
| 769 Selector selector = useSelectorTypeOfNode( | 755 Selector selector = new Selector.binaryOperator(operator.selectorName); |
| 770 new Selector.binaryOperator(operator.selectorName), | |
| 771 node); | |
| 772 ir.Primitive receiver = visit(left); | 756 ir.Primitive receiver = visit(left); |
| 773 List<ir.Primitive> arguments = <ir.Primitive>[visit(right)]; | 757 List<ir.Primitive> arguments = <ir.Primitive>[visit(right)]; |
| 774 arguments = normalizeDynamicArguments(selector.callStructure, arguments); | 758 arguments = normalizeDynamicArguments(selector.callStructure, arguments); |
| 775 return irBuilder.buildDynamicInvocation(receiver, selector, arguments); | 759 return irBuilder.buildDynamicInvocation( |
| 760 receiver, selector, elements.getTypeMask(node), arguments); |
| 776 } | 761 } |
| 777 | 762 |
| 778 @override | 763 @override |
| 779 ir.Primitive visitBinary(ast.Send node, | 764 ir.Primitive visitBinary(ast.Send node, |
| 780 ast.Node left, | 765 ast.Node left, |
| 781 op.BinaryOperator operator, | 766 op.BinaryOperator operator, |
| 782 ast.Node right, _) { | 767 ast.Node right, _) { |
| 783 return translateBinary(node, left, operator, right); | 768 return translateBinary(node, left, operator, right); |
| 784 } | 769 } |
| 785 | 770 |
| 786 @override | 771 @override |
| 787 ir.Primitive visitIndex(ast.Send node, | 772 ir.Primitive visitIndex(ast.Send node, |
| 788 ast.Node receiver, | 773 ast.Node receiver, |
| 789 ast.Node index, _) { | 774 ast.Node index, _) { |
| 790 Selector selector = useSelectorTypeOfNode(new Selector.index(), node); | 775 Selector selector = new Selector.index(); |
| 791 ir.Primitive target = visit(receiver); | 776 ir.Primitive target = visit(receiver); |
| 792 List<ir.Primitive> arguments = <ir.Primitive>[visit(index)]; | 777 List<ir.Primitive> arguments = <ir.Primitive>[visit(index)]; |
| 793 arguments = normalizeDynamicArguments(selector.callStructure, arguments); | 778 arguments = normalizeDynamicArguments(selector.callStructure, arguments); |
| 794 return irBuilder.buildDynamicInvocation(target, selector, arguments); | 779 return irBuilder.buildDynamicInvocation( |
| 780 target, selector, elements.getTypeMask(node), arguments); |
| 795 } | 781 } |
| 796 | 782 |
| 797 ir.Primitive translateSuperBinary(FunctionElement function, | 783 ir.Primitive translateSuperBinary(FunctionElement function, |
| 798 op.BinaryOperator operator, | 784 op.BinaryOperator operator, |
| 799 ast.Node argument) { | 785 ast.Node argument) { |
| 800 CallStructure callStructure = CallStructure.ONE_ARG; | 786 CallStructure callStructure = CallStructure.ONE_ARG; |
| 801 List<ir.Primitive> arguments = <ir.Primitive>[visit(argument)]; | 787 List<ir.Primitive> arguments = <ir.Primitive>[visit(argument)]; |
| 802 arguments = normalizeDynamicArguments(callStructure, arguments); | 788 arguments = normalizeDynamicArguments(callStructure, arguments); |
| 803 return irBuilder.buildSuperMethodInvocation( | 789 return irBuilder.buildSuperMethodInvocation( |
| 804 function, callStructure, arguments); | 790 function, callStructure, arguments); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 return irBuilder.buildNegation( | 854 return irBuilder.buildNegation( |
| 869 translateSuperBinary(function, op.BinaryOperator.NOT_EQ, argument)); | 855 translateSuperBinary(function, op.BinaryOperator.NOT_EQ, argument)); |
| 870 } | 856 } |
| 871 | 857 |
| 872 @override | 858 @override |
| 873 ir.Primitive visitUnary(ast.Send node, | 859 ir.Primitive visitUnary(ast.Send node, |
| 874 op.UnaryOperator operator, ast.Node expression, _) { | 860 op.UnaryOperator operator, ast.Node expression, _) { |
| 875 // TODO(johnniwinther): Clean up the creation of selectors. | 861 // TODO(johnniwinther): Clean up the creation of selectors. |
| 876 Selector selector = operator.selector; | 862 Selector selector = operator.selector; |
| 877 ir.Primitive receiver = translateReceiver(expression); | 863 ir.Primitive receiver = translateReceiver(expression); |
| 878 return irBuilder.buildDynamicInvocation(receiver, selector, const []); | 864 return irBuilder.buildDynamicInvocation( |
| 865 receiver, selector, elements.getTypeMask(node), const []); |
| 879 } | 866 } |
| 880 | 867 |
| 881 @override | 868 @override |
| 882 ir.Primitive visitSuperUnary( | 869 ir.Primitive visitSuperUnary( |
| 883 ast.Send node, | 870 ast.Send node, |
| 884 op.UnaryOperator operator, | 871 op.UnaryOperator operator, |
| 885 FunctionElement function, | 872 FunctionElement function, |
| 886 _) { | 873 _) { |
| 887 return irBuilder.buildSuperMethodInvocation( | 874 return irBuilder.buildSuperMethodInvocation( |
| 888 function, CallStructure.NO_ARGS, const []); | 875 function, CallStructure.NO_ARGS, const []); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 } | 912 } |
| 926 | 913 |
| 927 @override | 914 @override |
| 928 ir.Primitive handleDynamicInvoke( | 915 ir.Primitive handleDynamicInvoke( |
| 929 ast.Send node, | 916 ast.Send node, |
| 930 ast.Node receiver, | 917 ast.Node receiver, |
| 931 ast.NodeList arguments, | 918 ast.NodeList arguments, |
| 932 Selector selector, | 919 Selector selector, |
| 933 _) { | 920 _) { |
| 934 return irBuilder.buildDynamicInvocation( | 921 return irBuilder.buildDynamicInvocation( |
| 935 translateReceiver(receiver), selector, | 922 translateReceiver(receiver), selector, elements.getTypeMask(node), |
| 936 translateDynamicArguments(arguments, selector.callStructure)); | 923 translateDynamicArguments(arguments, selector.callStructure)); |
| 937 } | 924 } |
| 938 | 925 |
| 939 @override | 926 @override |
| 940 ir.Primitive visitIfNotNullDynamicPropertyInvoke( | 927 ir.Primitive visitIfNotNullDynamicPropertyInvoke( |
| 941 ast.Send node, | 928 ast.Send node, |
| 942 ast.Node receiver, | 929 ast.Node receiver, |
| 943 ast.NodeList arguments, | 930 ast.NodeList arguments, |
| 944 Selector selector, | 931 Selector selector, |
| 945 _) { | 932 _) { |
| 946 ir.Primitive target = visit(receiver); | 933 ir.Primitive target = visit(receiver); |
| 947 return irBuilder.buildIfNotNullSend( | 934 return irBuilder.buildIfNotNullSend( |
| 948 target, | 935 target, |
| 949 nested(() => irBuilder.buildDynamicInvocation( | 936 nested(() => irBuilder.buildDynamicInvocation( |
| 950 target, selector, | 937 target, selector, elements.getTypeMask(node), |
| 951 translateDynamicArguments(arguments, selector.callStructure)))); | 938 translateDynamicArguments(arguments, selector.callStructure)))); |
| 952 } | 939 } |
| 953 | 940 |
| 954 ir.Primitive handleLocalInvoke( | 941 ir.Primitive handleLocalInvoke( |
| 955 ast.Send node, | 942 ast.Send node, |
| 956 LocalElement element, | 943 LocalElement element, |
| 957 ast.NodeList arguments, | 944 ast.NodeList arguments, |
| 958 CallStructure callStructure, | 945 CallStructure callStructure, |
| 959 _) { | 946 _) { |
| 960 return irBuilder.buildLocalVariableInvocation(element, callStructure, | 947 return irBuilder.buildLocalVariableInvocation(element, callStructure, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 } | 1059 } |
| 1073 | 1060 |
| 1074 @override | 1061 @override |
| 1075 ir.Primitive visitSuperMethodIncompatibleInvoke( | 1062 ir.Primitive visitSuperMethodIncompatibleInvoke( |
| 1076 ast.Send node, | 1063 ast.Send node, |
| 1077 MethodElement method, | 1064 MethodElement method, |
| 1078 ast.NodeList arguments, | 1065 ast.NodeList arguments, |
| 1079 CallStructure callStructure, _) { | 1066 CallStructure callStructure, _) { |
| 1080 return buildInstanceNoSuchMethod( | 1067 return buildInstanceNoSuchMethod( |
| 1081 elements.getSelector(node), | 1068 elements.getSelector(node), |
| 1069 elements.getTypeMask(node), |
| 1082 translateDynamicArguments(arguments, callStructure)); | 1070 translateDynamicArguments(arguments, callStructure)); |
| 1083 } | 1071 } |
| 1084 | 1072 |
| 1085 @override | 1073 @override |
| 1086 ir.Primitive visitUnresolvedSuperInvoke( | 1074 ir.Primitive visitUnresolvedSuperInvoke( |
| 1087 ast.Send node, | 1075 ast.Send node, |
| 1088 Element element, | 1076 Element element, |
| 1089 ast.NodeList arguments, | 1077 ast.NodeList arguments, |
| 1090 Selector selector, _) { | 1078 Selector selector, _) { |
| 1091 return buildInstanceNoSuchMethod( | 1079 return buildInstanceNoSuchMethod( |
| 1092 elements.getSelector(node), | 1080 elements.getSelector(node), |
| 1081 elements.getTypeMask(node), |
| 1093 translateDynamicArguments(arguments, selector.callStructure)); | 1082 translateDynamicArguments(arguments, selector.callStructure)); |
| 1094 } | 1083 } |
| 1095 | 1084 |
| 1096 @override | 1085 @override |
| 1097 ir.Primitive visitThisInvoke( | 1086 ir.Primitive visitThisInvoke( |
| 1098 ast.Send node, | 1087 ast.Send node, |
| 1099 ast.NodeList arguments, | 1088 ast.NodeList arguments, |
| 1100 CallStructure callStructure, | 1089 CallStructure callStructure, |
| 1101 _) { | 1090 _) { |
| 1102 return translateCallInvoke(irBuilder.buildThis(), arguments, callStructure); | 1091 return translateCallInvoke(irBuilder.buildThis(), arguments, callStructure); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1116 } | 1105 } |
| 1117 | 1106 |
| 1118 @override | 1107 @override |
| 1119 ir.Primitive visitIndexSet( | 1108 ir.Primitive visitIndexSet( |
| 1120 ast.SendSet node, | 1109 ast.SendSet node, |
| 1121 ast.Node receiver, | 1110 ast.Node receiver, |
| 1122 ast.Node index, | 1111 ast.Node index, |
| 1123 ast.Node rhs, | 1112 ast.Node rhs, |
| 1124 _) { | 1113 _) { |
| 1125 return irBuilder.buildDynamicIndexSet( | 1114 return irBuilder.buildDynamicIndexSet( |
| 1126 visit(receiver), visit(index), visit(rhs)); | 1115 visit(receiver), elements.getTypeMask(node), visit(index), visit(rhs)); |
| 1127 } | 1116 } |
| 1128 | 1117 |
| 1129 @override | 1118 @override |
| 1130 ir.Primitive visitSuperIndexSet( | 1119 ir.Primitive visitSuperIndexSet( |
| 1131 ast.SendSet node, | 1120 ast.SendSet node, |
| 1132 FunctionElement function, | 1121 FunctionElement function, |
| 1133 ast.Node index, | 1122 ast.Node index, |
| 1134 ast.Node rhs, | 1123 ast.Node rhs, |
| 1135 _) { | 1124 _) { |
| 1136 return irBuilder.buildSuperIndexSet(function, visit(index), visit(rhs)); | 1125 return irBuilder.buildSuperIndexSet(function, visit(index), visit(rhs)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1156 new Selector.binaryOperator(operator.selectorName); | 1145 new Selector.binaryOperator(operator.selectorName); |
| 1157 ir.Primitive rhsValue; | 1146 ir.Primitive rhsValue; |
| 1158 if (rhs.kind == CompoundKind.ASSIGNMENT) { | 1147 if (rhs.kind == CompoundKind.ASSIGNMENT) { |
| 1159 rhsValue = visit(rhs.rhs); | 1148 rhsValue = visit(rhs.rhs); |
| 1160 } else { | 1149 } else { |
| 1161 rhsValue = irBuilder.buildIntegerConstant(1); | 1150 rhsValue = irBuilder.buildIntegerConstant(1); |
| 1162 } | 1151 } |
| 1163 List<ir.Primitive> arguments = <ir.Primitive>[rhsValue]; | 1152 List<ir.Primitive> arguments = <ir.Primitive>[rhsValue]; |
| 1164 arguments = normalizeDynamicArguments( | 1153 arguments = normalizeDynamicArguments( |
| 1165 operatorSelector.callStructure, arguments); | 1154 operatorSelector.callStructure, arguments); |
| 1155 // TODO(johnniwinther): Find the type mask for the operation. |
| 1166 ir.Primitive result = | 1156 ir.Primitive result = |
| 1167 irBuilder.buildDynamicInvocation(value, operatorSelector, arguments); | 1157 irBuilder.buildDynamicInvocation( |
| 1158 value, operatorSelector, null, arguments); |
| 1168 setValue(result); | 1159 setValue(result); |
| 1169 return rhs.kind == CompoundKind.POSTFIX ? value : result; | 1160 return rhs.kind == CompoundKind.POSTFIX ? value : result; |
| 1170 } | 1161 } |
| 1171 | 1162 |
| 1172 @override | 1163 @override |
| 1173 ir.Primitive handleDynamicSet( | 1164 ir.Primitive handleDynamicSet( |
| 1174 ast.SendSet node, | 1165 ast.SendSet node, |
| 1175 ast.Node receiver, | 1166 ast.Node receiver, |
| 1176 Selector selector, | 1167 Selector selector, |
| 1177 ast.Node rhs, | 1168 ast.Node rhs, |
| 1178 _) { | 1169 _) { |
| 1179 return irBuilder.buildDynamicSet( | 1170 return irBuilder.buildDynamicSet( |
| 1180 translateReceiver(receiver), | 1171 translateReceiver(receiver), |
| 1181 selector, | 1172 selector, |
| 1173 elements.getTypeMask(node), |
| 1182 visit(rhs)); | 1174 visit(rhs)); |
| 1183 } | 1175 } |
| 1184 | 1176 |
| 1185 @override | 1177 @override |
| 1186 ir.Primitive visitIfNotNullDynamicPropertySet( | 1178 ir.Primitive visitIfNotNullDynamicPropertySet( |
| 1187 ast.SendSet node, | 1179 ast.SendSet node, |
| 1188 ast.Node receiver, | 1180 ast.Node receiver, |
| 1189 Selector selector, | 1181 Selector selector, |
| 1190 ast.Node rhs, | 1182 ast.Node rhs, |
| 1191 _) { | 1183 _) { |
| 1192 ir.Primitive target = visit(receiver); | 1184 ir.Primitive target = visit(receiver); |
| 1193 return irBuilder.buildIfNotNullSend( | 1185 return irBuilder.buildIfNotNullSend( |
| 1194 target, | 1186 target, |
| 1195 nested(() => irBuilder.buildDynamicSet(target, selector, visit(rhs)))); | 1187 nested(() => irBuilder.buildDynamicSet( |
| 1188 target, selector, elements.getTypeMask(node), visit(rhs)))); |
| 1196 } | 1189 } |
| 1197 | 1190 |
| 1198 @override | 1191 @override |
| 1199 ir.Primitive handleLocalSet( | 1192 ir.Primitive handleLocalSet( |
| 1200 ast.SendSet node, | 1193 ast.SendSet node, |
| 1201 LocalElement element, | 1194 LocalElement element, |
| 1202 ast.Node rhs, | 1195 ast.Node rhs, |
| 1203 _) { | 1196 _) { |
| 1204 return irBuilder.buildLocalVariableSet(element, visit(rhs)); | 1197 return irBuilder.buildLocalVariableSet(element, visit(rhs)); |
| 1205 } | 1198 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 CompoundRhs rhs, | 1250 CompoundRhs rhs, |
| 1258 arg) { | 1251 arg) { |
| 1259 return translateCompounds( | 1252 return translateCompounds( |
| 1260 getValue: () => buildConstant(constant), | 1253 getValue: () => buildConstant(constant), |
| 1261 rhs: rhs, | 1254 rhs: rhs, |
| 1262 setValue: (value) {}); // The binary operator will throw before this. | 1255 setValue: (value) {}); // The binary operator will throw before this. |
| 1263 } | 1256 } |
| 1264 | 1257 |
| 1265 @override | 1258 @override |
| 1266 ir.Primitive handleDynamicCompounds( | 1259 ir.Primitive handleDynamicCompounds( |
| 1267 ast.Send node, | 1260 ast.SendSet node, |
| 1268 ast.Node receiver, | 1261 ast.Node receiver, |
| 1269 CompoundRhs rhs, | 1262 CompoundRhs rhs, |
| 1270 Selector getterSelector, | 1263 Selector getterSelector, |
| 1271 Selector setterSelector, | 1264 Selector setterSelector, |
| 1272 arg) { | 1265 arg) { |
| 1273 ir.Primitive target = translateReceiver(receiver); | 1266 ir.Primitive target = translateReceiver(receiver); |
| 1274 ir.Primitive helper() { | 1267 ir.Primitive helper() { |
| 1275 return translateCompounds( | 1268 return translateCompounds( |
| 1276 getValue: () => irBuilder.buildDynamicGet(target, getterSelector), | 1269 getValue: () => irBuilder.buildDynamicGet( |
| 1270 target, |
| 1271 getterSelector, |
| 1272 elements.getGetterTypeMaskInComplexSendSet(node)), |
| 1277 rhs: rhs, | 1273 rhs: rhs, |
| 1278 setValue: (ir.Primitive result) { | 1274 setValue: (ir.Primitive result) { |
| 1279 irBuilder.buildDynamicSet(target, setterSelector, result); | 1275 irBuilder.buildDynamicSet( |
| 1276 target, setterSelector, elements.getTypeMask(node), result); |
| 1280 }); | 1277 }); |
| 1281 } | 1278 } |
| 1282 return node.isConditional | 1279 return node.isConditional |
| 1283 ? irBuilder.buildIfNotNullSend(target, nested(helper)) | 1280 ? irBuilder.buildIfNotNullSend(target, nested(helper)) |
| 1284 : helper(); | 1281 : helper(); |
| 1285 } | 1282 } |
| 1286 | 1283 |
| 1287 ir.Primitive buildLocalNoSuchSetter(Local local, ir.Primitive value) { | 1284 ir.Primitive buildLocalNoSuchSetter(Local local, ir.Primitive value) { |
| 1288 Selector selector = new Selector.setter(local.name, null); | 1285 Selector selector = new Selector.setter(local.name, null); |
| 1289 return buildStaticNoSuchMethod(selector, [value]); | 1286 return buildStaticNoSuchMethod(selector, [value]); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 case CompoundSetter.SETTER: | 1354 case CompoundSetter.SETTER: |
| 1358 return irBuilder.buildStaticSetterSet(setter, result); | 1355 return irBuilder.buildStaticSetterSet(setter, result); |
| 1359 case CompoundSetter.INVALID: | 1356 case CompoundSetter.INVALID: |
| 1360 // TODO(johnniwinther): Ensure [setter] is non null. | 1357 // TODO(johnniwinther): Ensure [setter] is non null. |
| 1361 return buildStaticNoSuchSetter( | 1358 return buildStaticNoSuchSetter( |
| 1362 setter != null ? setter : getter, result); | 1359 setter != null ? setter : getter, result); |
| 1363 } | 1360 } |
| 1364 }); | 1361 }); |
| 1365 } | 1362 } |
| 1366 | 1363 |
| 1367 ir.Primitive buildSuperNoSuchGetter(Element element) { | 1364 ir.Primitive buildSuperNoSuchGetter(Element element, TypeMask mask) { |
| 1368 return buildInstanceNoSuchMethod( | 1365 return buildInstanceNoSuchMethod( |
| 1369 new Selector.getter(element.name, element.library), | 1366 new Selector.getter(element.name, element.library), |
| 1367 mask, |
| 1370 const <ir.Primitive>[]); | 1368 const <ir.Primitive>[]); |
| 1371 } | 1369 } |
| 1372 | 1370 |
| 1373 ir.Primitive buildSuperNoSuchSetter(Element element, ir.Primitive value) { | 1371 ir.Primitive buildSuperNoSuchSetter(Element element, |
| 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, |
| 1376 <ir.Primitive>[value]); | 1377 <ir.Primitive>[value]); |
| 1377 } | 1378 } |
| 1378 | 1379 |
| 1379 @override | 1380 @override |
| 1380 ir.Primitive handleSuperCompounds( | 1381 ir.Primitive handleSuperCompounds( |
| 1381 ast.SendSet node, | 1382 ast.SendSet node, |
| 1382 Element getter, | 1383 Element getter, |
| 1383 CompoundGetter getterKind, | 1384 CompoundGetter getterKind, |
| 1384 Element setter, | 1385 Element setter, |
| 1385 CompoundSetter setterKind, | 1386 CompoundSetter setterKind, |
| 1386 CompoundRhs rhs, | 1387 CompoundRhs rhs, |
| 1387 arg) { | 1388 arg) { |
| 1388 return translateCompounds( | 1389 return translateCompounds( |
| 1389 getValue: () { | 1390 getValue: () { |
| 1390 switch (getterKind) { | 1391 switch (getterKind) { |
| 1391 case CompoundGetter.FIELD: | 1392 case CompoundGetter.FIELD: |
| 1392 return irBuilder.buildSuperFieldGet(getter); | 1393 return irBuilder.buildSuperFieldGet(getter); |
| 1393 case CompoundGetter.GETTER: | 1394 case CompoundGetter.GETTER: |
| 1394 return irBuilder.buildSuperGetterGet(getter); | 1395 return irBuilder.buildSuperGetterGet(getter); |
| 1395 case CompoundGetter.METHOD: | 1396 case CompoundGetter.METHOD: |
| 1396 return irBuilder.buildSuperMethodGet(getter); | 1397 return irBuilder.buildSuperMethodGet(getter); |
| 1397 case CompoundGetter.UNRESOLVED: | 1398 case CompoundGetter.UNRESOLVED: |
| 1398 // TODO(johnniwinther): Ensure [getter] is not null. | 1399 // TODO(johnniwinther): Ensure [getter] is not null. |
| 1399 return buildSuperNoSuchGetter(getter != null ? getter : setter); | 1400 return buildSuperNoSuchGetter( |
| 1401 getter != null ? getter : setter, |
| 1402 elements.getGetterTypeMaskInComplexSendSet(node)); |
| 1400 } | 1403 } |
| 1401 }, | 1404 }, |
| 1402 rhs: rhs, | 1405 rhs: rhs, |
| 1403 setValue: (ir.Primitive result) { | 1406 setValue: (ir.Primitive result) { |
| 1404 switch (setterKind) { | 1407 switch (setterKind) { |
| 1405 case CompoundSetter.FIELD: | 1408 case CompoundSetter.FIELD: |
| 1406 return irBuilder.buildSuperFieldSet(setter, result); | 1409 return irBuilder.buildSuperFieldSet(setter, result); |
| 1407 case CompoundSetter.SETTER: | 1410 case CompoundSetter.SETTER: |
| 1408 return irBuilder.buildSuperSetterSet(setter, result); | 1411 return irBuilder.buildSuperSetterSet(setter, result); |
| 1409 case CompoundSetter.INVALID: | 1412 case CompoundSetter.INVALID: |
| 1410 return buildSuperNoSuchSetter(setter, result); | 1413 return buildSuperNoSuchSetter( |
| 1414 setter, elements.getTypeMask(node), result); |
| 1411 } | 1415 } |
| 1412 }); | 1416 }); |
| 1413 } | 1417 } |
| 1414 | 1418 |
| 1415 @override | 1419 @override |
| 1416 ir.Primitive handleTypeVariableTypeLiteralCompounds( | 1420 ir.Primitive handleTypeVariableTypeLiteralCompounds( |
| 1417 ast.SendSet node, | 1421 ast.SendSet node, |
| 1418 TypeVariableElement typeVariable, | 1422 TypeVariableElement typeVariable, |
| 1419 CompoundRhs rhs, | 1423 CompoundRhs rhs, |
| 1420 arg) { | 1424 arg) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1432 CompoundRhs rhs, | 1436 CompoundRhs rhs, |
| 1433 arg) { | 1437 arg) { |
| 1434 ir.Primitive target = visit(receiver); | 1438 ir.Primitive target = visit(receiver); |
| 1435 ir.Primitive indexValue = visit(index); | 1439 ir.Primitive indexValue = visit(index); |
| 1436 return translateCompounds( | 1440 return translateCompounds( |
| 1437 getValue: () { | 1441 getValue: () { |
| 1438 Selector selector = new Selector.index(); | 1442 Selector selector = new Selector.index(); |
| 1439 List<ir.Primitive> arguments = <ir.Primitive>[indexValue]; | 1443 List<ir.Primitive> arguments = <ir.Primitive>[indexValue]; |
| 1440 arguments = | 1444 arguments = |
| 1441 normalizeDynamicArguments(selector.callStructure, arguments); | 1445 normalizeDynamicArguments(selector.callStructure, arguments); |
| 1442 return irBuilder.buildDynamicInvocation(target, selector, arguments); | 1446 return irBuilder.buildDynamicInvocation( |
| 1447 target, |
| 1448 selector, |
| 1449 elements.getGetterTypeMaskInComplexSendSet(node), |
| 1450 arguments); |
| 1443 }, | 1451 }, |
| 1444 rhs: rhs, | 1452 rhs: rhs, |
| 1445 setValue: (ir.Primitive result) { | 1453 setValue: (ir.Primitive result) { |
| 1446 irBuilder.buildDynamicIndexSet(target, indexValue, result); | 1454 irBuilder.buildDynamicIndexSet( |
| 1455 target, |
| 1456 elements.getTypeMask(node), |
| 1457 indexValue, |
| 1458 result); |
| 1447 }); | 1459 }); |
| 1448 } | 1460 } |
| 1449 | 1461 |
| 1450 @override | 1462 @override |
| 1451 ir.Primitive handleSuperIndexCompounds( | 1463 ir.Primitive handleSuperIndexCompounds( |
| 1452 ast.SendSet node, | 1464 ast.SendSet node, |
| 1453 Element indexFunction, | 1465 Element indexFunction, |
| 1454 Element indexSetFunction, | 1466 Element indexSetFunction, |
| 1455 ast.Node index, | 1467 ast.Node index, |
| 1456 CompoundRhs rhs, | 1468 CompoundRhs rhs, |
| 1457 arg, | 1469 arg, |
| 1458 {bool isGetterValid, | 1470 {bool isGetterValid, |
| 1459 bool isSetterValid}) { | 1471 bool isSetterValid}) { |
| 1460 ir.Primitive indexValue = visit(index); | 1472 ir.Primitive indexValue = visit(index); |
| 1461 return translateCompounds( | 1473 return translateCompounds( |
| 1462 getValue: () { | 1474 getValue: () { |
| 1463 if (isGetterValid) { | 1475 if (isGetterValid) { |
| 1464 return irBuilder.buildSuperIndex(indexFunction, indexValue); | 1476 return irBuilder.buildSuperIndex(indexFunction, indexValue); |
| 1465 } else { | 1477 } else { |
| 1466 return buildInstanceNoSuchMethod( | 1478 return buildInstanceNoSuchMethod( |
| 1467 new Selector.index(), <ir.Primitive>[indexValue]); | 1479 new Selector.index(), |
| 1480 elements.getGetterTypeMaskInComplexSendSet(node), |
| 1481 <ir.Primitive>[indexValue]); |
| 1468 } | 1482 } |
| 1469 }, | 1483 }, |
| 1470 rhs: rhs, | 1484 rhs: rhs, |
| 1471 setValue: (ir.Primitive result) { | 1485 setValue: (ir.Primitive result) { |
| 1472 if (isSetterValid) { | 1486 if (isSetterValid) { |
| 1473 irBuilder.buildSuperIndexSet(indexSetFunction, indexValue, result); | 1487 irBuilder.buildSuperIndexSet(indexSetFunction, indexValue, result); |
| 1474 } else { | 1488 } else { |
| 1475 buildInstanceNoSuchMethod( | 1489 buildInstanceNoSuchMethod( |
| 1476 new Selector.indexSet(), <ir.Primitive>[indexValue, result]); | 1490 new Selector.indexSet(), |
| 1491 elements.getTypeMask(node), |
| 1492 <ir.Primitive>[indexValue, result]); |
| 1477 } | 1493 } |
| 1478 }); | 1494 }); |
| 1479 } | 1495 } |
| 1480 | 1496 |
| 1481 ir.Primitive visitStringJuxtaposition(ast.StringJuxtaposition node) { | 1497 ir.Primitive visitStringJuxtaposition(ast.StringJuxtaposition node) { |
| 1482 assert(irBuilder.isOpen); | 1498 assert(irBuilder.isOpen); |
| 1483 ir.Primitive first = visit(node.first); | 1499 ir.Primitive first = visit(node.first); |
| 1484 ir.Primitive second = visit(node.second); | 1500 ir.Primitive second = visit(node.second); |
| 1485 return irBuilder.buildStringConcatenation([first, second]); | 1501 return irBuilder.buildStringConcatenation([first, second]); |
| 1486 } | 1502 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1509 // statements. | 1525 // statements. |
| 1510 return irBuilder.buildNonTailThrow(visit(node.expression)); | 1526 return irBuilder.buildNonTailThrow(visit(node.expression)); |
| 1511 } | 1527 } |
| 1512 | 1528 |
| 1513 ir.Primitive buildStaticNoSuchMethod( | 1529 ir.Primitive buildStaticNoSuchMethod( |
| 1514 Selector selector, | 1530 Selector selector, |
| 1515 List<ir.Primitive> arguments); | 1531 List<ir.Primitive> arguments); |
| 1516 | 1532 |
| 1517 ir.Primitive buildInstanceNoSuchMethod( | 1533 ir.Primitive buildInstanceNoSuchMethod( |
| 1518 Selector selector, | 1534 Selector selector, |
| 1535 TypeMask mask, |
| 1519 List<ir.Primitive> arguments); | 1536 List<ir.Primitive> arguments); |
| 1520 | 1537 |
| 1521 ir.Primitive buildRuntimeError(String message); | 1538 ir.Primitive buildRuntimeError(String message); |
| 1522 | 1539 |
| 1523 ir.Primitive buildAbstractClassInstantiationError(ClassElement element); | 1540 ir.Primitive buildAbstractClassInstantiationError(ClassElement element); |
| 1524 | 1541 |
| 1525 @override | 1542 @override |
| 1526 ir.Primitive errorInvalidAssert( | 1543 ir.Primitive errorInvalidAssert( |
| 1527 ast.Send node, | 1544 ast.Send node, |
| 1528 ast.NodeList arguments, _) { | 1545 ast.NodeList arguments, _) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 ast.Node rhs, _) { | 1644 ast.Node rhs, _) { |
| 1628 return buildStaticNoSuchMethod(elements.getSelector(node), [visit(rhs)]); | 1645 return buildStaticNoSuchMethod(elements.getSelector(node), [visit(rhs)]); |
| 1629 } | 1646 } |
| 1630 | 1647 |
| 1631 @override | 1648 @override |
| 1632 ir.Primitive visitUnresolvedSuperIndex( | 1649 ir.Primitive visitUnresolvedSuperIndex( |
| 1633 ast.Send node, | 1650 ast.Send node, |
| 1634 Element function, | 1651 Element function, |
| 1635 ast.Node index, _) { | 1652 ast.Node index, _) { |
| 1636 // Assume the index getter is missing. | 1653 // Assume the index getter is missing. |
| 1637 Selector selector = useSelectorTypeOfNode(new Selector.index(), node); | 1654 return buildInstanceNoSuchMethod( |
| 1638 return buildInstanceNoSuchMethod(selector, [visit(index)]); | 1655 new Selector.index(), elements.getTypeMask(node), [visit(index)]); |
| 1639 } | 1656 } |
| 1640 | 1657 |
| 1641 @override | 1658 @override |
| 1642 ir.Primitive visitUnresolvedSuperBinary( | 1659 ir.Primitive visitUnresolvedSuperBinary( |
| 1643 ast.Send node, | 1660 ast.Send node, |
| 1644 Element element, | 1661 Element element, |
| 1645 op.BinaryOperator operator, | 1662 op.BinaryOperator operator, |
| 1646 ast.Node argument, _) { | 1663 ast.Node argument, _) { |
| 1647 return buildInstanceNoSuchMethod( | 1664 return buildInstanceNoSuchMethod( |
| 1648 elements.getSelector(node), | 1665 elements.getSelector(node), |
| 1666 elements.getTypeMask(node), |
| 1649 [visit(argument)]); | 1667 [visit(argument)]); |
| 1650 } | 1668 } |
| 1651 | 1669 |
| 1652 @override | 1670 @override |
| 1653 ir.Primitive visitUnresolvedSuperUnary( | 1671 ir.Primitive visitUnresolvedSuperUnary( |
| 1654 ast.Send node, | 1672 ast.Send node, |
| 1655 op.UnaryOperator operator, | 1673 op.UnaryOperator operator, |
| 1656 Element element, _) { | 1674 Element element, _) { |
| 1657 return buildInstanceNoSuchMethod(elements.getSelector(node), []); | 1675 return buildInstanceNoSuchMethod( |
| 1676 elements.getSelector(node), elements.getTypeMask(node), []); |
| 1658 } | 1677 } |
| 1659 | 1678 |
| 1660 @override | 1679 @override |
| 1661 ir.Primitive errorUndefinedBinaryExpression( | 1680 ir.Primitive errorUndefinedBinaryExpression( |
| 1662 ast.Send node, | 1681 ast.Send node, |
| 1663 ast.Node left, | 1682 ast.Node left, |
| 1664 ast.Operator operator, | 1683 ast.Operator operator, |
| 1665 ast.Node right, _) { | 1684 ast.Node right, _) { |
| 1666 assert(compiler.compilationFailed); | 1685 assert(compiler.compilationFailed); |
| 1667 return irBuilder.buildNullConstant(); | 1686 return irBuilder.buildNullConstant(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 return buildStaticNoSuchMethod( | 1754 return buildStaticNoSuchMethod( |
| 1736 new Selector.setter(field.name, field.library), | 1755 new Selector.setter(field.name, field.library), |
| 1737 [visit(rhs)]); | 1756 [visit(rhs)]); |
| 1738 } | 1757 } |
| 1739 | 1758 |
| 1740 @override | 1759 @override |
| 1741 ir.Primitive visitFinalSuperFieldSet( | 1760 ir.Primitive visitFinalSuperFieldSet( |
| 1742 ast.SendSet node, | 1761 ast.SendSet node, |
| 1743 FieldElement field, | 1762 FieldElement field, |
| 1744 ast.Node rhs, _) { | 1763 ast.Node rhs, _) { |
| 1745 Selector selector = useSelectorTypeOfNode( | 1764 return buildInstanceNoSuchMethod( |
| 1746 new Selector.setter(field.name, field.library), | 1765 new Selector.setter(field.name, field.library), |
| 1747 node); | 1766 elements.getTypeMask(node), |
| 1748 return buildInstanceNoSuchMethod(selector, [visit(rhs)]); | 1767 [visit(rhs)]); |
| 1749 } | 1768 } |
| 1750 | 1769 |
| 1751 @override | 1770 @override |
| 1752 ir.Primitive handleImmutableLocalSet( | 1771 ir.Primitive handleImmutableLocalSet( |
| 1753 ast.SendSet node, | 1772 ast.SendSet node, |
| 1754 LocalElement local, | 1773 LocalElement local, |
| 1755 ast.Node rhs, _) { | 1774 ast.Node rhs, _) { |
| 1756 return buildStaticNoSuchMethod( | 1775 return buildStaticNoSuchMethod( |
| 1757 new Selector.setter(local.name, null), | 1776 new Selector.setter(local.name, null), |
| 1758 [visit(rhs)]); | 1777 [visit(rhs)]); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 new Selector(SelectorKind.CALL, name, callStructure), | 1822 new Selector(SelectorKind.CALL, name, callStructure), |
| 1804 args); | 1823 args); |
| 1805 } | 1824 } |
| 1806 | 1825 |
| 1807 @override | 1826 @override |
| 1808 ir.Primitive visitSuperGetterSet( | 1827 ir.Primitive visitSuperGetterSet( |
| 1809 ast.SendSet node, | 1828 ast.SendSet node, |
| 1810 FunctionElement getter, | 1829 FunctionElement getter, |
| 1811 ast.Node rhs, | 1830 ast.Node rhs, |
| 1812 _) { | 1831 _) { |
| 1813 Selector selector = useSelectorTypeOfNode( | 1832 return buildInstanceNoSuchMethod( |
| 1814 new Selector.setter(getter.name, getter.library), | 1833 new Selector.setter(getter.name, getter.library), |
| 1815 node); | 1834 elements.getTypeMask(node), |
| 1816 return buildInstanceNoSuchMethod(selector, [visit(rhs)]); | 1835 [visit(rhs)]); |
| 1817 } | 1836 } |
| 1818 | 1837 |
| 1819 @override | 1838 @override |
| 1820 ir.Primitive visitSuperMethodSet( | 1839 ir.Primitive visitSuperMethodSet( |
| 1821 ast.Send node, | 1840 ast.Send node, |
| 1822 MethodElement method, | 1841 MethodElement method, |
| 1823 ast.Node rhs, | 1842 ast.Node rhs, |
| 1824 _) { | 1843 _) { |
| 1825 Selector selector = useSelectorTypeOfNode( | 1844 return buildInstanceNoSuchMethod( |
| 1826 new Selector.setter(method.name, method.library), | 1845 new Selector.setter(method.name, method.library), |
| 1827 node); | 1846 elements.getTypeMask(node), |
| 1828 return buildInstanceNoSuchMethod(selector, [visit(rhs)]); | 1847 [visit(rhs)]); |
| 1829 } | 1848 } |
| 1830 | 1849 |
| 1831 @override | 1850 @override |
| 1832 ir.Primitive visitSuperSetterGet( | 1851 ir.Primitive visitSuperSetterGet( |
| 1833 ast.Send node, | 1852 ast.Send node, |
| 1834 FunctionElement setter, _) { | 1853 FunctionElement setter, _) { |
| 1835 Selector selector = useSelectorTypeOfNode( | 1854 return buildInstanceNoSuchMethod( |
| 1836 new Selector.setter(setter.name, setter.library), | 1855 new Selector.setter(setter.name, setter.library), |
| 1837 node); | 1856 elements.getTypeMask(node), |
| 1838 return buildInstanceNoSuchMethod(selector, []); | 1857 []); |
| 1839 } | 1858 } |
| 1840 | 1859 |
| 1841 @override | 1860 @override |
| 1842 ir.Primitive visitSuperSetterInvoke( | 1861 ir.Primitive visitSuperSetterInvoke( |
| 1843 ast.Send node, | 1862 ast.Send node, |
| 1844 FunctionElement setter, | 1863 FunctionElement setter, |
| 1845 ast.NodeList arguments, | 1864 ast.NodeList arguments, |
| 1846 CallStructure callStructure, _) { | 1865 CallStructure callStructure, _) { |
| 1847 List<ir.Primitive> args = | 1866 List<ir.Primitive> args = |
| 1848 translateDynamicArguments(arguments, callStructure); | 1867 translateDynamicArguments(arguments, callStructure); |
| 1849 Name name = new Name(setter.name, setter.library); | 1868 Name name = new Name(setter.name, setter.library); |
| 1850 Selector selector = useSelectorTypeOfNode( | 1869 return buildInstanceNoSuchMethod( |
| 1851 new Selector(SelectorKind.CALL, name, callStructure), | 1870 new Selector(SelectorKind.CALL, name, callStructure), |
| 1852 node); | 1871 elements.getTypeMask(node), |
| 1853 return buildInstanceNoSuchMethod(selector, args); | 1872 args); |
| 1854 } | 1873 } |
| 1855 | 1874 |
| 1856 ir.FunctionDefinition nullIfGiveup(ir.FunctionDefinition action()) { | 1875 ir.FunctionDefinition nullIfGiveup(ir.FunctionDefinition action()) { |
| 1857 try { | 1876 try { |
| 1858 return action(); | 1877 return action(); |
| 1859 } catch(e) { | 1878 } catch(e) { |
| 1860 if (e == ABORT_IRNODE_BUILDER) { | 1879 if (e == ABORT_IRNODE_BUILDER) { |
| 1861 return null; | 1880 return null; |
| 1862 } | 1881 } |
| 1863 rethrow; | 1882 rethrow; |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 ir.Primitive argumentList = irBuilder.buildListLiteral(null, arguments); | 2782 ir.Primitive argumentList = irBuilder.buildListLiteral(null, arguments); |
| 2764 ir.Primitive expectedArgumentNames = irBuilder.buildNullConstant(); | 2783 ir.Primitive expectedArgumentNames = irBuilder.buildNullConstant(); |
| 2765 return irBuilder.buildStaticFunctionInvocation( | 2784 return irBuilder.buildStaticFunctionInvocation( |
| 2766 thrower, | 2785 thrower, |
| 2767 new CallStructure.unnamed(4), | 2786 new CallStructure.unnamed(4), |
| 2768 [receiver, name, argumentList, expectedArgumentNames]); | 2787 [receiver, name, argumentList, expectedArgumentNames]); |
| 2769 } | 2788 } |
| 2770 | 2789 |
| 2771 @override | 2790 @override |
| 2772 ir.Primitive buildInstanceNoSuchMethod(Selector selector, | 2791 ir.Primitive buildInstanceNoSuchMethod(Selector selector, |
| 2792 TypeMask mask, |
| 2773 List<ir.Primitive> arguments) { | 2793 List<ir.Primitive> arguments) { |
| 2774 return irBuilder.buildDynamicInvocation( | 2794 return irBuilder.buildDynamicInvocation( |
| 2775 irBuilder.buildThis(), | 2795 irBuilder.buildThis(), |
| 2776 useSelectorType(compiler.noSuchMethodSelector, selector), | 2796 compiler.noSuchMethodSelector, |
| 2797 mask, |
| 2777 [irBuilder.buildInvocationMirror(selector, arguments)]); | 2798 [irBuilder.buildInvocationMirror(selector, arguments)]); |
| 2778 } | 2799 } |
| 2779 | 2800 |
| 2780 @override | 2801 @override |
| 2781 ir.Primitive buildRuntimeError(String message) { | 2802 ir.Primitive buildRuntimeError(String message) { |
| 2782 return irBuilder.buildStaticFunctionInvocation( | 2803 return irBuilder.buildStaticFunctionInvocation( |
| 2783 backend.getThrowRuntimeError(), | 2804 backend.getThrowRuntimeError(), |
| 2784 new CallStructure.unnamed(1), | 2805 new CallStructure.unnamed(1), |
| 2785 [irBuilder.buildStringConstant(message)]); | 2806 [irBuilder.buildStringConstant(message)]); |
| 2786 } | 2807 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2862 } | 2883 } |
| 2863 | 2884 |
| 2864 processSetStatic(ir.SetStatic node) { | 2885 processSetStatic(ir.SetStatic node) { |
| 2865 node.body = replacementFor(node.body); | 2886 node.body = replacementFor(node.body); |
| 2866 } | 2887 } |
| 2867 | 2888 |
| 2868 processContinuation(ir.Continuation node) { | 2889 processContinuation(ir.Continuation node) { |
| 2869 node.body = replacementFor(node.body); | 2890 node.body = replacementFor(node.body); |
| 2870 } | 2891 } |
| 2871 } | 2892 } |
| OLD | NEW |