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

Unified Diff: pkg/compiler/lib/src/kernel/kernel.dart

Issue 2574193003: Support generic methods in kernel (Closed)
Patch Set: Cleanup 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/kernel/kernel_visitor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/kernel/kernel.dart
diff --git a/pkg/compiler/lib/src/kernel/kernel.dart b/pkg/compiler/lib/src/kernel/kernel.dart
index 77c7e2b74ee1ac83582db44dbf9025668512ba0c..155f2a0b40f6683a8ac20cfb0880178f8aa529a1 100644
--- a/pkg/compiler/lib/src/kernel/kernel.dart
+++ b/pkg/compiler/lib/src/kernel/kernel.dart
@@ -302,13 +302,8 @@ class Kernel {
}
}
- // TODO(ahe): Remove this method when dart2js support generic type arguments.
- List<ir.TypeParameter> typeParametersNotImplemented() {
- return const <ir.TypeParameter>[];
- }
-
ir.FunctionType functionTypeToIr(FunctionType type) {
- List<ir.TypeParameter> typeParameters = typeParametersNotImplemented();
+ List<ir.TypeParameter> typeParameters = <ir.TypeParameter>[];
int requiredParameterCount = type.parameterTypes.length;
List<ir.DartType> positionalParameters =
new List<ir.DartType>.from(typesToIr(type.parameterTypes))
@@ -462,6 +457,8 @@ class Kernel {
procedure.kind = irFunction.kind;
}
endFactoryScope(function);
+ irFunction.node.typeParameters
+ .addAll(typeVariablesToIr(function.typeVariables));
member.transformerFlags = visitor.transformerFlags;
assert(() {
visitor.locals.forEach(checkMember);
@@ -556,11 +553,14 @@ class Kernel {
return typeParameters.putIfAbsent(variable, () {
ir.TypeParameter parameter = new ir.TypeParameter(variable.name, null);
addWork(variable, () {
- // TODO(ahe): This assignment will probably not be correct when dart2js
- // supports generic methods.
- ClassElement cls = variable.typeDeclaration;
- cls.ensureResolved(compiler.resolution);
- parameter.parent = classToIr(cls);
+ if (variable.typeDeclaration.isClass) {
+ ClassElement cls = variable.typeDeclaration;
+ cls.ensureResolved(compiler.resolution);
+ parameter.parent = classToIr(cls);
+ } else {
+ FunctionElement method = variable.typeDeclaration;
+ parameter.parent = functionToIr(method).function;
+ }
parameter.bound = typeToIr(variable.bound);
});
return parameter;
« no previous file with comments | « no previous file | pkg/compiler/lib/src/kernel/kernel_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698