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

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

Issue 1976213002: Adjusts dart2js backend to handle method type arguments. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
Index: pkg/compiler/lib/src/ssa/builder.dart
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index 1a754fd18f29628daabe4c52d8651e26dd3bbd0d..330c86fedef58473f7ccfc9133561f7c1bb18b9e 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -2594,6 +2594,10 @@ class SsaBuilder extends ast.Visitor
HInstruction buildTypeConversion(
HInstruction original, DartType type, int kind) {
if (type == null) return original;
+ // TODO(eernst): The following statement was added for parsing and ignoring
+ // method type variables; must be generalized for full support of generic
+ // methods.
+ type = type.eraseMethodTypeVariableType;
type = type.unaliased;
assert(assertTypeInContext(type, original));
if (type.isInterfaceType && !type.treatAsRaw) {
@@ -4772,6 +4776,17 @@ class SsaBuilder extends ast.Visitor
// The type variable is stored on the object.
return readTypeVariable(member.enclosingClass, type.element,
sourceInformation: sourceInformation);
+ } else if (type is MethodTypeVariableType) {
Johnni Winther 2016/05/17 10:27:05 When is this used?
eernst 2016/05/17 14:48:54 I believe that it is not used any more: with the n
+ // TODO(eernst): The enclosing `else if` was added to provide minimal
+ // support for generic methods: The method type arguments are always
+ // pretending to have the value `dynamic`. Revise for full support.
+ DynamicType type = const DynamicType();
+ JavaScriptBackend backend = compiler.backend;
+ ClassElement cls = backend.helpers.DynamicRuntimeType;
+ HInstruction instruction =
+ new HDynamicType(type, new TypeMask.exact(cls, compiler.world));
+ add(instruction);
+ return instruction;
} else {
reporter.internalError(
type.element, 'Unexpected type variable in static context.');

Powered by Google App Engine
This is Rietveld 408576698