Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1179503002: dart2js cps: Handle type variables in factory constructors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Type argument Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698