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 '../scanner/scannerlib.dart' show Token, isUserDefinableOperator; | |
20 import '../tree/tree.dart' as ast; | 19 import '../tree/tree.dart' as ast; |
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 /// |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 /// Like [useSelectorType], except the original typed selector is obtained | 185 /// Like [useSelectorType], except the original typed selector is obtained |
187 /// from the [node]. | 186 /// from the [node]. |
188 Selector useSelectorTypeOfNode(Selector newSelector, ast.Send node) { | 187 Selector useSelectorTypeOfNode(Selector newSelector, ast.Send node) { |
189 return useSelectorType(newSelector, elements.getSelector(node)); | 188 return useSelectorType(newSelector, elements.getSelector(node)); |
190 } | 189 } |
191 | 190 |
192 ir.FunctionDefinition _makeFunctionBody(FunctionElement element, | 191 ir.FunctionDefinition _makeFunctionBody(FunctionElement element, |
193 ast.FunctionExpression node) { | 192 ast.FunctionExpression node) { |
194 FunctionSignature signature = element.functionSignature; | 193 FunctionSignature signature = element.functionSignature; |
195 List<Local> parameters = <Local>[]; | 194 List<Local> parameters = <Local>[]; |
196 signature.orderedForEachParameter((e) => parameters.add(e)); | 195 signature.orderedForEachParameter( |
| 196 (LocalParameterElement e) => parameters.add(e)); |
197 | 197 |
198 if (element.isFactoryConstructor) { | 198 if (element.isFactoryConstructor) { |
199 // Type arguments are passed in as extra parameters. | 199 // Type arguments are passed in as extra parameters. |
200 for (DartType typeVariable in element.enclosingClass.typeVariables) { | 200 for (DartType typeVariable in element.enclosingClass.typeVariables) { |
201 parameters.add(new TypeVariableLocal(typeVariable, element)); | 201 parameters.add(new TypeVariableLocal(typeVariable, element)); |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 irBuilder.buildFunctionHeader(parameters, | 205 irBuilder.buildFunctionHeader(parameters, |
206 closureScope: getClosureScopeForNode(node), | 206 closureScope: getClosureScopeForNode(node), |
(...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2857 } | 2857 } |
2858 | 2858 |
2859 processSetStatic(ir.SetStatic node) { | 2859 processSetStatic(ir.SetStatic node) { |
2860 node.body = replacementFor(node.body); | 2860 node.body = replacementFor(node.body); |
2861 } | 2861 } |
2862 | 2862 |
2863 processContinuation(ir.Continuation node) { | 2863 processContinuation(ir.Continuation node) { |
2864 node.body = replacementFor(node.body); | 2864 node.body = replacementFor(node.body); |
2865 } | 2865 } |
2866 } | 2866 } |
OLD | NEW |