Skip to content

Commit 37afcd5

Browse files
committed
Change TypeInference to handle super calls as direct invocations.
This also makes calls of known target registered as static uses and thus removes the need for misusing type masks to select super methods. Closes dart-lang#25716 [email protected] Committed: dart-lang@70159b7 Review URL: https://codereview.chromium.org/2423953002 . Reverted: dart-lang@5397c54
1 parent b5d2b38 commit 37afcd5

File tree

10 files changed

+450
-56
lines changed

10 files changed

+450
-56
lines changed

pkg/compiler/lib/src/enqueue.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,10 @@ class ResolutionEnqueuer extends Enqueuer {
600600
case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
601601
registerTypeUse(new TypeUse.instantiation(staticUse.type));
602602
break;
603+
case StaticUseKind.DIRECT_INVOKE:
604+
invariant(
605+
element, 'Direct static use is not supported for resolution.');
606+
break;
603607
}
604608
if (addElement) {
605609
addToWorkList(element);

pkg/compiler/lib/src/inferrer/inferrer_visitor.dart

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -958,13 +958,6 @@ abstract class InferrerVisitor<T, E extends MinimalInferrerEngine<T>>
958958
}
959959
}
960960

961-
T _superType;
962-
T get superType {
963-
if (_superType != null) return _superType;
964-
return _superType =
965-
types.nonNullExact(outermostElement.enclosingClass.superclass);
966-
}
967-
968961
@override
969962
T visitThisGet(Identifier node, _) {
970963
return thisType;
@@ -974,7 +967,7 @@ abstract class InferrerVisitor<T, E extends MinimalInferrerEngine<T>>
974967
if (node.isThis()) {
975968
return thisType;
976969
} else if (node.isSuper()) {
977-
return superType;
970+
return internalError(node, 'Unexpected expression $node.');
978971
} else {
979972
Element element = elements[node];
980973
if (Elements.isLocal(element)) {

0 commit comments

Comments
 (0)