mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Add InterfaceElementImpl, move many methods into it.
Change-Id: I7f77e318586b2c05874b3a0d25d2d940869b6a0d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312240 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
parent
d4de535a3a
commit
37003ee3be
File diff suppressed because it is too large
Load diff
|
@ -789,7 +789,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
|
|||
}
|
||||
|
||||
if (recoveryStatic) {
|
||||
final element = this.element as AbstractClassElementImpl;
|
||||
final element = this.element as InterfaceElementImpl;
|
||||
return element.lookupStaticGetter(name, library);
|
||||
}
|
||||
|
||||
|
@ -828,7 +828,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
|
|||
}
|
||||
|
||||
if (recoveryStatic) {
|
||||
final element = this.element as AbstractClassElementImpl;
|
||||
final element = this.element as InterfaceElementImpl;
|
||||
return element.lookupStaticMethod(name, library);
|
||||
}
|
||||
|
||||
|
@ -867,7 +867,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
|
|||
}
|
||||
|
||||
if (recoveryStatic) {
|
||||
final element = this.element as AbstractClassElementImpl;
|
||||
final element = this.element as InterfaceElementImpl;
|
||||
return element.lookupStaticSetter(name, library);
|
||||
}
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ class TypePropertyResolver {
|
|||
_needsGetterError = _getterRequested == null;
|
||||
|
||||
if (_getterRequested == null && recoverWithStatic) {
|
||||
var classElement = type.element as AbstractClassElementImpl;
|
||||
var classElement = type.element as InterfaceElementImpl;
|
||||
_getterRecovery ??=
|
||||
classElement.lookupStaticGetter(_name, _definingLibrary) ??
|
||||
classElement.lookupStaticMethod(_name, _definingLibrary);
|
||||
|
@ -271,7 +271,7 @@ class TypePropertyResolver {
|
|||
_needsSetterError = _setterRequested == null;
|
||||
|
||||
if (_setterRequested == null && recoverWithStatic) {
|
||||
var classElement = type.element as AbstractClassElementImpl;
|
||||
var classElement = type.element as InterfaceElementImpl;
|
||||
_setterRecovery ??=
|
||||
classElement.lookupStaticSetter(_name, _definingLibrary);
|
||||
_needsSetterError = _setterRecovery == null;
|
||||
|
|
|
@ -32,7 +32,7 @@ class ElementTypeProvider {
|
|||
void freshTypeParameterCreated(TypeParameterElement newTypeParameter,
|
||||
TypeParameterElement oldTypeParameter) {}
|
||||
|
||||
List<InterfaceType> getClassInterfaces(AbstractClassElementImpl element) =>
|
||||
List<InterfaceType> getClassInterfaces(InterfaceElementImpl element) =>
|
||||
element.interfacesInternal;
|
||||
|
||||
/// Queries the parameters of an executable element's signature.
|
||||
|
|
|
@ -101,8 +101,8 @@ class ClassElementLinkedData extends ElementLinkedData<ClassElementImpl> {
|
|||
/// as well access them through their [Reference]s. For a class declaration
|
||||
/// this means reading them, for a named mixin application this means
|
||||
/// computing constructors.
|
||||
void readMembers(ClassOrMixinElementImpl element) {
|
||||
if (element is ClassElementImpl && element.isMixinApplication) {
|
||||
void readMembers(ClassElementImpl element) {
|
||||
if (element.isMixinApplication) {
|
||||
element.constructors;
|
||||
} else {
|
||||
_readMembers?.call();
|
||||
|
@ -668,7 +668,7 @@ class LibraryReader {
|
|||
|
||||
List<ConstructorElementImpl> _readConstructors(
|
||||
CompilationUnitElementImpl unitElement,
|
||||
AbstractClassElementImpl classElement,
|
||||
InterfaceElementImpl classElement,
|
||||
Reference classReference,
|
||||
) {
|
||||
var containerRef = classReference.getChild('@constructor');
|
||||
|
|
|
@ -17,7 +17,7 @@ class ConstructorInitializerResolver {
|
|||
|
||||
void resolve() {
|
||||
for (var unitElement in _libraryElement.units) {
|
||||
var interfaceElements = [
|
||||
var interfaceElements = <InterfaceElementImpl>[
|
||||
...unitElement.classes,
|
||||
...unitElement.enums,
|
||||
...unitElement.mixins,
|
||||
|
@ -36,7 +36,7 @@ class ConstructorInitializerResolver {
|
|||
|
||||
void _constructor(
|
||||
CompilationUnitElementImpl unitElement,
|
||||
AbstractClassElementImpl classElement,
|
||||
InterfaceElementImpl classElement,
|
||||
ConstructorElementImpl element,
|
||||
) {
|
||||
if (element.isSynthetic) return;
|
||||
|
|
|
@ -1241,7 +1241,7 @@ class ElementBuilder extends ThrowingAstVisitor<void> {
|
|||
node?.accept(this);
|
||||
}
|
||||
|
||||
void _resolveConstructorFieldFormals(AbstractClassElementImpl element) {
|
||||
void _resolveConstructorFieldFormals(InterfaceElementImpl element) {
|
||||
for (var constructor in element.constructors) {
|
||||
for (var parameter in constructor.parameters) {
|
||||
if (parameter is FieldFormalParameterElementImpl) {
|
||||
|
|
|
@ -362,14 +362,14 @@ class TypesBuilder {
|
|||
);
|
||||
}
|
||||
|
||||
static InterfaceType _objectType(AbstractClassElementImpl element) {
|
||||
static InterfaceType _objectType(InterfaceElementImpl element) {
|
||||
return element.library.typeProvider.objectType;
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs mixins inference in a [ClassDeclaration].
|
||||
class _MixinInference {
|
||||
final AbstractClassElementImpl element;
|
||||
final InterfaceElementImpl element;
|
||||
final TypeSystemImpl typeSystem;
|
||||
final FeatureSet featureSet;
|
||||
final InterfaceType classType;
|
||||
|
@ -534,15 +534,14 @@ class _MixinsInference {
|
|||
/// we are inferring the [element] now, i.e. there is a loop.
|
||||
///
|
||||
/// This is an error. So, we return the empty list, and break the loop.
|
||||
List<InterfaceType> _callbackWhenLoop(AbstractClassElementImpl element) {
|
||||
List<InterfaceType> _callbackWhenLoop(InterfaceElementImpl element) {
|
||||
element.mixinInferenceCallback = null;
|
||||
return <InterfaceType>[];
|
||||
}
|
||||
|
||||
/// This method is invoked when mixins are asked from the [element], and
|
||||
/// we are not inferring the [element] now, i.e. there is no loop.
|
||||
List<InterfaceType>? _callbackWhenRecursion(
|
||||
AbstractClassElementImpl element) {
|
||||
List<InterfaceType>? _callbackWhenRecursion(InterfaceElementImpl element) {
|
||||
var node = _linker.getLinkingNode(element);
|
||||
if (node != null) {
|
||||
_inferDeclaration(node);
|
||||
|
@ -551,7 +550,7 @@ class _MixinsInference {
|
|||
return null;
|
||||
}
|
||||
|
||||
void _infer(AbstractClassElementImpl element, WithClause? withClause) {
|
||||
void _infer(InterfaceElementImpl element, WithClause? withClause) {
|
||||
if (withClause != null) {
|
||||
element.mixinInferenceCallback = _callbackWhenLoop;
|
||||
try {
|
||||
|
|
|
@ -303,7 +303,7 @@ class InstanceMemberInferrer {
|
|||
/// [classElement].
|
||||
void _inferClass(InterfaceElement classElement) {
|
||||
_setInducedModifier(classElement);
|
||||
if (classElement is AbstractClassElementImpl) {
|
||||
if (classElement is InterfaceElementImpl) {
|
||||
if (classElement.hasBeenInferred) {
|
||||
return;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ class InstanceMemberInferrer {
|
|||
);
|
||||
}
|
||||
for (var method in classElement.methods) {
|
||||
_inferExecutable(method as MethodElementImpl);
|
||||
_inferExecutable(method);
|
||||
}
|
||||
//
|
||||
// Infer initializing formal parameter types. This must happen after
|
||||
|
|
|
@ -374,7 +374,7 @@ class MigrationResolutionHooksImpl
|
|||
}
|
||||
|
||||
@override
|
||||
List<InterfaceType> getClassInterfaces(AbstractClassElementImpl element) {
|
||||
List<InterfaceType> getClassInterfaces(InterfaceElementImpl element) {
|
||||
return _wrapExceptions(
|
||||
_fixBuilder.unit,
|
||||
() => element.interfacesInternal,
|
||||
|
|
Loading…
Reference in a new issue