Deprecate NodeList<TypeName> getters and replace with NodeList<NamedType>.

Change-Id: I6a772a7bca75e9c2ab4b3612d51c04ea6114ed6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214130
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Konstantin Shcheglov 2021-09-22 16:25:56 +00:00 committed by commit-bot@chromium.org
parent 6c4b75237a
commit dfd7d7b37a
26 changed files with 210 additions and 130 deletions

View file

@ -775,7 +775,7 @@ class CodeShapeDataCollector extends RecursiveAstVisitor<void> {
@override
void visitImplementsClause(ImplementsClause node) {
_visitChildren(node, {
'interfaces': node.interfaces,
'interfaces': node.interfaces2,
});
super.visitImplementsClause(node);
}
@ -976,7 +976,7 @@ class CodeShapeDataCollector extends RecursiveAstVisitor<void> {
@override
void visitOnClause(OnClause node) {
_visitChildren(node, {
'superclassConstraints': node.superclassConstraints,
'superclassConstraints': node.superclassConstraints2,
});
super.visitOnClause(node);
}
@ -1286,7 +1286,7 @@ class CodeShapeDataCollector extends RecursiveAstVisitor<void> {
@override
void visitWithClause(WithClause node) {
_visitChildren(node, {
'mixinTypes': node.mixinTypes,
'mixinTypes': node.mixinTypes2,
});
super.visitWithClause(node);
}

View file

@ -845,7 +845,7 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
@override
void visitImplementsClause(ImplementsClause node) {
// At the start of each type name.
for (var namedType in node.interfaces) {
for (var namedType in node.interfaces2) {
_recordDataForNode('ImplementsClause (type)', namedType);
}
super.visitImplementsClause(node);
@ -1062,7 +1062,7 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
@override
void visitOnClause(OnClause node) {
for (var constraint in node.superclassConstraints) {
for (var constraint in node.superclassConstraints2) {
_recordDataForNode('OnClause (type)', constraint);
}
super.visitOnClause(node);
@ -1351,7 +1351,7 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
@override
void visitWithClause(WithClause node) {
for (var namedType in node.mixinTypes) {
for (var namedType in node.mixinTypes2) {
_recordDataForNode('WithClause (type)', namedType);
}
super.visitWithClause(node);

View file

@ -819,7 +819,7 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
@override
void visitImplementsClause(ImplementsClause node) {
// At the start of each type name.
for (var namedType in node.interfaces) {
for (var namedType in node.interfaces2) {
_recordDataForNode('ImplementsClause_interface', namedType);
}
super.visitImplementsClause(node);
@ -992,7 +992,7 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
@override
void visitOnClause(OnClause node) {
for (var constraint in node.superclassConstraints) {
for (var constraint in node.superclassConstraints2) {
_recordDataForNode('OnClause_superclassConstraint', constraint);
}
super.visitOnClause(node);
@ -1251,7 +1251,7 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
@override
void visitWithClause(WithClause node) {
for (var namedType in node.mixinTypes) {
for (var namedType in node.mixinTypes2) {
_recordDataForNode('WithClause_mixinType', namedType);
}
super.visitWithClause(node);

View file

@ -2577,7 +2577,11 @@ abstract class ImplementsClause implements AstNode {
Token get implementsKeyword;
/// Return the list of the interfaces that are being implemented.
@Deprecated('Use interfaces2 instead')
NodeList<TypeName> get interfaces;
/// Return the list of the interfaces that are being implemented.
NodeList<NamedType> get interfaces2;
}
/// An import directive.
@ -3402,7 +3406,11 @@ abstract class OnClause implements AstNode {
Token get onKeyword;
/// Return the list of the classes are superclass constraints for the mixin.
@Deprecated('Use superclassConstraints2 instead')
NodeList<TypeName> get superclassConstraints;
/// Return the list of the classes are superclass constraints for the mixin.
NodeList<NamedType> get superclassConstraints2;
}
/// A parenthesized expression.
@ -4450,8 +4458,12 @@ abstract class WhileStatement implements Statement {
/// Clients may not extend, implement or mix-in this class.
abstract class WithClause implements AstNode {
/// Return the names of the mixins that were specified.
@Deprecated('Use mixinTypes2 instead')
NodeList<TypeName> get mixinTypes;
/// Return the names of the mixins that were specified.
NodeList<NamedType> get mixinTypes2;
/// Return the token representing the 'with' keyword.
Token get withKeyword;
}

View file

@ -88,9 +88,9 @@ class ReferenceCollector {
// Parts of classes.
_visitTypeAnnotation(extendsClause?.superclass);
_visitTypeAnnotation(superClass);
_visitTypeAnnotations(withClause?.mixinTypes);
_visitTypeAnnotations(onClause?.superclassConstraints);
_visitTypeAnnotations(implementsClause?.interfaces);
_visitTypeAnnotations(withClause?.mixinTypes2);
_visitTypeAnnotations(onClause?.superclassConstraints2);
_visitTypeAnnotations(implementsClause?.interfaces2);
// Parts of executables.
_visitFormalParameterList(formalParameters);

View file

@ -660,7 +660,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
@override
void visitImplementsClause(ImplementsClause node) {
for (NamedType namedType in node.interfaces) {
for (NamedType namedType in node.interfaces2) {
recordSuperType(namedType, IndexRelationKind.IS_IMPLEMENTED_BY);
}
}
@ -713,7 +713,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
@override
void visitOnClause(OnClause node) {
for (NamedType namedType in node.superclassConstraints) {
for (NamedType namedType in node.superclassConstraints2) {
recordSuperType(namedType, IndexRelationKind.IS_IMPLEMENTED_BY);
}
}
@ -830,7 +830,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
@override
void visitWithClause(WithClause node) {
for (NamedType namedType in node.mixinTypes) {
for (NamedType namedType in node.mixinTypes2) {
recordSuperType(namedType, IndexRelationKind.IS_MIXED_IN_BY);
}
}
@ -862,9 +862,9 @@ class _IndexContributor extends GeneralizingAstVisitor {
}
addSupertype(superclass);
withClause?.mixinTypes.forEach(addSupertype);
onClause?.superclassConstraints.forEach(addSupertype);
implementsClause?.interfaces.forEach(addSupertype);
withClause?.mixinTypes2.forEach(addSupertype);
onClause?.superclassConstraints2.forEach(addSupertype);
implementsClause?.interfaces2.forEach(addSupertype);
void addMemberName(SimpleIdentifier identifier) {
String name = identifier.name;

View file

@ -35,15 +35,15 @@ Set<String> computeSubtypedNames(CompilationUnit unit) {
for (CompilationUnitMember declaration in unit.declarations) {
if (declaration is ClassDeclaration) {
_addSubtypedName(declaration.extendsClause?.superclass);
_addSubtypedNames(declaration.withClause?.mixinTypes);
_addSubtypedNames(declaration.implementsClause?.interfaces);
_addSubtypedNames(declaration.withClause?.mixinTypes2);
_addSubtypedNames(declaration.implementsClause?.interfaces2);
} else if (declaration is ClassTypeAlias) {
_addSubtypedName(declaration.superclass);
_addSubtypedNames(declaration.withClause.mixinTypes);
_addSubtypedNames(declaration.implementsClause?.interfaces);
_addSubtypedNames(declaration.withClause.mixinTypes2);
_addSubtypedNames(declaration.implementsClause?.interfaces2);
} else if (declaration is MixinDeclaration) {
_addSubtypedNames(declaration.onClause?.superclassConstraints);
_addSubtypedNames(declaration.implementsClause?.interfaces);
_addSubtypedNames(declaration.onClause?.superclassConstraints2);
_addSubtypedNames(declaration.implementsClause?.interfaces2);
}
}

View file

@ -5756,11 +5756,11 @@ class ImplementsClauseImpl extends AstNodeImpl implements ImplementsClause {
Token implementsKeyword;
/// The interfaces that are being implemented.
final NodeListImpl<TypeName> _interfaces = NodeListImpl._();
final NodeListImpl<NamedType> _interfaces = NodeListImpl._();
/// Initialize a newly created implements clause.
ImplementsClauseImpl(this.implementsKeyword, List<NamedType> interfaces) {
_interfaces._initialize2(this, interfaces);
_interfaces._initialize(this, interfaces);
}
@override
@ -5770,13 +5770,17 @@ class ImplementsClauseImpl extends AstNodeImpl implements ImplementsClause {
// TODO(paulberry): add commas.
Iterable<SyntacticEntity> get childEntities => ChildEntities()
..add(implementsKeyword)
..addAll(interfaces);
..addAll(interfaces2);
@override
Token get endToken => _interfaces.endToken!;
@Deprecated('Use interfaces2 instead')
@override
NodeListImpl<TypeName> get interfaces => _interfaces;
NodeList<TypeName> get interfaces => _DelegatingTypeNameList(_interfaces);
@override
NodeListImpl<NamedType> get interfaces2 => _interfaces;
@override
E? accept<E>(AstVisitor<E> visitor) => visitor.visitImplementsClause(this);
@ -7635,20 +7639,6 @@ class NodeListImpl<E extends AstNode> with ListMixin<E> implements NodeList<E> {
}
}
}
/// Set the [owner] of this container, and populate it with [elements].
/// TODO(scheglov) Remove this method, it exists only to implicitly cast.
void _initialize2<E2>(AstNodeImpl owner, List<E2>? elements) {
_owner = owner;
if (elements != null) {
var length = elements.length;
for (var i = 0; i < length; i++) {
var node = elements[i] as E;
_elements.add(node);
owner._becomeParentOf(node as AstNodeImpl);
}
}
}
}
/// A formal parameter that is required (is not optional).
@ -7836,11 +7826,11 @@ class OnClauseImpl extends AstNodeImpl implements OnClause {
Token onKeyword;
/// The classes are super-class constraints for the mixin.
final NodeListImpl<TypeName> _superclassConstraints = NodeListImpl._();
final NodeListImpl<NamedType> _superclassConstraints = NodeListImpl._();
/// Initialize a newly created on clause.
OnClauseImpl(this.onKeyword, List<NamedType> superclassConstraints) {
_superclassConstraints._initialize2(this, superclassConstraints);
_superclassConstraints._initialize(this, superclassConstraints);
}
@override
@ -7856,7 +7846,11 @@ class OnClauseImpl extends AstNodeImpl implements OnClause {
Token get endToken => _superclassConstraints.endToken!;
@override
NodeListImpl<TypeName> get superclassConstraints => _superclassConstraints;
NodeList<TypeName> get superclassConstraints =>
_DelegatingTypeNameList(_superclassConstraints);
@override
NodeListImpl<NamedType> get superclassConstraints2 => _superclassConstraints;
@override
E? accept<E>(AstVisitor<E> visitor) => visitor.visitOnClause(this);
@ -10877,11 +10871,11 @@ class WithClauseImpl extends AstNodeImpl implements WithClause {
Token withKeyword;
/// The names of the mixins that were specified.
final NodeListImpl<TypeName> _mixinTypes = NodeListImpl._();
final NodeListImpl<NamedType> _mixinTypes = NodeListImpl._();
/// Initialize a newly created with clause.
WithClauseImpl(this.withKeyword, List<NamedType> mixinTypes) {
_mixinTypes._initialize2(this, mixinTypes);
_mixinTypes._initialize(this, mixinTypes);
}
@override
@ -10896,8 +10890,12 @@ class WithClauseImpl extends AstNodeImpl implements WithClause {
@override
Token get endToken => _mixinTypes.endToken!;
@Deprecated('Use mixinTypes2 instead')
@override
NodeListImpl<TypeName> get mixinTypes => _mixinTypes;
NodeList<TypeName> get mixinTypes => _DelegatingTypeNameList(_mixinTypes);
@override
NodeListImpl<NamedType> get mixinTypes2 => _mixinTypes;
@override
E? accept<E>(AstVisitor<E> visitor) => visitor.visitWithClause(this);
@ -10968,6 +10966,76 @@ class YieldStatementImpl extends StatementImpl implements YieldStatement {
}
}
/// Implementation of `NodeList<TypeName>` that delegates.
class _DelegatingTypeNameList
with ListMixin<TypeName>
implements NodeList<TypeName> {
final NodeListImpl<NamedType> _delegate;
_DelegatingTypeNameList(this._delegate);
@override
Token? get beginToken {
return _delegate.beginToken;
}
@override
Token? get endToken {
return _delegate.endToken;
}
@override
int get length => _delegate.length;
@override
set length(int newLength) {
_delegate.length = newLength;
}
@override
AstNodeImpl get owner => _delegate.owner;
@override
TypeName operator [](int index) {
return _delegate[index] as TypeName;
}
@override
void operator []=(int index, TypeName node) {
_delegate[index] = node;
}
@override
void accept(AstVisitor visitor) {
_delegate.accept(visitor);
}
@override
void add(NamedType node) {
_delegate.add(node);
}
@override
void addAll(Iterable<TypeName> nodes) {
_delegate.addAll(nodes);
}
@override
void clear() {
_delegate.clear();
}
@override
void insert(int index, TypeName node) {
_delegate.insert(index, node);
}
@override
TypeName removeAt(int index) {
return _delegate.removeAt(index) as TypeName;
}
}
/// An indication of the resolved kind of a [SetOrMapLiteral].
enum _SetOrMapKind {
/// Indicates that the literal represents a map.

View file

@ -600,7 +600,7 @@ class ToSourceVisitor implements AstVisitor<void> {
@override
void visitImplementsClause(ImplementsClause node) {
sink.write('implements ');
_visitNodeList(node.interfaces, separator: ', ');
_visitNodeList(node.interfaces2, separator: ', ');
}
@override
@ -776,7 +776,7 @@ class ToSourceVisitor implements AstVisitor<void> {
@override
void visitOnClause(OnClause node) {
sink.write('on ');
_visitNodeList(node.superclassConstraints, separator: ', ');
_visitNodeList(node.superclassConstraints2, separator: ', ');
}
@override
@ -1072,7 +1072,7 @@ class ToSourceVisitor implements AstVisitor<void> {
@override
void visitWithClause(WithClause node) {
sink.write('with ');
_visitNodeList(node.mixinTypes, separator: ', ');
_visitNodeList(node.mixinTypes2, separator: ', ');
}
@override

View file

@ -718,7 +718,7 @@ class AstComparator implements AstVisitor<bool> {
bool visitImplementsClause(ImplementsClause node) {
ImplementsClause other = _other as ImplementsClause;
return isEqualTokens(node.implementsKeyword, other.implementsKeyword) &&
_isEqualNodeLists(node.interfaces, other.interfaces);
_isEqualNodeLists(node.interfaces2, other.interfaces2);
}
@override
@ -908,7 +908,7 @@ class AstComparator implements AstVisitor<bool> {
OnClause other = _other as OnClause;
return isEqualTokens(node.onKeyword, other.onKeyword) &&
_isEqualNodeLists(
node.superclassConstraints, other.superclassConstraints);
node.superclassConstraints2, other.superclassConstraints2);
}
@override
@ -1246,7 +1246,7 @@ class AstComparator implements AstVisitor<bool> {
bool visitWithClause(WithClause node) {
WithClause other = _other as WithClause;
return isEqualTokens(node.withKeyword, other.withKeyword) &&
_isEqualNodeLists(node.mixinTypes, other.mixinTypes);
_isEqualNodeLists(node.mixinTypes2, other.mixinTypes2);
}
@override
@ -2325,7 +2325,7 @@ class NodeReplacer implements AstVisitor<bool> {
@override
bool visitImplementsClause(covariant ImplementsClauseImpl node) {
if (_replaceInList(node.interfaces)) {
if (_replaceInList(node.interfaces2)) {
return true;
}
return visitNode(node);
@ -2933,7 +2933,7 @@ class NodeReplacer implements AstVisitor<bool> {
@override
bool visitWithClause(covariant WithClauseImpl node) {
if (_replaceInList(node.mixinTypes)) {
if (_replaceInList(node.mixinTypes2)) {
return true;
}
return visitNode(node);
@ -2948,7 +2948,7 @@ class NodeReplacer implements AstVisitor<bool> {
return visitNode(node);
}
bool _replaceInList(NodeListImpl list) {
bool _replaceInList(NodeList list) {
int count = list.length;
for (int i = 0; i < count; i++) {
if (identical(_oldNode, list[i])) {

View file

@ -1223,7 +1223,7 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
if (clause == null) return;
_resolveTypes(
clause.interfaces,
clause.interfaces2,
CompileTimeErrorCode.IMPLEMENTS_NON_CLASS,
);
}
@ -1232,7 +1232,7 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
if (clause == null) return;
_resolveTypes(
clause.superclassConstraints,
clause.superclassConstraints2,
CompileTimeErrorCode.MIXIN_SUPER_CLASS_CONSTRAINT_NON_INTERFACE,
);
}
@ -1302,7 +1302,7 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
void _resolveWithClause(WithClause? clause) {
if (clause == null) return;
for (var namedType in clause.mixinTypes) {
for (var namedType in clause.mixinTypes2) {
_typeNameResolver.withClause_namedType = namedType;
_resolveType(
namedType as TypeNameImpl,

View file

@ -152,7 +152,7 @@ class _ClassVerifier {
// class C extends S&M2 { ...members of C... }
// So, we need to check members of each mixin against superinterfaces
// of `S`, and superinterfaces of all previous mixins.
var mixinNodes = withClause?.mixinTypes;
var mixinNodes = withClause?.mixinTypes2;
var mixinTypes = classElement.mixins;
for (var i = 0; i < mixinTypes.length; i++) {
var mixinType = mixinTypes[i];
@ -347,7 +347,7 @@ class _ClassVerifier {
bool _checkDirectSuperTypes() {
var hasError = false;
if (implementsClause != null) {
for (var namedType in implementsClause!.interfaces) {
for (var namedType in implementsClause!.interfaces2) {
if (_checkDirectSuperType(
namedType,
CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS,
@ -357,7 +357,7 @@ class _ClassVerifier {
}
}
if (onClause != null) {
for (var namedType in onClause!.superclassConstraints) {
for (var namedType in onClause!.superclassConstraints2) {
if (_checkDirectSuperType(
namedType,
CompileTimeErrorCode.MIXIN_SUPER_CLASS_CONSTRAINT_DISALLOWED_CLASS,
@ -375,7 +375,7 @@ class _ClassVerifier {
}
}
if (withClause != null) {
for (var namedType in withClause!.mixinTypes) {
for (var namedType in withClause!.mixinTypes2) {
if (_checkDirectSuperType(
namedType,
CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS,

View file

@ -3436,15 +3436,15 @@ class AstBuilder extends StackListener {
if (declaration.withClause == null) {
declaration.withClause = withClause;
} else {
declaration.withClause!.mixinTypes.addAll(withClause.mixinTypes);
declaration.withClause!.mixinTypes2.addAll(withClause.mixinTypes2);
}
}
if (implementsClause != null) {
if (declaration.implementsClause == null) {
declaration.implementsClause = implementsClause;
} else {
declaration.implementsClause!.interfaces
.addAll(implementsClause.interfaces);
declaration.implementsClause!.interfaces2
.addAll(implementsClause.interfaces2);
}
}
}
@ -3486,16 +3486,16 @@ class AstBuilder extends StackListener {
if (mixinDeclaration!.onClause == null) {
mixinDeclaration!.onClause = onClause;
} else {
mixinDeclaration!.onClause!.superclassConstraints
.addAll(onClause.superclassConstraints);
mixinDeclaration!.onClause!.superclassConstraints2
.addAll(onClause.superclassConstraints2);
}
}
if (implementsClause != null) {
if (mixinDeclaration!.implementsClause == null) {
mixinDeclaration!.implementsClause = implementsClause;
} else {
mixinDeclaration!.implementsClause!.interfaces
.addAll(implementsClause.interfaces);
mixinDeclaration!.implementsClause!.interfaces2
.addAll(implementsClause.interfaces2);
}
}
}

View file

@ -833,7 +833,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
@override
void visitImplementsClause(ImplementsClause node) {
node.interfaces.forEach(_checkForImplicitDynamicType);
node.interfaces2.forEach(_checkForImplicitDynamicType);
super.visitImplementsClause(node);
}
@ -1289,7 +1289,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
@override
void visitWithClause(WithClause node) {
node.mixinTypes.forEach(_checkForImplicitDynamicType);
node.mixinTypes2.forEach(_checkForImplicitDynamicType);
super.visitWithClause(node);
}
@ -1309,7 +1309,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
!_checkForNoGenerativeConstructorsInSuperclass(superclass)) {
_checkForImplicitDynamicType(superclass);
_checkForExtendsDeferredClass(superclass);
_checkForRepeatedType(implementsClause?.interfaces,
_checkForRepeatedType(implementsClause?.interfaces2,
CompileTimeErrorCode.IMPLEMENTS_REPEATED);
_checkImplementsSuperClass(implementsClause);
_checkMixinsSuperClass(withClause);
@ -1384,9 +1384,9 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
bool problemReported = false;
int mixinTypeIndex = -1;
for (int mixinNameIndex = 0;
mixinNameIndex < withClause.mixinTypes.length;
mixinNameIndex < withClause.mixinTypes2.length;
mixinNameIndex++) {
NamedType mixinName = withClause.mixinTypes[mixinNameIndex];
NamedType mixinName = withClause.mixinTypes2[mixinNameIndex];
DartType mixinType = mixinName.typeOrThrow;
if (mixinType is InterfaceType) {
mixinTypeIndex++;
@ -1624,7 +1624,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
}
if (implementsClause != null) {
for (var interface in implementsClause.interfaces) {
for (var interface in implementsClause.interfaces2) {
var type = interface.type;
if (type != null && type.isDartCoreFunction) {
errorReporter.reportErrorForNode(
@ -1637,7 +1637,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
}
if (withClause != null) {
for (NamedType type in withClause.mixinTypes) {
for (NamedType type in withClause.mixinTypes2) {
var mixinElement = type.name.staticElement;
if (mixinElement != null && mixinElement.name == "Function") {
errorReporter.reportErrorForNode(
@ -2539,7 +2539,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
return false;
}
bool foundError = false;
for (NamedType type in clause.interfaces) {
for (NamedType type in clause.interfaces2) {
if (_checkForExtendsOrImplementsDisallowedClass(
type, CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS)) {
foundError = true;
@ -3221,7 +3221,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
return false;
}
for (NamedType mixinType in withClause.mixinTypes) {
for (NamedType mixinType in withClause.mixinTypes2) {
DartType type = mixinType.typeOrThrow;
if (type is InterfaceType) {
LibraryElement library = type.element.library;
@ -3550,7 +3550,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
return false;
}
bool problemReported = false;
for (NamedType namedType in onClause.superclassConstraints) {
for (NamedType namedType in onClause.superclassConstraints2) {
DartType type = namedType.typeOrThrow;
if (type is InterfaceType) {
if (_checkForExtendsOrImplementsDisallowedClass(
@ -4615,7 +4615,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
return;
}
for (var interfaceNode in implementsClause.interfaces) {
for (var interfaceNode in implementsClause.interfaces2) {
var type = interfaceNode.type;
if (type is InterfaceType && type.element == superElement) {
errorReporter.reportErrorForNode(
@ -4638,7 +4638,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
var interfacesMerger = InterfacesMerger(typeSystem);
interfacesMerger.addWithSupertypes(supertype);
for (var namedType in withClause.mixinTypes) {
for (var namedType in withClause.mixinTypes2) {
var mixinType = namedType.type;
if (mixinType is InterfaceType) {
var mixinElement = mixinType.element;
@ -4687,11 +4687,11 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
!_checkForImplementsClauseErrorCodes(implementsClause)) {
// _checkForImplicitDynamicType(superclass);
_checkForRepeatedType(
onClause?.superclassConstraints,
onClause?.superclassConstraints2,
CompileTimeErrorCode.ON_REPEATED,
);
_checkForRepeatedType(
implementsClause?.interfaces,
implementsClause?.interfaces2,
CompileTimeErrorCode.IMPLEMENTS_REPEATED,
);
_checkForConflictingGenerics(node);
@ -4712,7 +4712,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
return;
}
for (var mixinNode in withClause.mixinTypes) {
for (var mixinNode in withClause.mixinTypes2) {
var type = mixinNode.type;
if (type is InterfaceType && type.element == superElement) {
errorReporter.reportErrorForNode(

View file

@ -116,14 +116,14 @@ class FfiVerifier extends RecursiveAstVisitor<void> {
var implementsClause = node.implementsClause;
if (implementsClause != null) {
for (NamedType type in implementsClause.interfaces) {
for (NamedType type in implementsClause.interfaces2) {
checkSupertype(type, FfiCode.SUBTYPE_OF_FFI_CLASS_IN_IMPLEMENTS,
FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS);
}
}
var withClause = node.withClause;
if (withClause != null) {
for (NamedType type in withClause.mixinTypes) {
for (NamedType type in withClause.mixinTypes2) {
checkSupertype(type, FfiCode.SUBTYPE_OF_FFI_CLASS_IN_WITH,
FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH);
}

View file

@ -570,7 +570,7 @@ class AstTextPrinter extends ThrowingAstVisitor<void> {
@override
void visitImplementsClause(ImplementsClause node) {
_token(node.implementsKeyword);
_nodeList(node.interfaces, node.endToken.next);
_nodeList(node.interfaces2, node.endToken.next);
}
@override
@ -731,7 +731,7 @@ class AstTextPrinter extends ThrowingAstVisitor<void> {
@override
void visitOnClause(OnClause node) {
_token(node.onKeyword);
_nodeList(node.superclassConstraints, node.endToken.next);
_nodeList(node.superclassConstraints2, node.endToken.next);
}
@override
@ -1003,7 +1003,7 @@ class AstTextPrinter extends ThrowingAstVisitor<void> {
@override
void visitWithClause(WithClause node) {
_token(node.withKeyword);
_nodeList(node.mixinTypes, node.endToken.next);
_nodeList(node.mixinTypes2, node.endToken.next);
}
@override

View file

@ -601,7 +601,7 @@ class ElementBuilder extends ThrowingAstVisitor<void> {
@override
void visitImplementsClause(ImplementsClause node) {
node.interfaces.accept(this);
node.interfaces2.accept(this);
}
@override
@ -746,7 +746,7 @@ class ElementBuilder extends ThrowingAstVisitor<void> {
@override
void visitOnClause(OnClause node) {
node.superclassConstraints.accept(this);
node.superclassConstraints2.accept(this);
}
@override
@ -895,7 +895,7 @@ class ElementBuilder extends ThrowingAstVisitor<void> {
@override
void visitWithClause(WithClause node) {
node.mixinTypes.accept(this);
node.mixinTypes2.accept(this);
}
List<ElementAnnotation> _buildAnnotations(List<Annotation> nodeList) {

View file

@ -273,7 +273,7 @@ class ReferenceResolver extends ThrowingAstVisitor<void> {
@override
void visitImplementsClause(ImplementsClause node) {
node.interfaces.accept(this);
node.interfaces2.accept(this);
}
@override
@ -316,7 +316,7 @@ class ReferenceResolver extends ThrowingAstVisitor<void> {
@override
void visitOnClause(OnClause node) {
node.superclassConstraints.accept(this);
node.superclassConstraints2.accept(this);
}
@override
@ -412,7 +412,7 @@ class ReferenceResolver extends ThrowingAstVisitor<void> {
@override
void visitWithClause(WithClause node) {
node.mixinTypes.accept(this);
node.mixinTypes2.accept(this);
}
NullabilitySuffix _getNullabilitySuffix(bool hasQuestion) {

View file

@ -135,11 +135,11 @@ class TypesBuilder {
}
element.mixins = _toInterfaceTypeList(
node.withClause?.mixinTypes,
node.withClause?.mixinTypes2,
);
element.interfaces = _toInterfaceTypeList(
node.implementsClause?.interfaces,
node.implementsClause?.interfaces2,
);
}
@ -154,11 +154,11 @@ class TypesBuilder {
}
element.mixins = _toInterfaceTypeList(
node.withClause.mixinTypes,
node.withClause.mixinTypes2,
);
element.interfaces = _toInterfaceTypeList(
node.implementsClause?.interfaces,
node.implementsClause?.interfaces2,
);
}
@ -286,7 +286,7 @@ class TypesBuilder {
var element = node.declaredElement as MixinElementImpl;
var constraints = _toInterfaceTypeList(
node.onClause?.superclassConstraints,
node.onClause?.superclassConstraints2,
);
if (constraints.isEmpty) {
constraints = [_objectType(element)];
@ -294,7 +294,7 @@ class TypesBuilder {
element.superclassConstraints = constraints;
element.interfaces = _toInterfaceTypeList(
node.implementsClause?.interfaces,
node.implementsClause?.interfaces2,
);
}
@ -363,7 +363,7 @@ class _MixinInference {
void perform(WithClause? withClause) {
if (withClause == null) return;
for (var mixinNode in withClause.mixinTypes) {
for (var mixinNode in withClause.mixinTypes2) {
var mixinType = _inferSingle(mixinNode as TypeNameImpl);
interfacesMerger.addWithSupertypes(mixinType);
}
@ -513,7 +513,7 @@ class _MixinsInference {
} finally {
element.mixinInferenceCallback = null;
element.mixins = _toInterfaceTypeList(
withClause.mixinTypes,
withClause.mixinTypes2,
);
}
}

View file

@ -1381,7 +1381,7 @@ abstract class Foo {}
ImplementsClause clause = parseImplementsClause('implements A, B, C');
expectNotNullIfNoErrors(clause);
assertNoErrors();
expect(clause.interfaces, hasLength(3));
expect(clause.interfaces2, hasLength(3));
expect(clause.implementsKeyword, isNotNull);
}
@ -1389,7 +1389,7 @@ abstract class Foo {}
ImplementsClause clause = parseImplementsClause('implements A');
expectNotNullIfNoErrors(clause);
assertNoErrors();
expect(clause.interfaces, hasLength(1));
expect(clause.interfaces2, hasLength(1));
expect(clause.implementsKeyword, isNotNull);
}
@ -2077,7 +2077,7 @@ Function<A>(core.List<core.int> x) m() => null;
expectNotNullIfNoErrors(clause);
assertNoErrors();
expect(clause.withKeyword, isNotNull);
expect(clause.mixinTypes, hasLength(3));
expect(clause.mixinTypes2, hasLength(3));
}
void test_parseWithClause_single() {
@ -2085,7 +2085,7 @@ Function<A>(core.List<core.int> x) m() => null;
expectNotNullIfNoErrors(clause);
assertNoErrors();
expect(clause.withKeyword, isNotNull);
expect(clause.mixinTypes, hasLength(1));
expect(clause.mixinTypes2, hasLength(1));
}
void test_typeAlias_37733() {

View file

@ -398,7 +398,7 @@ class A native 'something' {
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.implementsClause, isNotNull);
expect(typeAlias.implementsClause!.implementsKeyword, isNotNull);
expect(typeAlias.implementsClause!.interfaces.length, 1);
expect(typeAlias.implementsClause!.interfaces2.length, 1);
expect(typeAlias.semicolon, isNotNull);
}
@ -414,7 +414,7 @@ class A native 'something' {
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.withClause.withKeyword, isNotNull);
expect(typeAlias.withClause.mixinTypes.length, 1);
expect(typeAlias.withClause.mixinTypes2.length, 1);
expect(typeAlias.implementsClause, isNull);
expect(typeAlias.semicolon, isNotNull);
}
@ -1949,7 +1949,7 @@ enum E {
expect(declaration.onClause, isNull);
var implementsClause = declaration.implementsClause!;
expect(implementsClause.implementsKeyword, isNotNull);
NodeList<NamedType> interfaces = implementsClause.interfaces;
NodeList<NamedType> interfaces = implementsClause.interfaces2;
expect(interfaces, hasLength(1));
expect(interfaces[0].name.name, 'B');
expect(interfaces[0].typeArguments, isNull);
@ -1971,7 +1971,7 @@ enum E {
expect(declaration.onClause, isNull);
var implementsClause = declaration.implementsClause!;
expect(implementsClause.implementsKeyword, isNotNull);
NodeList<NamedType> interfaces = implementsClause.interfaces;
NodeList<NamedType> interfaces = implementsClause.interfaces2;
expect(interfaces, hasLength(2));
expect(interfaces[0].name.name, 'B');
expect(interfaces[0].typeArguments!.arguments, hasLength(1));
@ -2013,7 +2013,7 @@ enum E {
expect(declaration.documentationComment, isNull);
var onClause = declaration.onClause!;
expect(onClause.onKeyword, isNotNull);
NodeList<NamedType> constraints = onClause.superclassConstraints;
NodeList<NamedType> constraints = onClause.superclassConstraints2;
expect(constraints, hasLength(1));
expect(constraints[0].name.name, 'B');
expect(constraints[0].typeArguments, isNull);
@ -2035,7 +2035,7 @@ enum E {
expect(declaration.documentationComment, isNull);
var onClause = declaration.onClause!;
expect(onClause.onKeyword, isNotNull);
NodeList<NamedType> constraints = onClause.superclassConstraints;
NodeList<NamedType> constraints = onClause.superclassConstraints2;
expect(constraints, hasLength(2));
expect(constraints[0].name.name, 'B');
expect(constraints[0].typeArguments, isNull);
@ -2059,13 +2059,13 @@ enum E {
expect(declaration.documentationComment, isNull);
var onClause = declaration.onClause!;
expect(onClause.onKeyword, isNotNull);
NodeList<NamedType> constraints = onClause.superclassConstraints;
NodeList<NamedType> constraints = onClause.superclassConstraints2;
expect(constraints, hasLength(1));
expect(constraints[0].name.name, 'B');
expect(constraints[0].typeArguments, isNull);
var implementsClause = declaration.implementsClause!;
expect(implementsClause.implementsKeyword, isNotNull);
NodeList<NamedType> interfaces = implementsClause.interfaces;
NodeList<NamedType> interfaces = implementsClause.interfaces2;
expect(interfaces, hasLength(1));
expect(interfaces[0].name.name, 'C');
expect(interfaces[0].typeArguments, isNull);

View file

@ -1225,7 +1225,7 @@ class ListGetter_NodeReplacerTest_test_implementsClause
ListGetter_NodeReplacerTest_test_implementsClause(int arg0) : super(arg0);
@override
NodeList<NamedType> getList(ImplementsClause node) => node.interfaces;
NodeList<NamedType> getList(ImplementsClause node) => node.interfaces2;
}
class ListGetter_NodeReplacerTest_test_labeledStatement
@ -1327,7 +1327,7 @@ class ListGetter_NodeReplacerTest_test_withClause
ListGetter_NodeReplacerTest_test_withClause(int arg0) : super(arg0);
@override
NodeList<NamedType> getList(WithClause node) => node.mixinTypes;
NodeList<NamedType> getList(WithClause node) => node.mixinTypes2;
}
class ListGetter_NodeReplacerTest_testAnnotatedNode

View file

@ -6963,7 +6963,7 @@ class D extends A<bool> with B<int> implements C<double> {}
nullabilitySuffix: NullabilitySuffix.none,
);
NamedType mixinType = dNode.withClause!.mixinTypes[0];
NamedType mixinType = dNode.withClause!.mixinTypes2[0];
expect(mixinType.type, expectedType);
var identifier = mixinType.name as SimpleIdentifier;
@ -6977,7 +6977,7 @@ class D extends A<bool> with B<int> implements C<double> {}
nullabilitySuffix: NullabilitySuffix.none,
);
NamedType implementedType = dNode.implementsClause!.interfaces[0];
NamedType implementedType = dNode.implementsClause!.interfaces2[0];
expect(implementedType.type, expectedType);
var identifier = implementedType.name as SimpleIdentifier;
@ -7032,7 +7032,7 @@ class D = A<bool> with B<int> implements C<double>;
nullabilitySuffix: NullabilitySuffix.none,
);
NamedType mixinType = dNode.withClause.mixinTypes[0];
NamedType mixinType = dNode.withClause.mixinTypes2[0];
expect(mixinType.type, expectedType);
var identifier = mixinType.name as SimpleIdentifier;
@ -7046,7 +7046,7 @@ class D = A<bool> with B<int> implements C<double>;
nullabilitySuffix: NullabilitySuffix.none,
);
NamedType interfaceType = dNode.implementsClause!.interfaces[0];
NamedType interfaceType = dNode.implementsClause!.interfaces2[0];
expect(interfaceType.type, expectedType);
var identifier = interfaceType.name as SimpleIdentifier;

View file

@ -814,7 +814,7 @@ class ResolvedAstPrinter extends ThrowingAstVisitor<void> {
_withIndent(() {
var properties = _Properties();
properties.addToken('implementsKeyword', node.implementsKeyword);
properties.addNodeList('interfaces', node.interfaces);
properties.addNodeList('interfaces', node.interfaces2);
_addAstNode(properties, node);
_writeProperties(properties);
});
@ -1053,7 +1053,7 @@ class ResolvedAstPrinter extends ThrowingAstVisitor<void> {
var properties = _Properties();
properties.addToken('onKeyword', node.onKeyword);
properties.addNodeList(
'superclassConstraints', node.superclassConstraints);
'superclassConstraints', node.superclassConstraints2);
_addAstNode(properties, node);
_writeProperties(properties);
});
@ -1531,7 +1531,7 @@ class ResolvedAstPrinter extends ThrowingAstVisitor<void> {
_withIndent(() {
var properties = _Properties();
properties.addToken('withKeyword', node.withKeyword);
properties.addNodeList('mixinTypes', node.mixinTypes);
properties.addNodeList('mixinTypes', node.mixinTypes2);
_addAstNode(properties, node);
_writeProperties(properties);
});

View file

@ -1408,7 +1408,7 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor<void> {
@override
void visitWithClause(WithClause node) {
if (node.mixinTypes.contains(entity)) {
if (node.mixinTypes2.contains(entity)) {
optype.completionLocation = 'WithClause_mixinType';
}
optype.includeTypeNameSuggestions = true;

View file

@ -871,13 +871,13 @@ class NodeBuilder extends GeneralizingAstVisitor<DecoratedType>
var supertypes = <NamedType?>[];
supertypes.add(superclass);
if (withClause != null) {
supertypes.addAll(withClause.mixinTypes);
supertypes.addAll(withClause.mixinTypes2);
}
if (implementsClause != null) {
supertypes.addAll(implementsClause.interfaces);
supertypes.addAll(implementsClause.interfaces2);
}
if (onClause != null) {
supertypes.addAll(onClause.superclassConstraints);
supertypes.addAll(onClause.superclassConstraints2);
}
var decoratedSupertypes = <ClassElement, DecoratedType?>{};
_pushNullabilityNodeTarget(