mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Revert "Tweaks for mixin inference."
This reverts commit fb9d0e6dc3
.
Reason for revert: Performance regression https://github.com/dart-lang/sdk/issues/52922
Original change's description:
> Tweaks for mixin inference.
>
> I started initially with the idea to move 'mixinInferenceCallback'
> to `ClassElementImpl`, but then realized that we do it for enums too.
> So, it should stay in `InterfaceElementImpl`.
>
> I left with code that I think slightly modernized, so decided to
> send it for review.
>
> Change-Id: Ib990392dc4985a71ffba1f4080237872d9a65ad2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312521
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Change-Id: I33098d8509319e9d6e62d7f5174cae2c05977436
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313440
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
parent
2051bcf619
commit
e718a97882
|
@ -614,19 +614,11 @@ class _MixinsInference {
|
|||
_MixinsInference(this._linker);
|
||||
|
||||
void perform(List<AstNode> declarations) {
|
||||
for (var declaration in declarations) {
|
||||
InterfaceElementImpl declaredElement;
|
||||
switch (declaration) {
|
||||
case ClassDeclarationImpl():
|
||||
declaredElement = declaration.declaredElement!;
|
||||
case ClassTypeAliasImpl():
|
||||
declaredElement = declaration.declaredElement!;
|
||||
case EnumDeclarationImpl():
|
||||
declaredElement = declaration.declaredElement!;
|
||||
default:
|
||||
continue;
|
||||
for (var node in declarations) {
|
||||
if (node is ClassDeclaration || node is ClassTypeAlias) {
|
||||
var element = (node as Declaration).declaredElement as ClassElementImpl;
|
||||
element.mixinInferenceCallback = _callbackWhenRecursion;
|
||||
}
|
||||
declaredElement.mixinInferenceCallback = _callbackWhenRecursion;
|
||||
}
|
||||
|
||||
for (var declaration in declarations) {
|
||||
|
@ -676,13 +668,15 @@ class _MixinsInference {
|
|||
}
|
||||
|
||||
void _inferDeclaration(AstNode node) {
|
||||
switch (node) {
|
||||
case ClassDeclarationImpl():
|
||||
_infer(node.declaredElement!, node.withClause);
|
||||
case ClassTypeAliasImpl():
|
||||
_infer(node.declaredElement!, node.withClause);
|
||||
case EnumDeclarationImpl():
|
||||
_infer(node.declaredElement!, node.withClause);
|
||||
if (node is ClassDeclaration) {
|
||||
var element = node.declaredElement as ClassElementImpl;
|
||||
_infer(element, node.withClause);
|
||||
} else if (node is ClassTypeAlias) {
|
||||
var element = node.declaredElement as ClassElementImpl;
|
||||
_infer(element, node.withClause);
|
||||
} else if (node is EnumDeclaration) {
|
||||
var element = node.declaredElement as EnumElementImpl;
|
||||
_infer(element, node.withClause);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -691,21 +685,14 @@ class _MixinsInference {
|
|||
/// class hierarchy, we cache such incomplete hierarchy. So, here we reset
|
||||
/// hierarchies for all classes being linked, indiscriminately.
|
||||
void _resetHierarchies(List<AstNode> declarations) {
|
||||
for (final declaration in declarations) {
|
||||
InterfaceElementImpl declaredElement;
|
||||
switch (declaration) {
|
||||
case ClassDeclarationImpl():
|
||||
declaredElement = declaration.declaredElement!;
|
||||
case ClassTypeAliasImpl():
|
||||
declaredElement = declaration.declaredElement!;
|
||||
case EnumDeclarationImpl():
|
||||
declaredElement = declaration.declaredElement!;
|
||||
default:
|
||||
continue;
|
||||
for (var declaration in declarations) {
|
||||
if (declaration is ClassDeclaration) {
|
||||
var element = declaration.declaredElement as ClassElementImpl;
|
||||
element.library.session.classHierarchy.remove(element);
|
||||
} else if (declaration is MixinDeclaration) {
|
||||
var element = declaration.declaredElement as MixinElementImpl;
|
||||
element.library.session.classHierarchy.remove(element);
|
||||
}
|
||||
final analysisSession = declaredElement.library.session;
|
||||
final classHierarchy = analysisSession.classHierarchy;
|
||||
classHierarchy.remove(declaredElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue