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'; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 /// Like [useSelectorType], except the original typed selector is obtained | 186 /// Like [useSelectorType], except the original typed selector is obtained |
187 /// from the [node]. | 187 /// from the [node]. |
188 Selector useSelectorTypeOfNode(Selector newSelector, ast.Send node) { | 188 Selector useSelectorTypeOfNode(Selector newSelector, ast.Send node) { |
189 return useSelectorType(newSelector, elements.getSelector(node)); | 189 return useSelectorType(newSelector, elements.getSelector(node)); |
190 } | 190 } |
191 | 191 |
192 ir.FunctionDefinition _makeFunctionBody(FunctionElement element, | 192 ir.FunctionDefinition _makeFunctionBody(FunctionElement element, |
193 ast.FunctionExpression node) { | 193 ast.FunctionExpression node) { |
194 FunctionSignature signature = element.functionSignature; | 194 FunctionSignature signature = element.functionSignature; |
195 List<ParameterElement> parameters = []; | 195 List<Local> parameters = <Local>[]; |
196 signature.orderedForEachParameter(parameters.add); | 196 signature.orderedForEachParameter((e) => parameters.add(e)); |
| 197 |
| 198 if (element.isFactoryConstructor) { |
| 199 // Type arguments are passed in as extra parameters. |
| 200 for (DartType typeVariable in element.enclosingClass.typeVariables) { |
| 201 parameters.add(new TypeVariableLocal(typeVariable, element)); |
| 202 } |
| 203 } |
197 | 204 |
198 irBuilder.buildFunctionHeader(parameters, | 205 irBuilder.buildFunctionHeader(parameters, |
199 closureScope: getClosureScopeForNode(node), | 206 closureScope: getClosureScopeForNode(node), |
200 env: getClosureEnvironment()); | 207 env: getClosureEnvironment()); |
201 | 208 |
202 visit(node.body); | 209 visit(node.body); |
203 return irBuilder.makeFunctionDefinition(); | 210 return irBuilder.makeFunctionDefinition(); |
204 } | 211 } |
205 | 212 |
206 ir.Primitive visit(ast.Node node) => node.accept(this); | 213 ir.Primitive visit(ast.Node node) => node.accept(this); |
(...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2850 } | 2857 } |
2851 | 2858 |
2852 processSetStatic(ir.SetStatic node) { | 2859 processSetStatic(ir.SetStatic node) { |
2853 node.body = replacementFor(node.body); | 2860 node.body = replacementFor(node.body); |
2854 } | 2861 } |
2855 | 2862 |
2856 processContinuation(ir.Continuation node) { | 2863 processContinuation(ir.Continuation node) { |
2857 node.body = replacementFor(node.body); | 2864 node.body = replacementFor(node.body); |
2858 } | 2865 } |
2859 } | 2866 } |
OLD | NEW |