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

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

Issue 246563006: Handle generic parameters in synthesized constructor for mixin applications. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/generic_constructor_mixin2_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 91b0977e722bdb92b70739138ee4b321fb4c70bb..64b12f499cc29cccdbc5048ee929075209210ed6 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -1616,9 +1616,31 @@ class SsaBuilder extends ResolvedVisitor {
*/
void potentiallyCheckInlinedParameterTypes(FunctionElement function) {
floitsch 2014/04/23 17:43:34 Should we bail out immediately if checked mode is
Johnni Winther 2014/04/24 08:32:28 Done.
FunctionSignature signature = function.functionSignature;
+
+ InterfaceType contextType;
+ if (function.isSynthesized && function.isGenerativeConstructor()) {
+ // Synthesized constructors reuse the parameters from the
+ // [targetConstructor]. In face of generic types, the type variables
+ // occurring in the parameter types must be substituted by the type
+ // arguments of the enclosing class.
+ FunctionElement target = function;
+ while (target.targetConstructor != null) {
+ target = target.targetConstructor;
+ }
+ if (target != function) {
+ ClassElement functionClass = function.getEnclosingClass();
+ ClassElement targetClass = target.getEnclosingClass();
+ contextType = functionClass.thisType.asInstanceOf(targetClass);
+ }
+ }
+
signature.orderedForEachParameter((ParameterElement parameter) {
HInstruction argument = localsHandler.readLocal(parameter);
- potentiallyCheckType(argument, parameter.type);
+ DartType parameterType = parameter.type;
+ if (contextType != null) {
+ parameterType = parameterType.substByContext(contextType);
+ }
+ potentiallyCheckType(argument, parameterType);
});
}
« no previous file with comments | « no previous file | tests/language/generic_constructor_mixin2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698