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

Unified Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 2599213002: More kernel-ification of type variables passed around constructors. (Closed)
Patch Set: . Created 4 years 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 | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/builder_kernel.dart
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 7813fc091982ec5ae66e66ed3897fdb705909c49..9d7852c0a7ac661a9c0cfbc14e83e70900a7c596 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -224,13 +224,21 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
}
void _addClassTypeVariablesIfNeeded(ir.Member constructor) {
- var enclosing = astAdapter.getElement(constructor).enclosingElement;
- if (backend.classNeedsRti(enclosing)) {
- enclosing.typeVariables.forEach((TypeVariableType typeVariable) {
+ var enclosing = constructor.enclosingClass;
+ if (backend.classNeedsRti(astAdapter.getElement(enclosing))) {
+ enclosing.typeParameters.forEach((ir.TypeParameter typeParameter) {
+ var typeParamElement = astAdapter.getElement(typeParameter);
HParameterValue param =
- addParameter(typeVariable.element, commonMasks.nonNullType);
+ addParameter(typeParamElement, commonMasks.nonNullType);
+ var dart_type = astAdapter.getDartType(typeParameter.bound);
+ // This is a little bit wacky (and n^2) until we make the localsHandler
+ // take Kernel DartTypes instead of just the AST DartTypes.
+ var typeVariableType = (astAdapter.getElement(constructor))
+ .enclosingElement
+ .typeVariables
+ .firstWhere((TypeVariableType i) => i.name == typeParameter.name);
localsHandler.directLocals[
- localsHandler.getTypeVariableAsLocal(typeVariable)] = param;
+ localsHandler.getTypeVariableAsLocal(typeVariableType)] = param;
});
}
}
@@ -1964,8 +1972,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
// Note: The call to "unalias" this type like in the original SSA builder is
// unnecessary in kernel because Kernel has no notion of typedef.
// TODO(efortuna): Add test for this.
- DartType typeValue = localsHandler.substInContext(
- astAdapter.getDartType(type));
+ DartType typeValue =
+ localsHandler.substInContext(astAdapter.getDartType(type));
if (type is ir.InvalidType) {
generateTypeError(node, (typeValue.element as ErroneousElement).message);
return new HIs.compound(
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698