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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 13642002: Make sure required type arguments are given when using factories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to override [Element.computeType] because our 9 * methods. We need to override [Element.computeType] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 3299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 typeVariable = typeVariable.tail; 3310 typeVariable = typeVariable.tail;
3311 }); 3311 });
3312 // Also add null to non-provided type variables to call the 3312 // Also add null to non-provided type variables to call the
3313 // constructor with the right number of arguments. 3313 // constructor with the right number of arguments.
3314 while (!typeVariable.isEmpty) { 3314 while (!typeVariable.isEmpty) {
3315 inputs.add(graph.addConstantNull(constantSystem)); 3315 inputs.add(graph.addConstantNull(constantSystem));
3316 typeVariable = typeVariable.tail; 3316 typeVariable = typeVariable.tail;
3317 } 3317 }
3318 } 3318 }
3319 3319
3320 if (constructor.isFactoryConstructor() && !type.typeArguments.isEmpty) {
3321 compiler.enqueuer.codegen.registerFactoryWithTypeArguments();
3322 }
3320 HType elementType = computeType(constructor); 3323 HType elementType = computeType(constructor);
3321 HInstruction newInstance = new HInvokeStatic(inputs, elementType); 3324 HInstruction newInstance = new HInvokeStatic(inputs, elementType);
3322 pushWithPosition(newInstance, node); 3325 pushWithPosition(newInstance, node);
3323 3326
3324 // The List constructor forwards to a Dart static method that does 3327 // The List constructor forwards to a Dart static method that does
3325 // not know about the type argument. Therefore we special case 3328 // not know about the type argument. Therefore we special case
3326 // this constructor to have the setRuntimeTypeInfo called where 3329 // this constructor to have the setRuntimeTypeInfo called where
3327 // the 'new' is done. 3330 // the 'new' is done.
3328 if (isListConstructor && backend.needsRti(compiler.listClass)) { 3331 if (isListConstructor && backend.needsRti(compiler.listClass)) {
3329 handleListConstructor(type, node, newInstance); 3332 handleListConstructor(type, node, newInstance);
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
5102 new HSubGraphBlockInformation(elseBranch.graph)); 5105 new HSubGraphBlockInformation(elseBranch.graph));
5103 5106
5104 HBasicBlock conditionStartBlock = conditionBranch.block; 5107 HBasicBlock conditionStartBlock = conditionBranch.block;
5105 conditionStartBlock.setBlockFlow(info, joinBlock); 5108 conditionStartBlock.setBlockFlow(info, joinBlock);
5106 SubGraph conditionGraph = conditionBranch.graph; 5109 SubGraph conditionGraph = conditionBranch.graph;
5107 HIf branch = conditionGraph.end.last; 5110 HIf branch = conditionGraph.end.last;
5108 assert(branch is HIf); 5111 assert(branch is HIf);
5109 branch.blockInformation = conditionStartBlock.blockFlow; 5112 branch.blockInformation = conditionStartBlock.blockFlow;
5110 } 5113 }
5111 } 5114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698