Chromium Code Reviews

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

Issue 2567133002: Add support for the new function-type syntax. (Closed)
Patch Set: Handle function types with `void` return type. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: pkg/compiler/lib/src/ssa/graph_builder.dart
diff --git a/pkg/compiler/lib/src/ssa/graph_builder.dart b/pkg/compiler/lib/src/ssa/graph_builder.dart
index 9dbab93421640ec2713f90398f7eea72b0ad5d65..0af3064f171e78fae6d45512ef6b4488362f9302 100644
--- a/pkg/compiler/lib/src/ssa/graph_builder.dart
+++ b/pkg/compiler/lib/src/ssa/graph_builder.dart
@@ -261,6 +261,14 @@ class ReifiedTypeRepresentationBuilder
ResolutionTypeVariableType type, GraphBuilder builder) {
ClassElement cls = builder.backend.helpers.RuntimeType;
TypeMask instructionType = new TypeMask.subclass(cls, closedWorld);
+
+ // TODO(floitsch): this hack maps type variables of generic function
+ // typedefs to dynamic. For example: `typedef F = Function<T>(T)`.
+ if (type is MethodTypeVariableType) {
+ visitDynamicType(const ResolutionDynamicType(), builder);
+ return;
+ }
+
if (!builder.sourceElement.enclosingElement.isClosure &&
builder.sourceElement.isInstanceMember) {
HInstruction receiver = builder.localsHandler.readThis();

Powered by Google App Engine