Skip to content

Commit 0911330

Browse files
pqCommit Queue
authored andcommitted
[element model] migrate LibraryVerificationContext
Change-Id: Ib969b04aa5e8a265c8a01b57cecc67d956438cfa Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409481 Auto-Submit: Phil Quitslund <[email protected]> Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent f37db84 commit 0911330

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

pkg/analyzer/lib/src/generated/error_verifier.dart

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
833833

834834
var members = node.members;
835835
_checkForRepeatedType(
836-
libraryContext.setOfImplements(firstFragment),
836+
libraryContext.setOfImplements(firstFragment.asElement2),
837837
node.implementsClause?.interfaces,
838838
CompileTimeErrorCode.IMPLEMENTS_REPEATED,
839839
);
@@ -1908,7 +1908,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
19081908
!_checkForNoGenerativeConstructorsInSuperclass(superclass)) {
19091909
_checkForExtendsDeferredClass(superclass);
19101910
_checkForRepeatedType(
1911-
libraryContext.setOfImplements(declarationElement),
1911+
libraryContext.setOfImplements(declarationElement.asElement2),
19121912
implementsClause?.interfaces,
19131913
CompileTimeErrorCode.IMPLEMENTS_REPEATED,
19141914
);
@@ -2115,7 +2115,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
21152115
// check exported names
21162116
Namespace namespace =
21172117
NamespaceBuilder().createExportNamespaceForDirective(exportElement);
2118-
Map<String, Element> definedNames = namespace.definedNames;
2118+
Map<String, Element2> definedNames = namespace.definedNames2;
21192119
for (String name in definedNames.keys) {
21202120
var element = definedNames[name]!;
21212121
var prevElement = libraryContext._exportedElements[name];
@@ -2125,8 +2125,8 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
21252125
CompileTimeErrorCode.AMBIGUOUS_EXPORT,
21262126
arguments: [
21272127
name,
2128-
prevElement.library!.definingCompilationUnit.source.uri,
2129-
element.library!.definingCompilationUnit.source.uri
2128+
prevElement.library2!.firstFragment.source.uri,
2129+
element.library2!.firstFragment.source.uri
21302130
],
21312131
);
21322132
return;
@@ -5206,7 +5206,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
52065206
}
52075207

52085208
void _checkForRepeatedType(
5209-
Set<InstanceElement> accumulatedElements,
5209+
Set<InstanceElement2> accumulatedElements,
52105210
List<NamedType>? namedTypes,
52115211
ErrorCode errorCode,
52125212
) {
@@ -5217,13 +5217,13 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
52175217
for (var namedType in namedTypes) {
52185218
var type = namedType.type;
52195219
if (type is InterfaceType) {
5220-
var element = type.element;
5220+
var element = type.element3;
52215221
var added = accumulatedElements.add(element);
52225222
if (!added) {
52235223
errorReporter.atNode(
52245224
namedType,
52255225
errorCode,
5226-
arguments: [element.name],
5226+
arguments: [element.name3!],
52275227
);
52285228
}
52295229
}
@@ -6144,12 +6144,12 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
61446144
!_checkForImplementsClauseErrorCodes(implementsClause)) {
61456145
// _checkForImplicitDynamicType(superclass);
61466146
_checkForRepeatedType(
6147-
libraryContext.setOfOn(declarationElement),
6147+
libraryContext.setOfOn(declarationElement.asElement2),
61486148
onClause?.superclassConstraints,
61496149
CompileTimeErrorCode.ON_REPEATED,
61506150
);
61516151
_checkForRepeatedType(
6152-
libraryContext.setOfImplements(declarationElement),
6152+
libraryContext.setOfImplements(declarationElement.asElement2),
61536153
implementsClause?.interfaces,
61546154
CompileTimeErrorCode.IMPLEMENTS_REPEATED,
61556155
);
@@ -6663,16 +6663,17 @@ class LibraryVerificationContext {
66636663
final Map<FileState, FileAnalysis> files;
66646664

66656665
/// A table mapping names to the exported elements.
6666-
final Map<String, Element> _exportedElements = {};
6666+
final Map<String, Element2> _exportedElements = {};
66676667

66686668
/// Elements referenced in `implements` clauses.
66696669
/// Key: the declaration element.
6670-
final Map<InstanceElement, Set<InstanceElement>> _setOfImplementsMap =
6670+
final Map<InstanceElement2, Set<InstanceElement2>> _setOfImplementsMap =
66716671
Map.identity();
66726672

66736673
/// Elements referenced in `on` clauses.
66746674
/// Key: the declaration element.
6675-
final Map<MixinElement, Set<InterfaceElement>> _setOfOnMaps = Map.identity();
6675+
final Map<MixinElement2, Set<InterfaceElement2>> _setOfOnMaps =
6676+
Map.identity();
66766677

66776678
LibraryVerificationContext({
66786679
required this.libraryKind,
@@ -6684,11 +6685,11 @@ class LibraryVerificationContext {
66846685
return libraryKind.libraryCycle.libraryUris.contains(uri);
66856686
}
66866687

6687-
Set<InstanceElement> setOfImplements(InstanceElement declaration) {
6688+
Set<InstanceElement2> setOfImplements(InstanceElement2 declaration) {
66886689
return _setOfImplementsMap[declaration] ??= Set.identity();
66896690
}
66906691

6691-
Set<InterfaceElement> setOfOn(MixinElement declaration) {
6692+
Set<InterfaceElement2> setOfOn(MixinElement2 declaration) {
66926693
return _setOfOnMaps[declaration] ??= Set.identity();
66936694
}
66946695
}

0 commit comments

Comments
 (0)