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/names.dart' show | 9 import '../common/names.dart' show |
10 Names, | 10 Names, |
(...skipping 17 matching lines...) Expand all Loading... |
28 SyntheticConstantKind; | 28 SyntheticConstantKind; |
29 import '../resolution/tree_elements.dart' show | 29 import '../resolution/tree_elements.dart' show |
30 TreeElements; | 30 TreeElements; |
31 import '../resolution/semantic_visitor.dart'; | 31 import '../resolution/semantic_visitor.dart'; |
32 import '../resolution/send_resolver.dart' show | 32 import '../resolution/send_resolver.dart' show |
33 SendResolverMixin; | 33 SendResolverMixin; |
34 import '../resolution/operators.dart' as op; | 34 import '../resolution/operators.dart' as op; |
35 import '../tree/tree.dart' as ast; | 35 import '../tree/tree.dart' as ast; |
36 import '../types/types.dart' show | 36 import '../types/types.dart' show |
37 TypeMask; | 37 TypeMask; |
38 import '../universe/universe.dart' show | 38 import '../universe/call_structure.dart' show |
39 CallStructure, | 39 CallStructure; |
40 Selector, | 40 import '../universe/selector.dart' show |
41 SelectorKind; | 41 Selector; |
42 import '../constants/values.dart' show | 42 import '../constants/values.dart' show |
43 ConstantValue; | 43 ConstantValue; |
44 import 'cps_ir_nodes.dart' as ir; | 44 import 'cps_ir_nodes.dart' as ir; |
45 import 'cps_ir_builder.dart'; | 45 import 'cps_ir_builder.dart'; |
46 import '../native/native.dart' show | 46 import '../native/native.dart' show |
47 NativeBehavior; | 47 NativeBehavior; |
48 | 48 |
49 // TODO(karlklose): remove. | 49 // TODO(karlklose): remove. |
50 import '../js/js.dart' as js show js, Template, Expression, Name; | 50 import '../js/js.dart' as js show js, Template, Expression, Name; |
51 import '../ssa/ssa.dart' show TypeMaskFactory; | 51 import '../ssa/ssa.dart' show TypeMaskFactory; |
(...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 @override | 2004 @override |
2005 ir.Primitive visitUnresolvedRedirectingFactoryConstructorInvoke( | 2005 ir.Primitive visitUnresolvedRedirectingFactoryConstructorInvoke( |
2006 ast.NewExpression node, | 2006 ast.NewExpression node, |
2007 ConstructorElement constructor, | 2007 ConstructorElement constructor, |
2008 InterfaceType type, | 2008 InterfaceType type, |
2009 ast.NodeList arguments, | 2009 ast.NodeList arguments, |
2010 CallStructure callStructure, _) { | 2010 CallStructure callStructure, _) { |
2011 String nameString = Elements.reconstructConstructorName(constructor); | 2011 String nameString = Elements.reconstructConstructorName(constructor); |
2012 Name name = new Name(nameString, constructor.library); | 2012 Name name = new Name(nameString, constructor.library); |
2013 return buildStaticNoSuchMethod( | 2013 return buildStaticNoSuchMethod( |
2014 new Selector(SelectorKind.CALL, name, callStructure), | 2014 new Selector.call(name, callStructure), |
2015 translateDynamicArguments(arguments, callStructure)); | 2015 translateDynamicArguments(arguments, callStructure)); |
2016 } | 2016 } |
2017 | 2017 |
2018 @override | 2018 @override |
2019 ir.Primitive visitUnresolvedSet( | 2019 ir.Primitive visitUnresolvedSet( |
2020 ast.Send node, | 2020 ast.Send node, |
2021 Element element, | 2021 Element element, |
2022 ast.Node rhs, _) { | 2022 ast.Node rhs, _) { |
2023 return buildStaticNoSuchMethod(elements.getSelector(node), [visit(rhs)]); | 2023 return buildStaticNoSuchMethod(elements.getSelector(node), [visit(rhs)]); |
2024 } | 2024 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 | 2183 |
2184 @override | 2184 @override |
2185 ir.Primitive handleStaticSetterInvoke( | 2185 ir.Primitive handleStaticSetterInvoke( |
2186 ast.Send node, | 2186 ast.Send node, |
2187 SetterElement setter, | 2187 SetterElement setter, |
2188 ast.NodeList arguments, | 2188 ast.NodeList arguments, |
2189 CallStructure callStructure, _) { | 2189 CallStructure callStructure, _) { |
2190 // Translate as a method call. | 2190 // Translate as a method call. |
2191 List<ir.Primitive> args = arguments.nodes.mapToList(visit); | 2191 List<ir.Primitive> args = arguments.nodes.mapToList(visit); |
2192 return buildStaticNoSuchMethod( | 2192 return buildStaticNoSuchMethod( |
2193 new Selector(SelectorKind.CALL, setter.memberName, callStructure), | 2193 new Selector.call(setter.memberName, callStructure), |
2194 args); | 2194 args); |
2195 } | 2195 } |
2196 | 2196 |
2197 @override | 2197 @override |
2198 ir.Primitive visitSuperGetterSet( | 2198 ir.Primitive visitSuperGetterSet( |
2199 ast.SendSet node, | 2199 ast.SendSet node, |
2200 GetterElement getter, | 2200 GetterElement getter, |
2201 ast.Node rhs, | 2201 ast.Node rhs, |
2202 _) { | 2202 _) { |
2203 return buildInstanceNoSuchMethod( | 2203 return buildInstanceNoSuchMethod( |
(...skipping 26 matching lines...) Expand all Loading... |
2230 | 2230 |
2231 @override | 2231 @override |
2232 ir.Primitive visitSuperSetterInvoke( | 2232 ir.Primitive visitSuperSetterInvoke( |
2233 ast.Send node, | 2233 ast.Send node, |
2234 SetterElement setter, | 2234 SetterElement setter, |
2235 ast.NodeList arguments, | 2235 ast.NodeList arguments, |
2236 CallStructure callStructure, _) { | 2236 CallStructure callStructure, _) { |
2237 List<ir.Primitive> args = | 2237 List<ir.Primitive> args = |
2238 translateDynamicArguments(arguments, callStructure); | 2238 translateDynamicArguments(arguments, callStructure); |
2239 return buildInstanceNoSuchMethod( | 2239 return buildInstanceNoSuchMethod( |
2240 new Selector(SelectorKind.CALL, setter.memberName, callStructure), | 2240 new Selector.call(setter.memberName, callStructure), |
2241 elements.getTypeMask(node), | 2241 elements.getTypeMask(node), |
2242 args); | 2242 args); |
2243 } | 2243 } |
2244 | 2244 |
2245 ir.FunctionDefinition nullIfGiveup(ir.FunctionDefinition action()) { | 2245 ir.FunctionDefinition nullIfGiveup(ir.FunctionDefinition action()) { |
2246 try { | 2246 try { |
2247 return action(); | 2247 return action(); |
2248 } catch(e) { | 2248 } catch(e) { |
2249 if (e == ABORT_IRNODE_BUILDER) { | 2249 if (e == ABORT_IRNODE_BUILDER) { |
2250 return null; | 2250 return null; |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3570 if (compiler.backend.isForeign(function)) { | 3570 if (compiler.backend.isForeign(function)) { |
3571 return handleForeignCode(node, function, argumentList, callStructure); | 3571 return handleForeignCode(node, function, argumentList, callStructure); |
3572 } else { | 3572 } else { |
3573 return irBuilder.buildStaticFunctionInvocation(function, callStructure, | 3573 return irBuilder.buildStaticFunctionInvocation(function, callStructure, |
3574 translateStaticArguments(argumentList, function, callStructure), | 3574 translateStaticArguments(argumentList, function, callStructure), |
3575 sourceInformation: | 3575 sourceInformation: |
3576 sourceInformationBuilder.buildCall(node, node.selector)); | 3576 sourceInformationBuilder.buildCall(node, node.selector)); |
3577 } | 3577 } |
3578 } | 3578 } |
3579 } | 3579 } |
OLD | NEW |