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 '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/names.dart' show | 10 import '../common/names.dart' show |
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 ast.NodeList arguments, | 1237 ast.NodeList arguments, |
1238 CallStructure callStructure, | 1238 CallStructure callStructure, |
1239 _); | 1239 _); |
1240 | 1240 |
1241 @override | 1241 @override |
1242 ir.Primitive handleStaticFunctionIncompatibleInvoke( | 1242 ir.Primitive handleStaticFunctionIncompatibleInvoke( |
1243 ast.Send node, | 1243 ast.Send node, |
1244 MethodElement function, | 1244 MethodElement function, |
1245 ast.NodeList arguments, | 1245 ast.NodeList arguments, |
1246 CallStructure callStructure, _) { | 1246 CallStructure callStructure, _) { |
1247 return buildStaticNoSuchMethod( | 1247 return irBuilder.buildStaticNoSuchMethod( |
1248 elements.getSelector(node), | 1248 elements.getSelector(node), |
1249 arguments.nodes.mapToList(visit)); | 1249 arguments.nodes.mapToList(visit)); |
1250 } | 1250 } |
1251 | 1251 |
1252 @override | 1252 @override |
1253 ir.Primitive handleStaticGetterInvoke( | 1253 ir.Primitive handleStaticGetterInvoke( |
1254 ast.Send node, | 1254 ast.Send node, |
1255 FunctionElement getter, | 1255 FunctionElement getter, |
1256 ast.NodeList argumentsNode, | 1256 ast.NodeList argumentsNode, |
1257 CallStructure callStructure, | 1257 CallStructure callStructure, |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 }); | 1636 }); |
1637 } | 1637 } |
1638 return node.isConditional | 1638 return node.isConditional |
1639 ? irBuilder.buildIfNotNullSend(target, nested(helper)) | 1639 ? irBuilder.buildIfNotNullSend(target, nested(helper)) |
1640 : helper(); | 1640 : helper(); |
1641 } | 1641 } |
1642 | 1642 |
1643 ir.Primitive buildLocalNoSuchSetter(LocalElement local, ir.Primitive value) { | 1643 ir.Primitive buildLocalNoSuchSetter(LocalElement local, ir.Primitive value) { |
1644 Selector selector = new Selector.setter( | 1644 Selector selector = new Selector.setter( |
1645 new Name(local.name, local.library, isSetter: true)); | 1645 new Name(local.name, local.library, isSetter: true)); |
1646 return buildStaticNoSuchMethod(selector, [value]); | 1646 return irBuilder.buildStaticNoSuchMethod(selector, [value]); |
1647 } | 1647 } |
1648 | 1648 |
1649 @override | 1649 @override |
1650 ir.Primitive handleLocalCompounds( | 1650 ir.Primitive handleLocalCompounds( |
1651 ast.SendSet node, | 1651 ast.SendSet node, |
1652 LocalElement local, | 1652 LocalElement local, |
1653 CompoundRhs rhs, | 1653 CompoundRhs rhs, |
1654 arg, | 1654 arg, |
1655 {bool isSetterValid}) { | 1655 {bool isSetterValid}) { |
1656 return translateCompounds( | 1656 return translateCompounds( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 setValue: (ir.Primitive result) { | 1692 setValue: (ir.Primitive result) { |
1693 if (isSetterValid) { | 1693 if (isSetterValid) { |
1694 irBuilder.buildLocalVariableSet(local, result); | 1694 irBuilder.buildLocalVariableSet(local, result); |
1695 } else { | 1695 } else { |
1696 return buildLocalNoSuchSetter(local, result); | 1696 return buildLocalNoSuchSetter(local, result); |
1697 } | 1697 } |
1698 }); | 1698 }); |
1699 } | 1699 } |
1700 | 1700 |
1701 ir.Primitive buildStaticNoSuchGetter(Element element) { | 1701 ir.Primitive buildStaticNoSuchGetter(Element element) { |
1702 return buildStaticNoSuchMethod( | 1702 return irBuilder.buildStaticNoSuchMethod( |
1703 new Selector.getter(new Name(element.name, element.library)), | 1703 new Selector.getter(new Name(element.name, element.library)), |
1704 const <ir.Primitive>[]); | 1704 const <ir.Primitive>[]); |
1705 } | 1705 } |
1706 | 1706 |
1707 ir.Primitive buildStaticNoSuchSetter(Element element, ir.Primitive value) { | 1707 ir.Primitive buildStaticNoSuchSetter(Element element, ir.Primitive value) { |
1708 return buildStaticNoSuchMethod( | 1708 return irBuilder.buildStaticNoSuchMethod( |
1709 new Selector.setter(new Name(element.name, element.library)), | 1709 new Selector.setter(new Name(element.name, element.library)), |
1710 <ir.Primitive>[value]); | 1710 <ir.Primitive>[value]); |
1711 } | 1711 } |
1712 | 1712 |
1713 @override | 1713 @override |
1714 ir.Primitive handleStaticCompounds( | 1714 ir.Primitive handleStaticCompounds( |
1715 ast.SendSet node, | 1715 ast.SendSet node, |
1716 Element getter, | 1716 Element getter, |
1717 CompoundGetter getterKind, | 1717 CompoundGetter getterKind, |
1718 Element setter, | 1718 Element setter, |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 sourceInformation: sourceInformationBuilder.buildGet(node)); | 2027 sourceInformation: sourceInformationBuilder.buildGet(node)); |
2028 } | 2028 } |
2029 | 2029 |
2030 ir.Primitive visitThrow(ast.Throw node) { | 2030 ir.Primitive visitThrow(ast.Throw node) { |
2031 assert(irBuilder.isOpen); | 2031 assert(irBuilder.isOpen); |
2032 // This function is not called for throw expressions occurring as | 2032 // This function is not called for throw expressions occurring as |
2033 // statements. | 2033 // statements. |
2034 return irBuilder.buildNonTailThrow(visit(node.expression)); | 2034 return irBuilder.buildNonTailThrow(visit(node.expression)); |
2035 } | 2035 } |
2036 | 2036 |
2037 ir.Primitive buildStaticNoSuchMethod( | |
2038 Selector selector, | |
2039 List<ir.Primitive> arguments); | |
2040 | |
2041 ir.Primitive buildInstanceNoSuchMethod( | 2037 ir.Primitive buildInstanceNoSuchMethod( |
2042 Selector selector, | 2038 Selector selector, |
2043 TypeMask mask, | 2039 TypeMask mask, |
2044 List<ir.Primitive> arguments); | 2040 List<ir.Primitive> arguments); |
2045 | 2041 |
2046 ir.Primitive buildRuntimeError(String message); | 2042 ir.Primitive buildRuntimeError(String message); |
2047 | 2043 |
2048 ir.Primitive buildAbstractClassInstantiationError(ClassElement element); | 2044 ir.Primitive buildAbstractClassInstantiationError(ClassElement element); |
2049 | 2045 |
2050 @override | 2046 @override |
2051 ir.Primitive visitUnresolvedCompound( | 2047 ir.Primitive visitUnresolvedCompound( |
2052 ast.Send node, | 2048 ast.Send node, |
2053 Element element, | 2049 Element element, |
2054 op.AssignmentOperator operator, | 2050 op.AssignmentOperator operator, |
2055 ast.Node rhs, _) { | 2051 ast.Node rhs, _) { |
2056 // TODO(asgerf): What is unresolved? The getter and/or the setter? | 2052 // TODO(asgerf): What is unresolved? The getter and/or the setter? |
2057 // If it was the setter, we must evaluate the right-hand side. | 2053 // If it was the setter, we must evaluate the right-hand side. |
2058 return buildStaticNoSuchMethod(elements.getSelector(node), []); | 2054 return irBuilder.buildStaticNoSuchMethod(elements.getSelector(node), []); |
2059 } | 2055 } |
2060 | 2056 |
2061 @override | 2057 @override |
2062 ir.Primitive visitUnresolvedClassConstructorInvoke( | 2058 ir.Primitive visitUnresolvedClassConstructorInvoke( |
2063 ast.NewExpression node, | 2059 ast.NewExpression node, |
2064 Element element, | 2060 Element element, |
2065 DartType type, | 2061 DartType type, |
2066 ast.NodeList arguments, | 2062 ast.NodeList arguments, |
2067 Selector selector, _) { | 2063 Selector selector, _) { |
2068 // If the class is missing it's a runtime error. | 2064 // If the class is missing it's a runtime error. |
2069 return buildRuntimeError("Unresolved class: '${element.name}'"); | 2065 return buildRuntimeError("Unresolved class: '${element.name}'"); |
2070 } | 2066 } |
2071 | 2067 |
2072 @override | 2068 @override |
2073 ir.Primitive visitUnresolvedConstructorInvoke( | 2069 ir.Primitive visitUnresolvedConstructorInvoke( |
2074 ast.NewExpression node, | 2070 ast.NewExpression node, |
2075 Element constructor, | 2071 Element constructor, |
2076 DartType type, | 2072 DartType type, |
2077 ast.NodeList argumentsNode, | 2073 ast.NodeList argumentsNode, |
2078 Selector selector, _) { | 2074 Selector selector, _) { |
2079 // If the class is there but the constructor is missing, it's an NSM error. | 2075 // If the class is there but the constructor is missing, it's an NSM error. |
2080 List<ir.Primitive> arguments = <ir.Primitive>[]; | 2076 List<ir.Primitive> arguments = <ir.Primitive>[]; |
2081 CallStructure callStructure = translateDynamicArguments( | 2077 CallStructure callStructure = translateDynamicArguments( |
2082 argumentsNode, selector.callStructure, arguments); | 2078 argumentsNode, selector.callStructure, arguments); |
2083 return buildStaticNoSuchMethod( | 2079 return irBuilder.buildStaticNoSuchMethod( |
2084 new Selector(selector.kind, selector.memberName, callStructure), | 2080 new Selector(selector.kind, selector.memberName, callStructure), |
2085 arguments); | 2081 arguments); |
2086 } | 2082 } |
2087 | 2083 |
2088 @override | 2084 @override |
2089 ir.Primitive visitConstructorIncompatibleInvoke( | 2085 ir.Primitive visitConstructorIncompatibleInvoke( |
2090 ast.NewExpression node, | 2086 ast.NewExpression node, |
2091 ConstructorElement constructor, | 2087 ConstructorElement constructor, |
2092 DartType type, | 2088 DartType type, |
2093 ast.NodeList argumentsNode, | 2089 ast.NodeList argumentsNode, |
2094 CallStructure callStructure, _) { | 2090 CallStructure callStructure, _) { |
2095 List<ir.Primitive> arguments = <ir.Primitive>[]; | 2091 List<ir.Primitive> arguments = <ir.Primitive>[]; |
2096 callStructure = | 2092 callStructure = |
2097 translateDynamicArguments(argumentsNode, callStructure, arguments); | 2093 translateDynamicArguments(argumentsNode, callStructure, arguments); |
2098 return buildStaticNoSuchMethod( | 2094 return irBuilder.buildStaticNoSuchMethod( |
2099 new Selector.call(constructor.memberName, callStructure), arguments); | 2095 new Selector.call(constructor.memberName, callStructure), arguments); |
2100 } | 2096 } |
2101 | 2097 |
2102 @override | 2098 @override |
2103 ir.Primitive visitUnresolvedGet( | 2099 ir.Primitive visitUnresolvedGet( |
2104 ast.Send node, | 2100 ast.Send node, |
2105 Element element, _) { | 2101 Element element, _) { |
2106 return buildStaticNoSuchMethod(elements.getSelector(node), []); | 2102 return irBuilder.buildStaticNoSuchMethod(elements.getSelector(node), []); |
2107 } | 2103 } |
2108 | 2104 |
2109 @override | 2105 @override |
2110 ir.Primitive visitUnresolvedInvoke( | 2106 ir.Primitive visitUnresolvedInvoke( |
2111 ast.Send node, | 2107 ast.Send node, |
2112 Element element, | 2108 Element element, |
2113 ast.NodeList arguments, | 2109 ast.NodeList arguments, |
2114 Selector selector, _) { | 2110 Selector selector, _) { |
2115 return buildStaticNoSuchMethod(elements.getSelector(node), | 2111 return irBuilder.buildStaticNoSuchMethod(elements.getSelector(node), |
2116 arguments.nodes.mapToList(visit)); | 2112 arguments.nodes.mapToList(visit)); |
2117 } | 2113 } |
2118 | 2114 |
2119 @override | 2115 @override |
2120 ir.Primitive visitUnresolvedRedirectingFactoryConstructorInvoke( | 2116 ir.Primitive visitUnresolvedRedirectingFactoryConstructorInvoke( |
2121 ast.NewExpression node, | 2117 ast.NewExpression node, |
2122 ConstructorElement constructor, | 2118 ConstructorElement constructor, |
2123 InterfaceType type, | 2119 InterfaceType type, |
2124 ast.NodeList argumentsNode, | 2120 ast.NodeList argumentsNode, |
2125 CallStructure callStructure, _) { | 2121 CallStructure callStructure, _) { |
2126 String nameString = Elements.reconstructConstructorName(constructor); | 2122 String nameString = Elements.reconstructConstructorName(constructor); |
2127 Name name = new Name(nameString, constructor.library); | 2123 Name name = new Name(nameString, constructor.library); |
2128 List<ir.Primitive> arguments = <ir.Primitive>[]; | 2124 List<ir.Primitive> arguments = <ir.Primitive>[]; |
2129 callStructure = | 2125 callStructure = |
2130 translateDynamicArguments(argumentsNode, callStructure, arguments); | 2126 translateDynamicArguments(argumentsNode, callStructure, arguments); |
2131 return buildStaticNoSuchMethod( | 2127 return irBuilder.buildStaticNoSuchMethod( |
2132 new Selector.call(name, callStructure), | 2128 new Selector.call(name, callStructure), |
2133 arguments); | 2129 arguments); |
2134 } | 2130 } |
2135 | 2131 |
2136 @override | 2132 @override |
2137 ir.Primitive visitUnresolvedSet( | 2133 ir.Primitive visitUnresolvedSet( |
2138 ast.Send node, | 2134 ast.Send node, |
2139 Element element, | 2135 Element element, |
2140 ast.Node rhs, _) { | 2136 ast.Node rhs, _) { |
2141 return buildStaticNoSuchMethod(elements.getSelector(node), [visit(rhs)]); | 2137 return irBuilder.buildStaticNoSuchMethod(elements.getSelector(node), |
| 2138 [visit(rhs)]); |
2142 } | 2139 } |
2143 | 2140 |
2144 @override | 2141 @override |
2145 ir.Primitive visitUnresolvedSuperIndex( | 2142 ir.Primitive visitUnresolvedSuperIndex( |
2146 ast.Send node, | 2143 ast.Send node, |
2147 Element function, | 2144 Element function, |
2148 ast.Node index, _) { | 2145 ast.Node index, _) { |
2149 // Assume the index getter is missing. | 2146 // Assume the index getter is missing. |
2150 return buildInstanceNoSuchMethod( | 2147 return buildInstanceNoSuchMethod( |
2151 new Selector.index(), elements.getTypeMask(node), [visit(index)]); | 2148 new Selector.index(), elements.getTypeMask(node), [visit(index)]); |
(...skipping 30 matching lines...) Expand all Loading... |
2182 return irBuilder.buildNullConstant(); | 2179 return irBuilder.buildNullConstant(); |
2183 } | 2180 } |
2184 | 2181 |
2185 @override | 2182 @override |
2186 ir.Primitive visitClassTypeLiteralSet( | 2183 ir.Primitive visitClassTypeLiteralSet( |
2187 ast.SendSet node, | 2184 ast.SendSet node, |
2188 TypeConstantExpression constant, | 2185 TypeConstantExpression constant, |
2189 ast.Node rhs, _) { | 2186 ast.Node rhs, _) { |
2190 InterfaceType type = constant.type; | 2187 InterfaceType type = constant.type; |
2191 ClassElement element = type.element; | 2188 ClassElement element = type.element; |
2192 return buildStaticNoSuchMethod( | 2189 return irBuilder.buildStaticNoSuchMethod( |
2193 new Selector.setter(element.memberName), | 2190 new Selector.setter(element.memberName), |
2194 [visit(rhs)]); | 2191 [visit(rhs)]); |
2195 } | 2192 } |
2196 | 2193 |
2197 @override | 2194 @override |
2198 ir.Primitive visitTypedefTypeLiteralSet( | 2195 ir.Primitive visitTypedefTypeLiteralSet( |
2199 ast.SendSet node, | 2196 ast.SendSet node, |
2200 TypeConstantExpression constant, | 2197 TypeConstantExpression constant, |
2201 ast.Node rhs, _) { | 2198 ast.Node rhs, _) { |
2202 TypedefType type = constant.type; | 2199 TypedefType type = constant.type; |
2203 TypedefElement element = type.element; | 2200 TypedefElement element = type.element; |
2204 return buildStaticNoSuchMethod( | 2201 return irBuilder.buildStaticNoSuchMethod( |
2205 new Selector.setter(element.memberName), | 2202 new Selector.setter(element.memberName), |
2206 [visit(rhs)]); | 2203 [visit(rhs)]); |
2207 } | 2204 } |
2208 | 2205 |
2209 @override | 2206 @override |
2210 ir.Primitive visitTypeVariableTypeLiteralSet( | 2207 ir.Primitive visitTypeVariableTypeLiteralSet( |
2211 ast.SendSet node, | 2208 ast.SendSet node, |
2212 TypeVariableElement element, | 2209 TypeVariableElement element, |
2213 ast.Node rhs, _) { | 2210 ast.Node rhs, _) { |
2214 return buildStaticNoSuchMethod( | 2211 return irBuilder.buildStaticNoSuchMethod( |
2215 new Selector.setter(element.memberName), [visit(rhs)]); | 2212 new Selector.setter(element.memberName), [visit(rhs)]); |
2216 } | 2213 } |
2217 | 2214 |
2218 @override | 2215 @override |
2219 ir.Primitive visitDynamicTypeLiteralSet( | 2216 ir.Primitive visitDynamicTypeLiteralSet( |
2220 ast.SendSet node, | 2217 ast.SendSet node, |
2221 ConstantExpression constant, | 2218 ConstantExpression constant, |
2222 ast.Node rhs, _) { | 2219 ast.Node rhs, _) { |
2223 return buildStaticNoSuchMethod( | 2220 return irBuilder.buildStaticNoSuchMethod( |
2224 new Selector.setter(Names.dynamic_), [visit(rhs)]); | 2221 new Selector.setter(Names.dynamic_), [visit(rhs)]); |
2225 } | 2222 } |
2226 | 2223 |
2227 @override | 2224 @override |
2228 ir.Primitive visitAbstractClassConstructorInvoke( | 2225 ir.Primitive visitAbstractClassConstructorInvoke( |
2229 ast.NewExpression node, | 2226 ast.NewExpression node, |
2230 ConstructorElement element, | 2227 ConstructorElement element, |
2231 InterfaceType type, | 2228 InterfaceType type, |
2232 ast.NodeList arguments, | 2229 ast.NodeList arguments, |
2233 CallStructure callStructure, _) { | 2230 CallStructure callStructure, _) { |
2234 for (ast.Node argument in arguments) visit(argument); | 2231 for (ast.Node argument in arguments) visit(argument); |
2235 return buildAbstractClassInstantiationError(element.enclosingClass); | 2232 return buildAbstractClassInstantiationError(element.enclosingClass); |
2236 } | 2233 } |
2237 | 2234 |
2238 @override | 2235 @override |
2239 ir.Primitive handleFinalStaticFieldSet( | 2236 ir.Primitive handleFinalStaticFieldSet( |
2240 ast.SendSet node, | 2237 ast.SendSet node, |
2241 FieldElement field, | 2238 FieldElement field, |
2242 ast.Node rhs, _) { | 2239 ast.Node rhs, _) { |
2243 // TODO(asgerf): Include class name somehow for static class members? | 2240 // TODO(asgerf): Include class name somehow for static class members? |
2244 return buildStaticNoSuchMethod( | 2241 return irBuilder.buildStaticNoSuchMethod( |
2245 new Selector.setter(field.memberName), | 2242 new Selector.setter(field.memberName), |
2246 [visit(rhs)]); | 2243 [visit(rhs)]); |
2247 } | 2244 } |
2248 | 2245 |
2249 @override | 2246 @override |
2250 ir.Primitive visitFinalSuperFieldSet( | 2247 ir.Primitive visitFinalSuperFieldSet( |
2251 ast.SendSet node, | 2248 ast.SendSet node, |
2252 FieldElement field, | 2249 FieldElement field, |
2253 ast.Node rhs, _) { | 2250 ast.Node rhs, _) { |
2254 return buildInstanceNoSuchMethod( | 2251 return buildInstanceNoSuchMethod( |
2255 new Selector.setter(field.memberName), | 2252 new Selector.setter(field.memberName), |
2256 elements.getTypeMask(node), | 2253 elements.getTypeMask(node), |
2257 [visit(rhs)]); | 2254 [visit(rhs)]); |
2258 } | 2255 } |
2259 | 2256 |
2260 @override | 2257 @override |
2261 ir.Primitive handleImmutableLocalSet( | 2258 ir.Primitive handleImmutableLocalSet( |
2262 ast.SendSet node, | 2259 ast.SendSet node, |
2263 LocalElement local, | 2260 LocalElement local, |
2264 ast.Node rhs, _) { | 2261 ast.Node rhs, _) { |
2265 return buildStaticNoSuchMethod( | 2262 return irBuilder.buildStaticNoSuchMethod( |
2266 new Selector.setter(new Name(local.name, local.library)), | 2263 new Selector.setter(new Name(local.name, local.library)), |
2267 [visit(rhs)]); | 2264 [visit(rhs)]); |
2268 } | 2265 } |
2269 | 2266 |
2270 @override | 2267 @override |
2271 ir.Primitive handleStaticFunctionSet( | 2268 ir.Primitive handleStaticFunctionSet( |
2272 ast.Send node, | 2269 ast.Send node, |
2273 MethodElement function, | 2270 MethodElement function, |
2274 ast.Node rhs, | 2271 ast.Node rhs, |
2275 _) { | 2272 _) { |
2276 return buildStaticNoSuchMethod( | 2273 return irBuilder.buildStaticNoSuchMethod( |
2277 new Selector.setter(function.memberName), | 2274 new Selector.setter(function.memberName), |
2278 [visit(rhs)]); | 2275 [visit(rhs)]); |
2279 } | 2276 } |
2280 | 2277 |
2281 @override | 2278 @override |
2282 ir.Primitive handleStaticGetterSet( | 2279 ir.Primitive handleStaticGetterSet( |
2283 ast.SendSet node, | 2280 ast.SendSet node, |
2284 GetterElement getter, | 2281 GetterElement getter, |
2285 ast.Node rhs, | 2282 ast.Node rhs, |
2286 _) { | 2283 _) { |
2287 return buildStaticNoSuchMethod( | 2284 return irBuilder.buildStaticNoSuchMethod( |
2288 new Selector.setter(getter.memberName), | 2285 new Selector.setter(getter.memberName), |
2289 [visit(rhs)]); | 2286 [visit(rhs)]); |
2290 } | 2287 } |
2291 | 2288 |
2292 @override | 2289 @override |
2293 ir.Primitive handleStaticSetterGet( | 2290 ir.Primitive handleStaticSetterGet( |
2294 ast.Send node, | 2291 ast.Send node, |
2295 SetterElement setter, | 2292 SetterElement setter, |
2296 _) { | 2293 _) { |
2297 return buildStaticNoSuchMethod( | 2294 return irBuilder.buildStaticNoSuchMethod( |
2298 new Selector.getter(setter.memberName), | 2295 new Selector.getter(setter.memberName), |
2299 []); | 2296 []); |
2300 } | 2297 } |
2301 | 2298 |
2302 @override | 2299 @override |
2303 ir.Primitive handleStaticSetterInvoke( | 2300 ir.Primitive handleStaticSetterInvoke( |
2304 ast.Send node, | 2301 ast.Send node, |
2305 SetterElement setter, | 2302 SetterElement setter, |
2306 ast.NodeList argumentsNode, | 2303 ast.NodeList argumentsNode, |
2307 CallStructure callStructure, _) { | 2304 CallStructure callStructure, _) { |
2308 // Translate as a method call. | 2305 // Translate as a method call. |
2309 List<ir.Primitive> arguments = argumentsNode.nodes.mapToList(visit); | 2306 List<ir.Primitive> arguments = argumentsNode.nodes.mapToList(visit); |
2310 return buildStaticNoSuchMethod( | 2307 return irBuilder.buildStaticNoSuchMethod( |
2311 new Selector.call(setter.memberName, callStructure), | 2308 new Selector.call(setter.memberName, callStructure), |
2312 arguments); | 2309 arguments); |
2313 } | 2310 } |
2314 | 2311 |
2315 @override | 2312 @override |
2316 ir.Primitive visitSuperGetterSet( | 2313 ir.Primitive visitSuperGetterSet( |
2317 ast.SendSet node, | 2314 ast.SendSet node, |
2318 GetterElement getter, | 2315 GetterElement getter, |
2319 ast.Node rhs, | 2316 ast.Node rhs, |
2320 _) { | 2317 _) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 /// arguments for the class [cls] are never used in the program. | 2569 /// arguments for the class [cls] are never used in the program. |
2573 bool requiresRuntimeTypesFor(ClassElement cls) { | 2570 bool requiresRuntimeTypesFor(ClassElement cls) { |
2574 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls); | 2571 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls); |
2575 } | 2572 } |
2576 | 2573 |
2577 FunctionElement get stringifyFunction { | 2574 FunctionElement get stringifyFunction { |
2578 return _backend.helpers.stringInterpolationHelper; | 2575 return _backend.helpers.stringInterpolationHelper; |
2579 } | 2576 } |
2580 | 2577 |
2581 FunctionElement get throwTypeErrorHelper => _backend.helpers.throwTypeError; | 2578 FunctionElement get throwTypeErrorHelper => _backend.helpers.throwTypeError; |
| 2579 Element get throwNoSuchMethod => _backend.helpers.throwNoSuchMethod; |
2582 | 2580 |
2583 ClassElement get nullClass => _compiler.coreClasses.nullClass; | 2581 ClassElement get nullClass => _compiler.coreClasses.nullClass; |
2584 | 2582 |
2585 DartType unaliasType(DartType type) => type.unaliased; | 2583 DartType unaliasType(DartType type) => type.unaliased; |
2586 | 2584 |
2587 TypeMask getTypeMaskForForeign(NativeBehavior behavior) { | 2585 TypeMask getTypeMaskForForeign(NativeBehavior behavior) { |
2588 if (behavior == null) { | 2586 if (behavior == null) { |
2589 return _backend.dynamicType; | 2587 return _backend.dynamicType; |
2590 } | 2588 } |
2591 return TypeMaskFactory.fromNativeBehavior(behavior, _compiler); | 2589 return TypeMaskFactory.fromNativeBehavior(behavior, _compiler); |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3361 return irBuilder.buildConstructorInvocation( | 3359 return irBuilder.buildConstructorInvocation( |
3362 target, | 3360 target, |
3363 callStructure, | 3361 callStructure, |
3364 constructor.computeEffectiveTargetType(type), | 3362 constructor.computeEffectiveTargetType(type), |
3365 arguments, | 3363 arguments, |
3366 sourceInformationBuilder.buildNew(node), | 3364 sourceInformationBuilder.buildNew(node), |
3367 allocationSiteType: allocationSiteType); | 3365 allocationSiteType: allocationSiteType); |
3368 } | 3366 } |
3369 | 3367 |
3370 @override | 3368 @override |
3371 ir.Primitive buildStaticNoSuchMethod(Selector selector, | |
3372 List<ir.Primitive> arguments) { | |
3373 Element thrower = backend.helpers.throwNoSuchMethod; | |
3374 ir.Primitive receiver = irBuilder.buildStringConstant(''); | |
3375 ir.Primitive name = irBuilder.buildStringConstant(selector.name); | |
3376 ir.Primitive argumentList = irBuilder.buildListLiteral(null, arguments); | |
3377 ir.Primitive expectedArgumentNames = irBuilder.buildNullConstant(); | |
3378 return irBuilder.buildStaticFunctionInvocation( | |
3379 thrower, | |
3380 new CallStructure.unnamed(4), | |
3381 [receiver, name, argumentList, expectedArgumentNames]); | |
3382 } | |
3383 | |
3384 @override | |
3385 ir.Primitive buildInstanceNoSuchMethod(Selector selector, | 3369 ir.Primitive buildInstanceNoSuchMethod(Selector selector, |
3386 TypeMask mask, | 3370 TypeMask mask, |
3387 List<ir.Primitive> arguments) { | 3371 List<ir.Primitive> arguments) { |
3388 return irBuilder.buildDynamicInvocation( | 3372 return irBuilder.buildDynamicInvocation( |
3389 irBuilder.buildThis(), | 3373 irBuilder.buildThis(), |
3390 Selectors.noSuchMethod_, | 3374 Selectors.noSuchMethod_, |
3391 mask, | 3375 mask, |
3392 [irBuilder.buildInvocationMirror(selector, arguments)]); | 3376 [irBuilder.buildInvocationMirror(selector, arguments)]); |
3393 } | 3377 } |
3394 | 3378 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3668 callStructure = translateStaticArguments(argumentsNode, function, | 3652 callStructure = translateStaticArguments(argumentsNode, function, |
3669 callStructure, arguments); | 3653 callStructure, arguments); |
3670 return irBuilder.buildStaticFunctionInvocation(function, | 3654 return irBuilder.buildStaticFunctionInvocation(function, |
3671 callStructure, | 3655 callStructure, |
3672 arguments, | 3656 arguments, |
3673 sourceInformation: | 3657 sourceInformation: |
3674 sourceInformationBuilder.buildCall(node, node.selector)); | 3658 sourceInformationBuilder.buildCall(node, node.selector)); |
3675 } | 3659 } |
3676 } | 3660 } |
3677 } | 3661 } |
OLD | NEW |