Deprecate 'get name2', use 'get name' instead.
Change-Id: Iee8ef5fb6700d96c857a22a99dc61dac3da88572
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260443
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analysis_server/lib/src/computer/computer_call_hierarchy.dart b/pkg/analysis_server/lib/src/computer/computer_call_hierarchy.dart
index 9312953..e857a2c 100644
--- a/pkg/analysis_server/lib/src/computer/computer_call_hierarchy.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_call_hierarchy.dart
@@ -332,7 +332,7 @@
}
}
} else if (node is ConstructorDeclaration) {
- final name = node.name2;
+ final name = node.name;
if (name != null && offset < name.offset) {
return null;
}
diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights.dart b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
index 369743c..a3af71d 100644
--- a/pkg/analysis_server/lib/src/computer/computer_highlights.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
@@ -665,7 +665,7 @@
computer._addRegion_token(
node.abstractKeyword, HighlightRegionType.BUILT_IN);
computer._addRegion_token(node.classKeyword, HighlightRegionType.KEYWORD);
- computer._addRegion_token(node.name2, HighlightRegionType.CLASS);
+ computer._addRegion_token(node.name, HighlightRegionType.CLASS);
super.visitClassDeclaration(node);
}
@@ -684,7 +684,7 @@
node.factoryKeyword, HighlightRegionType.BUILT_IN);
computer._addRegion_token(node.constKeyword, HighlightRegionType.KEYWORD);
computer._addRegion_token(
- node.name2,
+ node.name,
HighlightRegionType.CONSTRUCTOR,
semanticTokenType: SemanticTokenTypes.method,
semanticTokenModifiers: {
@@ -759,7 +759,7 @@
@override
void visitEnumConstantDeclaration(EnumConstantDeclaration node) {
computer._addRegion_token(
- node.name2,
+ node.name,
HighlightRegionType.ENUM_CONSTANT,
);
node.visitChildren(this);
@@ -768,7 +768,7 @@
@override
void visitEnumDeclaration(EnumDeclaration node) {
computer._addRegion_token(node.enumKeyword, HighlightRegionType.KEYWORD);
- computer._addRegion_token(node.name2, HighlightRegionType.ENUM);
+ computer._addRegion_token(node.name, HighlightRegionType.ENUM);
super.visitEnumDeclaration(node);
}
@@ -796,7 +796,7 @@
void visitExtensionDeclaration(ExtensionDeclaration node) {
computer._addRegion_token(
node.extensionKeyword, HighlightRegionType.KEYWORD);
- computer._addRegion_token(node.name2, HighlightRegionType.EXTENSION);
+ computer._addRegion_token(node.name, HighlightRegionType.EXTENSION);
computer._addRegion_token(node.onKeyword, HighlightRegionType.BUILT_IN);
super.visitExtensionDeclaration(node);
}
@@ -811,7 +811,7 @@
for (final variable in node.fields.variables) {
computer._addRegion_token(
- variable.name2,
+ variable.name,
node.isStatic
? HighlightRegionType.STATIC_FIELD_DECLARATION
: HighlightRegionType.INSTANCE_FIELD_DECLARATION,
@@ -896,7 +896,7 @@
} else {
nameType = HighlightRegionType.LOCAL_FUNCTION_DECLARATION;
}
- computer._addRegion_token(node.name2, nameType);
+ computer._addRegion_token(node.name, nameType);
super.visitFunctionDeclaration(node);
}
@@ -906,7 +906,7 @@
computer._addRegion_token(
node.typedefKeyword, HighlightRegionType.BUILT_IN);
computer._addRegion_token(
- node.name2, HighlightRegionType.FUNCTION_TYPE_ALIAS);
+ node.name, HighlightRegionType.FUNCTION_TYPE_ALIAS);
super.visitFunctionTypeAlias(node);
}
@@ -935,7 +935,7 @@
} else {
nameType = HighlightRegionType.TYPE_ALIAS;
}
- computer._addRegion_token(node.name2, nameType);
+ computer._addRegion_token(node.name, nameType);
super.visitGenericTypeAlias(node);
}
@@ -1079,7 +1079,7 @@
? HighlightRegionType.STATIC_METHOD_DECLARATION
: HighlightRegionType.INSTANCE_METHOD_DECLARATION;
}
- computer._addRegion_token(node.name2, nameType);
+ computer._addRegion_token(node.name, nameType);
super.visitMethodDeclaration(node);
}
@@ -1301,7 +1301,7 @@
for (final variable in node.variables.variables) {
computer._addRegion_token(
- variable.name2,
+ variable.name,
HighlightRegionType.TOP_LEVEL_VARIABLE_DECLARATION,
);
}
@@ -1320,7 +1320,7 @@
@override
void visitTypeParameter(TypeParameter node) {
- computer._addRegion_token(node.name2, HighlightRegionType.TYPE_PARAMETER);
+ computer._addRegion_token(node.name, HighlightRegionType.TYPE_PARAMETER);
super.visitTypeParameter(node);
}
@@ -1336,7 +1336,7 @@
for (final variable in node.variables.variables) {
final element = variable.declaredElement2 as LocalVariableElement;
computer._addRegion_token(
- variable.name2,
+ variable.name,
element.type is DynamicType
? HighlightRegionType.DYNAMIC_LOCAL_VARIABLE_DECLARATION
: HighlightRegionType.LOCAL_VARIABLE_DECLARATION,
diff --git a/pkg/analysis_server/lib/src/computer/computer_hover.dart b/pkg/analysis_server/lib/src/computer/computer_hover.dart
index 1fe5819..d60ad4f 100644
--- a/pkg/analysis_server/lib/src/computer/computer_hover.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_hover.dart
@@ -33,17 +33,17 @@
SyntacticEntity? locationEntity;
if (node is NamedCompilationUnitMember) {
- locationEntity = node.name2;
+ locationEntity = node.name;
} else if (node is Expression) {
locationEntity = node;
} else if (node is ExtensionDeclaration) {
- locationEntity = node.name2;
+ locationEntity = node.name;
} else if (node is FormalParameter) {
locationEntity = node.name;
} else if (node is MethodDeclaration) {
- locationEntity = node.name2;
+ locationEntity = node.name;
} else if (node is VariableDeclaration) {
- locationEntity = node.name2;
+ locationEntity = node.name;
}
if (locationEntity == null) {
return null;
diff --git a/pkg/analysis_server/lib/src/computer/computer_inlay_hint.dart b/pkg/analysis_server/lib/src/computer/computer_inlay_hint.dart
index 4c13095..883fc08 100644
--- a/pkg/analysis_server/lib/src/computer/computer_inlay_hint.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_inlay_hint.dart
@@ -105,7 +105,7 @@
if (declaration != null) {
// For getters/setters, the type must come before the property keyword,
// not the name.
- final token = node.propertyKeyword ?? node.name2;
+ final token = node.propertyKeyword ?? node.name;
_computer._addTypePrefix(token, declaration.returnType);
}
}
@@ -121,7 +121,7 @@
final declaration = node.declaredElement2;
if (declaration != null) {
- _computer._addTypePrefix(node.name2, declaration.returnType);
+ _computer._addTypePrefix(node.name, declaration.returnType);
}
}
diff --git a/pkg/analysis_server/lib/src/computer/computer_outline.dart b/pkg/analysis_server/lib/src/computer/computer_outline.dart
index 417657f..9d54d5d 100644
--- a/pkg/analysis_server/lib/src/computer/computer_outline.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_outline.dart
@@ -96,7 +96,7 @@
}
Outline _newClassOutline(ClassDeclaration node, List<Outline> classContents) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var element = Element(
ElementKind.CLASS,
@@ -111,7 +111,7 @@
}
Outline _newClassTypeAlias(ClassTypeAlias node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var element = Element(
ElementKind.CLASS_TYPE_ALIAS,
@@ -130,7 +130,7 @@
var name = returnType.name;
var offset = returnType.offset;
var length = returnType.length;
- var constructorNameToken = constructor.name2;
+ var constructorNameToken = constructor.name;
var isPrivate = false;
if (constructorNameToken != null) {
var constructorName = constructorNameToken.lexeme;
@@ -153,7 +153,7 @@
}
Outline _newEnumConstant(EnumConstantDeclaration node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var element = Element(
ElementKind.ENUM_CONSTANT,
@@ -166,7 +166,7 @@
}
Outline _newEnumOutline(EnumDeclaration node, List<Outline> children) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var element = Element(
ElementKind.ENUM,
@@ -180,7 +180,7 @@
Outline _newExtensionOutline(
ExtensionDeclaration node, List<Outline> extensionContents) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken?.lexeme ?? '';
var element = Element(
ElementKind.EXTENSION,
@@ -197,7 +197,7 @@
Outline _newFunctionOutline(FunctionDeclaration function, bool isStatic) {
var returnType = function.returnType;
- var nameToken = function.name2;
+ var nameToken = function.name;
var name = nameToken.lexeme;
var functionExpression = function.functionExpression;
var parameters = functionExpression.parameters;
@@ -229,7 +229,7 @@
Outline _newFunctionTypeAliasOutline(FunctionTypeAlias node) {
var returnType = node.returnType;
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var parameters = node.parameters;
var parametersStr = _safeToSource(parameters);
@@ -248,7 +248,7 @@
}
Outline _newGenericTypeAliasOutline(GenericTypeAlias node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var aliasedType = node.type;
@@ -280,7 +280,7 @@
Outline _newMethodOutline(MethodDeclaration method) {
var returnType = method.returnType;
- var nameToken = method.name2;
+ var nameToken = method.name;
var name = nameToken.lexeme;
var parameters = method.parameters;
ElementKind kind;
@@ -311,7 +311,7 @@
Outline _newMixinOutline(MixinDeclaration node, List<Outline> mixinContents) {
node.firstTokenAfterCommentAndMetadata;
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var element = Element(
ElementKind.MIXIN,
@@ -334,7 +334,7 @@
Outline _newVariableOutline(String typeName, ElementKind kind,
VariableDeclaration variable, bool isStatic) {
- var nameToken = variable.name2;
+ var nameToken = variable.name;
var name = nameToken.lexeme;
var element = Element(
kind,
diff --git a/pkg/analysis_server/lib/src/computer/computer_overrides.dart b/pkg/analysis_server/lib/src/computer/computer_overrides.dart
index d70b6e8..d79185c 100644
--- a/pkg/analysis_server/lib/src/computer/computer_overrides.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_overrides.dart
@@ -68,7 +68,7 @@
if (classMember.isStatic) {
continue;
}
- _addOverride(classMember.name2, classMember.declaredElement2);
+ _addOverride(classMember.name, classMember.declaredElement2);
}
if (classMember is FieldDeclaration) {
if (classMember.isStatic) {
@@ -76,7 +76,7 @@
}
List<VariableDeclaration> fields = classMember.fields.variables;
for (var field in fields) {
- _addOverride(field.name2, field.declaredElement2);
+ _addOverride(field.name, field.declaredElement2);
}
}
}
diff --git a/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart b/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart
index 10fcbfe..c97b330 100644
--- a/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart
+++ b/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart
@@ -28,7 +28,7 @@
@override
void visitEnumConstantDeclaration(EnumConstantDeclaration node) {
- _addOccurrence(node.declaredElement2!, node.name2.offset);
+ _addOccurrence(node.declaredElement2!, node.name.offset);
super.visitEnumConstantDeclaration(node);
}
@@ -48,13 +48,13 @@
@override
void visitFunctionDeclaration(FunctionDeclaration node) {
- _addOccurrence(node.declaredElement2!, node.name2.offset);
+ _addOccurrence(node.declaredElement2!, node.name.offset);
super.visitFunctionDeclaration(node);
}
@override
void visitMethodDeclaration(MethodDeclaration node) {
- _addOccurrence(node.declaredElement2!, node.name2.offset);
+ _addOccurrence(node.declaredElement2!, node.name.offset);
super.visitMethodDeclaration(node);
}
@@ -85,7 +85,7 @@
@override
void visitVariableDeclaration(VariableDeclaration node) {
- _addOccurrence(node.declaredElement2!, node.name2.offset);
+ _addOccurrence(node.declaredElement2!, node.name.offset);
super.visitVariableDeclaration(node);
}
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart
index 448d11f..cdaec73 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart
@@ -73,7 +73,7 @@
final SyntacticEntity originEntity;
DartType? type;
if (node is VariableDeclaration) {
- originEntity = node.name2;
+ originEntity = node.name;
type = node.declaredElement2?.type;
} else if (node is Expression) {
originEntity = node;
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
index 0b81c25..e0baf51 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
@@ -1029,7 +1029,7 @@
var parent = node.parent;
if (parent is VariableDeclarationList) {
return parent.type?.type ??
- _impliedDartTypeWithName(typeProvider, node.name2.lexeme);
+ _impliedDartTypeWithName(typeProvider, node.name.lexeme);
}
}
return null;
@@ -1042,7 +1042,7 @@
var equals = varDecl.equals;
if (equals != null && equals.end <= offset) {
return node.type?.type ??
- _impliedDartTypeWithName(typeProvider, varDecl.name2.lexeme);
+ _impliedDartTypeWithName(typeProvider, varDecl.name.lexeme);
}
}
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
index 060361b..ad2274a 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
@@ -146,7 +146,7 @@
void visitClassDeclaration(ClassDeclaration node) {
final entity = this.entity;
// Don't suggest class name
- if (entity == node.name2) {
+ if (entity == node.name) {
return;
}
if (entity == node.rightBracket) {
@@ -266,7 +266,7 @@
return;
}
- if (entity == node.name2) {
+ if (entity == node.name) {
return;
}
@@ -298,7 +298,7 @@
@override
void visitExtensionDeclaration(ExtensionDeclaration node) {
// Don't suggest extension name
- if (entity == node.name2) {
+ if (entity == node.name) {
return;
}
if (entity == node.rightBracket) {
@@ -492,7 +492,7 @@
void visitFunctionDeclaration(FunctionDeclaration node) {
// If the cursor is at the beginning of the declaration, include the
// compilation unit keywords. See dartbug.com/41039.
- if (entity == node.returnType || entity == node.name2) {
+ if (entity == node.returnType || entity == node.name) {
_addSuggestion(Keyword.DYNAMIC);
_addSuggestion(Keyword.VOID);
}
@@ -615,7 +615,7 @@
_addSuggestion2(SYNC_STAR);
}
}
- } else if (entity == node.returnType || entity == node.name2) {
+ } else if (entity == node.returnType || entity == node.name) {
// If the cursor is at the beginning of the declaration, include the class
// body keywords. See dartbug.com/41039.
_addClassBodyKeywords();
@@ -643,7 +643,7 @@
void visitMixinDeclaration(MixinDeclaration node) {
final entity = this.entity;
// Don't suggest mixin name
- if (entity == node.name2) {
+ if (entity == node.name) {
return;
}
if (entity == node.rightBracket) {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
index 6412662..7d1af0c 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
@@ -245,7 +245,7 @@
if (declaredElement != null &&
visibilityTracker._isVisible(declaredElement) &&
opType.includeReturnValueSuggestions &&
- declaration.name2 != null) {
+ declaration.name != null) {
builder.suggestExtension(declaredElement, kind: _defaultKind);
}
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
index 971f200..deef15b 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
@@ -72,7 +72,7 @@
var type = fields.type;
if (variables.length == 1) {
var variable = variables[0];
- var targetId = variable.name2;
+ var targetId = variable.name;
if (targetId.lexeme.isEmpty) {
// analyzer parser
// Actual: class C { foo^ }
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index 9a9d3b3..f6f6dc6 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -223,7 +223,7 @@
var containingMethod = request.target.containingNode
.thisOrAncestorOfType<MethodDeclaration>();
if (containingMethod != null) {
- _cachedContainingMemberName = containingMethod.name2.lexeme;
+ _cachedContainingMemberName = containingMethod.name.lexeme;
}
}
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
index 029444f..280ad65 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
@@ -127,7 +127,7 @@
@override
void declaredClass(ClassDeclaration declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
// no type
finished();
}
@@ -135,7 +135,7 @@
@override
void declaredClassTypeAlias(ClassTypeAlias declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
// no type
finished();
}
@@ -143,7 +143,7 @@
@override
void declaredField(FieldDeclaration fieldDecl, VariableDeclaration varDecl) {
- if (varDecl.name2.lexeme == targetName) {
+ if (varDecl.name.lexeme == targetName) {
// Type provided by the element in computeFull above
finished();
}
@@ -151,7 +151,7 @@
@override
void declaredFunction(FunctionDeclaration declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
var returnType = declaration.returnType;
if (returnType != null) {
var type = returnType.type;
@@ -165,7 +165,7 @@
@override
void declaredFunctionTypeAlias(FunctionTypeAlias declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
var returnType = declaration.returnType;
if (returnType != null) {
var type = returnType.type;
@@ -179,7 +179,7 @@
@override
void declaredGenericTypeAlias(GenericTypeAlias declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
var returnType = declaration.functionType?.returnType;
if (returnType != null) {
var type = returnType.type;
@@ -213,7 +213,7 @@
@override
void declaredMethod(MethodDeclaration declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
var returnType = declaration.returnType;
if (returnType != null) {
var type = returnType.type;
@@ -236,7 +236,7 @@
@override
void declaredTopLevelVar(
VariableDeclarationList varList, VariableDeclaration varDecl) {
- if (varDecl.name2.lexeme == targetName) {
+ if (varDecl.name.lexeme == targetName) {
// Type provided by the element in computeFull above.
finished();
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart
index ea9e787..e8fe820 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart
@@ -66,7 +66,7 @@
var varDeclarations = varDeclarationList.variables;
if (varDeclarations.length == 1) {
var declaration = varDeclarations.first;
- strName = declaration.name2.lexeme;
+ strName = declaration.name.lexeme;
}
}
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_call_super.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_call_super.dart
index 3bd48e3..8f0d4c2 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_call_super.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_call_super.dart
@@ -37,7 +37,7 @@
?.declaredElement2;
if (classElement == null) return;
- var name = methodDeclaration.name2.lexeme;
+ var name = methodDeclaration.name.lexeme;
var nameObj = Name(classElement.library.source.uri, name);
var overridden = InheritanceManager3().getInherited2(classElement, nameObj);
if (overridden == null) return;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart
index a785083..b6d4b0e 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart
@@ -36,9 +36,9 @@
final node = this.node;
final String name;
if (node is MethodDeclaration) {
- name = node.name2.lexeme;
+ name = node.name.lexeme;
} else if (node is VariableDeclaration) {
- name = node.name2.lexeme;
+ name = node.name.lexeme;
} else {
return;
}
@@ -120,7 +120,7 @@
final debugFillProperties = classDeclaration.members
.whereType<MethodDeclaration>()
- .where((e) => e.name2.lexeme == 'debugFillProperties')
+ .where((e) => e.name.lexeme == 'debugFillProperties')
.singleOrNull;
if (debugFillProperties == null) {
var location = utils.prepareNewMethodLocation(classDeclaration);
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_enum_constant.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_enum_constant.dart
index 39919e2..ecf5e59 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_enum_constant.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_enum_constant.dart
@@ -64,7 +64,7 @@
var length = constructors.length;
if (length > 1) return;
- var name = length == 1 ? constructors.first.name2?.lexeme : null;
+ var name = length == 1 ? constructors.first.name?.lexeme : null;
var offset = targetNode.constants.last.end;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart
index 23fa71c..4993ce3 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_key_to_constructors.dart
@@ -35,7 +35,7 @@
if (keyType == null) {
return;
}
- var className = node.name2.lexeme;
+ var className = node.name.lexeme;
var constructors = node.declaredElement2?.supertype?.constructors;
if (constructors == null) {
return;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart
index b434ce0..97e7e94 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart
@@ -36,7 +36,7 @@
Token? insertBeforeEntity;
FunctionBody? body;
final executable = node;
- if (executable is MethodDeclaration && executable.name2 == token) {
+ if (executable is MethodDeclaration && executable.name == token) {
if (executable.returnType != null) {
return;
}
@@ -45,16 +45,16 @@
}
insertBeforeEntity = executable.operatorKeyword ??
executable.propertyKeyword ??
- executable.name2;
+ executable.name;
body = executable.body;
- } else if (executable is FunctionDeclaration && executable.name2 == token) {
+ } else if (executable is FunctionDeclaration && executable.name == token) {
if (executable.returnType != null) {
return;
}
if (executable.isSetter) {
return;
}
- insertBeforeEntity = executable.propertyKeyword ?? executable.name2;
+ insertBeforeEntity = executable.propertyKeyword ?? executable.name;
body = executable.functionExpression.body;
} else {
return;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_type_annotation.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_type_annotation.dart
index 21af9e2..c250781 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_type_annotation.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_type_annotation.dart
@@ -147,7 +147,7 @@
final variables = declarationList.variables;
final variable = variables[0];
// Ensure that the selection is not after the name of the variable.
- if (selectionOffset > variable.name2.end) {
+ if (selectionOffset > variable.name.end) {
return;
}
// Ensure that there is an initializer to get the type from.
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart
index 07a8d71..094e2b8 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart
@@ -52,7 +52,7 @@
return;
}
final declaration = node;
- if (declaration is ClassDeclaration && declaration.name2 == token) {
+ if (declaration is ClassDeclaration && declaration.name == token) {
var description = _EnumDescription.fromClass(declaration);
if (description != null) {
await builder.addDartFileEdit(file, (builder) {
@@ -305,7 +305,7 @@
return null;
}
var constructor = constructors[0];
- var name = constructor.name2?.lexeme;
+ var name = constructor.name?.lexeme;
if (name != null && name != 'new') {
return null;
}
@@ -630,7 +630,7 @@
static bool _validateMethods(ClassDeclaration classDeclaration) {
for (var member in classDeclaration.members) {
if (member is MethodDeclaration) {
- final name = member.name2.lexeme;
+ final name = member.name.lexeme;
if (name == '==' || name == 'hashCode') {
return false;
}
@@ -697,7 +697,7 @@
this.fieldDeclaration);
/// Return the name of the field.
- String get name => declaration.name2.lexeme;
+ String get name => declaration.name.lexeme;
}
/// A representation of all the fields of interest in the class being converted.
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_mixin.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_mixin.dart
index 7d04dc0..1d6fe41 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_mixin.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_mixin.dart
@@ -22,7 +22,7 @@
if (classDeclaration == null) {
return;
}
- if (selectionOffset > classDeclaration.name2.end ||
+ if (selectionOffset > classDeclaration.name.end ||
selectionEnd < classDeclaration.classKeyword.offset) {
return;
}
@@ -61,7 +61,7 @@
classDeclaration.abstractKeyword ?? classDeclaration.classKeyword,
classDeclaration.leftBracket), (builder) {
builder.write('mixin ');
- builder.write(classDeclaration.name2.lexeme);
+ builder.write(classDeclaration.name.lexeme);
builder.writeTypeParameters(classElement.typeParameters);
builder.writeTypes(superclassConstraints, prefix: ' on ');
builder.writeTypes(interfaces, prefix: ' implements ');
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_final_field.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_final_field.dart
index 4499580..ba8716c 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_final_field.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_final_field.dart
@@ -76,7 +76,7 @@
if (returnType != null) {
code += ' ${utils.getNodeText(returnType)}';
}
- code += ' ${getter.name2.lexeme}';
+ code += ' ${getter.name.lexeme}';
if (expression is! NullLiteral) {
code += ' = ${utils.getNodeText(expression)}';
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_getter.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_getter.dart
index 9fa75fc..1e06339 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_into_getter.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_into_getter.dart
@@ -54,7 +54,7 @@
code += '${utils.getNodeText(typeAnnotation)} ';
}
code += 'get';
- code += ' ${field.name2.lexeme}';
+ code += ' ${field.name.lexeme}';
code += ' => ${utils.getNodeText(initializer)}';
code += ';';
var replacementRange = range.startEnd(finalKeyword, fieldDeclaration);
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_generic_function_syntax.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_generic_function_syntax.dart
index 4727e20..45c4b99 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_generic_function_syntax.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_generic_function_syntax.dart
@@ -76,7 +76,7 @@
}
var functionName = utils.getRangeText(
- range.startEnd(node.name2, node.typeParameters ?? node.name2));
+ range.startEnd(node.name, node.typeParameters ?? node.name));
var parameters = utils.getNodeText(node.parameters);
String replacement;
if (returnType == null) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
index 3b01b2f..7844a96 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
@@ -43,8 +43,7 @@
}
var parent = node.thisOrAncestorOfType<EnumConstantDeclaration>();
if (parent != null) {
- await _proposeFromEnumConstantDeclaration(
- builder, parent.name2, parent);
+ await _proposeFromEnumConstantDeclaration(builder, parent.name, parent);
}
}
}
@@ -139,7 +138,7 @@
var arguments = parent.arguments;
_constructorName =
- '${targetNode.name2.lexeme}${arguments?.constructorSelector ?? ''}';
+ '${targetNode.name.lexeme}${arguments?.constructorSelector ?? ''}';
await _write(
builder,
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart
index 32ca874..c299cb2 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor_for_final_fields.dart
@@ -28,7 +28,7 @@
return;
}
- var className = classDeclaration.name2.lexeme;
+ var className = classDeclaration.name.lexeme;
var superType = classDeclaration.declaredElement2?.supertype;
if (superType == null) {
return;
@@ -70,7 +70,7 @@
for (var variableList in variableLists) {
fieldNames.addAll(variableList.variables
.where((v) => v.initializer == null)
- .map((v) => v.name2.lexeme));
+ .map((v) => v.name.lexeme));
}
await builder.addDartFileEdit(file, (builder) {
@@ -143,7 +143,7 @@
for (var variableList in variableLists) {
var fieldNames = variableList.variables
.where((v) => v.initializer == null)
- .map((v) => v.name2.lexeme);
+ .map((v) => v.name.lexeme);
for (var fieldName in fieldNames) {
if (fieldName == 'child' || fieldName == 'children') {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
index c0aef75..468dc54 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
@@ -68,7 +68,7 @@
final classElement = classDecl.declaredElement2!;
var missingEquals = memberDecl is FieldDeclaration ||
- (memberDecl as MethodDeclaration).name2.lexeme == 'hashCode';
+ (memberDecl as MethodDeclaration).name.lexeme == 'hashCode';
ExecutableElement? element;
if (missingEquals) {
_memberName = '==';
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart b/pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart
index ef703a6..88bff5f 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/encapsulate_field.dart
@@ -40,7 +40,7 @@
return;
}
var field = fields.first;
- var nameToken = field.name2;
+ var nameToken = field.name;
var fieldElement = field.declaredElement2 as FieldElement;
// should have a public name
var name = nameToken.lexeme;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/extend_class_for_mixin.dart b/pkg/analysis_server/lib/src/services/correction/dart/extend_class_for_mixin.dart
index 74eaf76..ee1735a 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/extend_class_for_mixin.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/extend_class_for_mixin.dart
@@ -34,7 +34,7 @@
_typeName = message.substring(startIndex, endIndex);
await builder.addDartFileEdit(file, (builder) {
builder.addSimpleInsertion(
- declaration.typeParameters?.end ?? declaration.name2.end,
+ declaration.typeParameters?.end ?? declaration.name.end,
' extends $_typeName');
});
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
index dc6a05e..403308e 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
@@ -146,7 +146,7 @@
builder.writeln(' @override');
builder.write(' ');
builder.writeReference(stateClass);
- builder.write('<${widgetClass.name2.lexeme}$typeParams>');
+ builder.write('<${widgetClass.name.lexeme}$typeParams>');
builder.writeln(' createState() => $stateName$typeParams();');
if (hasEmptyLineAfterCreateState) {
builder.writeln();
@@ -205,7 +205,7 @@
builder.writeReference(stateClass);
// Write just param names (and not bounds, metadata and docs).
- builder.write('<${widgetClass.name2.lexeme}');
+ builder.write('<${widgetClass.name.lexeme}');
if (typeParameters != null) {
builder.write('<');
var first = true;
@@ -214,7 +214,7 @@
builder.write(', ');
first = false;
}
- builder.write(param.name2.lexeme);
+ builder.write(param.name.lexeme);
}
builder.write('>');
}
@@ -247,7 +247,7 @@
MethodDeclaration? _findBuildMethod(ClassDeclaration widgetClass) {
for (var member in widgetClass.members) {
- if (member is MethodDeclaration && member.name2.lexeme == 'build') {
+ if (member is MethodDeclaration && member.name.lexeme == 'build') {
var parameters = member.parameters;
if (parameters != null && parameters.parameters.length == 1) {
return member;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart
index 68b1fe1..9aa87bb 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateless_widget.dart
@@ -49,7 +49,7 @@
var stateClassElement = stateClass?.declaredElement2;
if (stateClass == null ||
stateClassElement == null ||
- !Identifier.isPrivateName(stateClass.name2.lexeme) ||
+ !Identifier.isPrivateName(stateClass.name.lexeme) ||
!_isSameTypeParameters(widgetClass, stateClass)) {
return;
}
@@ -171,7 +171,7 @@
MethodDeclaration? _findCreateStateMethod(ClassDeclaration widgetClass) {
for (var member in widgetClass.members) {
- if (member is MethodDeclaration && member.name2.lexeme == 'createState') {
+ if (member is MethodDeclaration && member.name.lexeme == 'createState') {
var parameters = member.parameters;
if (parameters?.parameters.isEmpty ?? false) {
return member;
@@ -215,7 +215,7 @@
outer:
for (var stateParam in stateParams) {
for (var widgetParam in widgetParams) {
- if (stateParam.name2.lexeme == widgetParam.name2.lexeme &&
+ if (stateParam.name.lexeme == widgetParam.name.lexeme &&
stateParam.bound?.type == widgetParam.bound?.type) {
continue outer;
}
@@ -243,7 +243,7 @@
}
if (expression is MethodInvocation &&
expression.target is SuperExpression &&
- methodDeclaration!.name2.lexeme == expression.methodName.name) {
+ methodDeclaration!.name.lexeme == expression.methodName.name) {
return true;
}
}
@@ -390,7 +390,7 @@
var classDeclaration =
methodDeclaration?.thisOrAncestorOfType<ClassDeclaration>();
- if (methodDeclaration?.name2.lexeme != 'createState' ||
+ if (methodDeclaration?.name.lexeme != 'createState' ||
classDeclaration?.declaredElement2 != widgetClassElement) {
used = true;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart b/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart
index 7b17c74..2ec1d55 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart
@@ -41,7 +41,7 @@
List<FormalParameter> parameters;
if (node is FunctionTypeAlias) {
returnType = node.returnType;
- _name = node.name2.lexeme;
+ _name = node.name.lexeme;
typeParameters = node.typeParameters;
parameters = node.parameters.parameters;
} else if (node is GenericTypeAlias) {
@@ -53,7 +53,7 @@
return;
}
returnType = functionType.returnType;
- _name = node.name2.lexeme;
+ _name = node.name.lexeme;
typeParameters = functionType.typeParameters;
parameters = functionType.parameters.parameters;
} else {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart
index 1c7b999..a2a305a 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/join_variable_declaration.dart
@@ -148,7 +148,7 @@
await builder.addDartFileEdit(file, (builder) {
builder.addSimpleReplacement(
- range.endStart(declaredVariable.name2, assignment.operator),
+ range.endStart(declaredVariable.name, assignment.operator),
' ',
);
});
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_class_abstract.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_class_abstract.dart
index 826fb84..d034ed3 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/make_class_abstract.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/make_class_abstract.dart
@@ -23,7 +23,7 @@
if (enclosingClass == null) {
return;
}
- _className = enclosingClass.name2.lexeme;
+ _className = enclosingClass.name.lexeme;
await builder.addDartFileEdit(file, (builder) {
builder.addSimpleInsertion(
enclosingClass.classKeyword.offset, 'abstract ');
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_field_public.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_field_public.dart
index 84281b1..4790e44a 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/make_field_public.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/make_field_public.dart
@@ -25,9 +25,9 @@
if (declaration is! MethodDeclaration) {
return;
}
- var getterName = declaration.name2.lexeme;
+ var getterName = declaration.name.lexeme;
_fieldName = '_$getterName';
- if (declaration.name2 == token && declaration.isGetter) {
+ if (declaration.name == token && declaration.isGetter) {
NodeList<ClassMember> members;
var container = declaration.parent;
if (container is ClassDeclaration) {
@@ -42,12 +42,12 @@
VariableDeclaration? field;
for (var member in members) {
if (member is MethodDeclaration &&
- member.name2.lexeme == getterName &&
+ member.name.lexeme == getterName &&
member.isSetter) {
setter = member;
} else if (member is FieldDeclaration) {
for (var variable in member.fields.variables) {
- if (variable.name2.lexeme == _fieldName) {
+ if (variable.name.lexeme == _fieldName) {
field = variable;
}
}
@@ -57,7 +57,7 @@
return;
}
await builder.addDartFileEdit(file, (builder) {
- builder.addSimpleReplacement(range.token(field!.name2), getterName);
+ builder.addSimpleReplacement(range.token(field!.name), getterName);
builder.removeMember(members, declaration);
builder.removeMember(members, setter!);
});
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/make_variable_nullable.dart b/pkg/analysis_server/lib/src/services/correction/dart/make_variable_nullable.dart
index 1939c00..75bc5eb 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/make_variable_nullable.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/make_variable_nullable.dart
@@ -224,7 +224,7 @@
Future<void> _updateVariableType(ChangeBuilder builder,
VariableDeclarationList declarationList, DartType newType) async {
var variable = declarationList.variables[0];
- _variableName = variable.name2.lexeme;
+ _variableName = variable.name.lexeme;
await builder.addDartFileEdit(file, (builder) {
var keyword = declarationList.keyword;
if (keyword != null && keyword.type == Keyword.VAR) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor_name.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor_name.dart
index a173a34..fbd01c9 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor_name.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_constructor_name.dart
@@ -27,7 +27,7 @@
final node = this.node;
if (node is ConstructorDeclaration) {
await builder.addDartFileEdit(file, (builder) {
- builder.addDeletion(range.startStart(node.period!, node.name2!.next!));
+ builder.addDeletion(range.startStart(node.period!, node.name!.next!));
});
} else if (node is SimpleIdentifier) {
// The '.' in ".new"
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_initializer.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_initializer.dart
index d203609..5d9596d 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_initializer.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_initializer.dart
@@ -54,7 +54,7 @@
if (variable != null && initializer != null) {
await builder.addDartFileEdit(file, (builder) {
builder.addDeletion(
- range.endEnd(variable.name2, initializer),
+ range.endEnd(variable.name, initializer),
);
});
} else {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart
index fbdb151..9338b17 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_leading_underscore.dart
@@ -37,7 +37,7 @@
nameToken = node.name;
element = node.declaredElement;
} else if (node is VariableDeclaration) {
- nameToken = node.name2;
+ nameToken = node.name;
element = node.declaredElement2;
} else {
return;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.dart
index a239ba6..69409b5 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_parameters_in_getter_declaration.dart
@@ -20,7 +20,7 @@
final node = this.node;
if (node is MethodDeclaration) {
// Support for the analyzer error.
- var name = node.name2;
+ var name = node.name;
var body = node.body;
await builder.addDartFileEdit(file, (builder) {
builder.addSimpleReplacement(range.endStart(name, body), ' ');
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart
index fb8a5fa..f514e4d 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_type_annotation.dart
@@ -55,12 +55,12 @@
}
// ignore if an incomplete variable declaration
if (declarationList.variables.length == 1 &&
- declarationList.variables[0].name2.isSynthetic) {
+ declarationList.variables[0].name.isSynthetic) {
return;
}
// must be not after the name of the variable
var firstVariable = declarationList.variables[0];
- if (selectionOffset > firstVariable.name2.end) {
+ if (selectionOffset > firstVariable.name.end) {
return;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart
index 5efe2f5..047a095 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_local_variable.dart
@@ -27,7 +27,7 @@
@override
Future<void> compute(ChangeBuilder builder) async {
final node = this.node;
- if (!(node is VariableDeclaration && node.name2 == token)) {
+ if (!(node is VariableDeclaration && node.name == token)) {
return;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/rename_method_parameter.dart b/pkg/analysis_server/lib/src/services/correction/dart/rename_method_parameter.dart
index 6f1abf2..5874dcf 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/rename_method_parameter.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/rename_method_parameter.dart
@@ -39,7 +39,7 @@
if (classElement is! InterfaceElement) return;
var parentMethod = classElement.lookUpInheritedMethod(
- method.name2.lexeme, classElement.library);
+ method.name.lexeme, classElement.library);
if (parentMethod == null) return;
var parameters = methodParameters.parameters;
@@ -89,7 +89,7 @@
@override
void visitVariableDeclaration(VariableDeclaration node) {
- _addNameToken(node.name2, node.declaredElement2);
+ _addNameToken(node.name, node.declaredElement2);
super.visitVariableDeclaration(node);
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart b/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart
index f8c813a..1bb375a 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/rename_to_camel_case.dart
@@ -41,7 +41,7 @@
nameToken = node.name;
element = node.declaredElement;
} else if (node is VariableDeclaration) {
- nameToken = node.name2;
+ nameToken = node.name;
element = node.declaredElement2;
}
if (nameToken == null || element == null) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.dart
index 45bbc99..75a10db 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_conditional_with_if_else.dart
@@ -114,17 +114,17 @@
builder.writeType(type);
});
} else {
- builder.addInsertion(variable.name2.offset, (builder) {
+ builder.addInsertion(variable.name.offset, (builder) {
builder.writeType(type);
builder.write(' ');
});
}
}
- builder.addDeletion(range.endEnd(variable.name2, conditional));
+ builder.addDeletion(range.endEnd(variable.name, conditional));
var conditionSrc = utils.getNodeText(conditional.condition);
var thenSrc = utils.getNodeText(conditional.thenExpression);
var elseSrc = utils.getNodeText(conditional.elseExpression);
- var name = variable.name2.lexeme;
+ var name = variable.name.lexeme;
var src = eol;
src += '${prefix}if ($conditionSrc) {$eol';
src += '$prefix$indent$name = $thenSrc;$eol';
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/sort_unnamed_constructor_first.dart b/pkg/analysis_server/lib/src/services/correction/dart/sort_unnamed_constructor_first.dart
index a55adde..eabad6e 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/sort_unnamed_constructor_first.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/sort_unnamed_constructor_first.dart
@@ -32,11 +32,11 @@
.firstWhereOrNull((child) => child is ConstructorDeclaration)
as ConstructorDeclaration?;
if (firstConstructor == null ||
- firstConstructor.name2 == null ||
- firstConstructor.name2?.lexeme == 'new') return;
+ firstConstructor.name == null ||
+ firstConstructor.name?.lexeme == 'new') return;
final unnamedConstructor = clazz.childEntities.firstWhereOrNull(
- (child) => child is ConstructorDeclaration && child.name2 == null)
+ (child) => child is ConstructorDeclaration && child.name == null)
as ConstructorDeclaration?;
if (unnamedConstructor == null) return;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.dart b/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.dart
index 8540d43..6c1193de 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/split_variable_declaration.dart
@@ -41,7 +41,7 @@
// The caret must be between the type and the variable name.
var variable = variables[0];
- if (!range.startEnd(statement, variable.name2).contains(selectionOffset)) {
+ if (!range.startEnd(statement, variable.name).contains(selectionOffset)) {
return;
}
@@ -64,8 +64,8 @@
}
var indent = utils.getNodePrefix(statement);
- var name = variable.name2.lexeme;
- builder.addSimpleInsertion(variable.name2.end, ';$eol$indent$name');
+ var name = variable.name.lexeme;
+ builder.addSimpleInsertion(variable.name.end, ';$eol$indent$name');
});
}
}
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart
index c8b95ef..af71d62 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/add_type_parameter.dart
@@ -87,7 +87,7 @@
if (_isInvalidIndex(typeParameters?.typeParameters)) {
return null;
}
- return _TypeParameterData(typeParameters, node.name2.end);
+ return _TypeParameterData(typeParameters, node.name.end);
} else if (node is TypeArgumentList && parent is ExtensionOverride) {
// wrong_number_of_type_arguments_extension
if (!argumentValue.validate(context)) {
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart
index 286860c..0f2db8b 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart
@@ -152,7 +152,7 @@
} else if (node is ConstructorName) {
_buildFromConstructorName(node);
} else if (node is FunctionDeclaration) {
- _addMatcher(components: [node.name2.lexeme], kinds: []);
+ _addMatcher(components: [node.name.lexeme], kinds: []);
} else if (node is Literal) {
var parent = node.parent;
if (parent is ArgumentList) {
@@ -169,7 +169,7 @@
} else if (node is TypeArgumentList) {
_buildFromTypeArgumentList(node);
} else if (node is VariableDeclaration) {
- _addMatcher(components: [node.name2.lexeme], kinds: []);
+ _addMatcher(components: [node.name.lexeme], kinds: []);
}
}
@@ -264,7 +264,7 @@
/// Build a matcher for the method being declared.
void _buildFromMethodDeclaration(MethodDeclaration node) {
_addMatcher(
- components: [node.name2.lexeme],
+ components: [node.name.lexeme],
kinds: [ElementKind.methodKind],
);
}
@@ -465,7 +465,7 @@
_buildFromArgumentList(parent.parent!.parent as ArgumentList);
} else if (parent is NamedType) {
_buildFromNamedType(parent);
- } else if (parent is MethodDeclaration && nameToken == parent.name2) {
+ } else if (parent is MethodDeclaration && nameToken == parent.name) {
_buildFromMethodDeclaration(parent);
} else if (parent is MethodInvocation &&
node == parent.methodName &&
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart
index 4d00dcf..63cf19b 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename.dart
@@ -79,7 +79,7 @@
_Data? validate(DataDrivenFix fix) {
var node = fix.node;
if (node is MethodDeclaration) {
- return _Data(node, node.name2);
+ return _Data(node, node.name);
} else if (node is SimpleIdentifier) {
var parent = node.parent;
var grandParent = parent?.parent;
diff --git a/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart b/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
index e231951..85c3549 100644
--- a/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
+++ b/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
@@ -34,7 +34,7 @@
// If we're in a build() method, use 'build' as the name prefix.
var method = assignedExpression?.thisOrAncestorOfType<MethodDeclaration>();
if (method != null) {
- var enclosingName = method.name2.lexeme;
+ var enclosingName = method.name.lexeme;
if (enclosingName.startsWith('build')) {
prefix = 'build';
}
diff --git a/pkg/analysis_server/lib/src/services/correction/sort_members.dart b/pkg/analysis_server/lib/src/services/correction/sort_members.dart
index 301aef5..a117ec9 100644
--- a/pkg/analysis_server/lib/src/services/correction/sort_members.dart
+++ b/pkg/analysis_server/lib/src/services/correction/sort_members.dart
@@ -114,14 +114,14 @@
String name;
if (member is ConstructorDeclaration) {
kind = _MemberKind.CLASS_CONSTRUCTOR;
- name = member.name2?.lexeme ?? '';
+ name = member.name?.lexeme ?? '';
} else if (member is FieldDeclaration) {
var fieldDeclaration = member;
List<VariableDeclaration> fields = fieldDeclaration.fields.variables;
if (fields.isNotEmpty) {
kind = _MemberKind.CLASS_FIELD;
isStatic = fieldDeclaration.isStatic;
- name = fields[0].name2.lexeme;
+ name = fields[0].name.lexeme;
} else {
// Don't sort members if there are errors in the code.
return;
@@ -129,7 +129,7 @@
} else if (member is MethodDeclaration) {
var method = member;
isStatic = method.isStatic;
- name = method.name2.lexeme;
+ name = method.name.lexeme;
if (method.isGetter) {
kind = _MemberKind.CLASS_ACCESSOR;
name += ' getter';
@@ -169,18 +169,18 @@
String name;
if (member is ClassDeclaration) {
kind = _MemberKind.UNIT_CLASS;
- name = member.name2.lexeme;
+ name = member.name.lexeme;
} else if (member is ClassTypeAlias) {
kind = _MemberKind.UNIT_CLASS;
- name = member.name2.lexeme;
+ name = member.name.lexeme;
} else if (member is EnumDeclaration) {
kind = _MemberKind.UNIT_CLASS;
- name = member.name2.lexeme;
+ name = member.name.lexeme;
} else if (member is ExtensionDeclaration) {
kind = _MemberKind.UNIT_EXTENSION;
- name = member.name2?.lexeme ?? '';
+ name = member.name?.lexeme ?? '';
} else if (member is FunctionDeclaration) {
- name = member.name2.lexeme;
+ name = member.name.lexeme;
if (member.isGetter) {
kind = _MemberKind.UNIT_ACCESSOR;
name += ' getter';
@@ -196,13 +196,13 @@
}
} else if (member is FunctionTypeAlias) {
kind = _MemberKind.UNIT_FUNCTION_TYPE;
- name = member.name2.lexeme;
+ name = member.name.lexeme;
} else if (member is GenericTypeAlias) {
kind = _MemberKind.UNIT_GENERIC_TYPE_ALIAS;
- name = member.name2.lexeme;
+ name = member.name.lexeme;
} else if (member is MixinDeclaration) {
kind = _MemberKind.UNIT_CLASS;
- name = member.name2.lexeme;
+ name = member.name.lexeme;
} else if (member is TopLevelVariableDeclaration) {
var variableDeclaration = member;
List<VariableDeclaration> variables =
@@ -213,7 +213,7 @@
} else {
kind = _MemberKind.UNIT_VARIABLE;
}
- name = variables[0].name2.lexeme;
+ name = variables[0].name.lexeme;
} else {
// Don't sort members if there are errors in the code.
return;
@@ -262,8 +262,8 @@
}
// sort all other members by name
var name1 = o1.name.toLowerCase();
- var name2 = o2.name.toLowerCase();
- return name1.compareTo(name2);
+ var name = o2.name.toLowerCase();
+ return name1.compareTo(name);
}
return priority1 - priority2;
});
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index 5ea60d2..1d4c7c3 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -466,7 +466,7 @@
return true;
}
return node.parent is VariableDeclaration &&
- (node.parent as VariableDeclaration).name2 == node.token;
+ (node.parent as VariableDeclaration).name == node.token;
}
/// Return `true` if the given [node] is the name of a [NamedExpression].
@@ -1520,7 +1520,7 @@
@override
visitVariableDeclaration(VariableDeclaration node) {
- names.add(node.name2.lexeme);
+ names.add(node.name.lexeme);
return super.visitVariableDeclaration(node);
}
diff --git a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
index af09137..63cf684 100644
--- a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
+++ b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
@@ -288,7 +288,7 @@
// anchor- defines/binding
addAnchorEdgesContainingEdge(
- syntacticEntity: node.name2,
+ syntacticEntity: node.name,
edges: [
schema.DEFINES_BINDING_EDGE,
],
@@ -355,7 +355,7 @@
// anchor
addAnchorEdgesContainingEdge(
- syntacticEntity: node.name2,
+ syntacticEntity: node.name,
edges: [
schema.DEFINES_BINDING_EDGE,
],
@@ -471,7 +471,7 @@
// anchor
var start = node.returnType.offset;
var end = node.returnType.end;
- var nameToken = node.name2;
+ var nameToken = node.name;
if (nameToken != null) {
end = nameToken.end;
}
@@ -517,7 +517,7 @@
// anchor- defines/binding, defines
addAnchorEdgesContainingEdge(
- syntacticEntity: node.name2,
+ syntacticEntity: node.name,
edges: [
schema.DEFINES_BINDING_EDGE,
schema.DEFINES_EDGE,
@@ -539,7 +539,7 @@
// anchor- defines/binding
addAnchorEdgesContainingEdge(
- syntacticEntity: node.name2,
+ syntacticEntity: node.name,
edges: [
schema.DEFINES_BINDING_EDGE,
],
@@ -599,7 +599,7 @@
// anchor- defines/binding
addAnchorEdgesContainingEdge(
- syntacticEntity: node.name2,
+ syntacticEntity: node.name,
edges: [
schema.DEFINES_BINDING_EDGE,
],
@@ -751,7 +751,7 @@
// anchor- defines/binding
addAnchorEdgesContainingEdge(
- syntacticEntity: node.name2,
+ syntacticEntity: node.name,
edges: [
schema.DEFINES_BINDING_EDGE,
],
@@ -919,7 +919,7 @@
// variable
var declaredElement = node.declaredElement2!;
- _handleVariableDeclaration(declaredElement, node.name2,
+ _handleVariableDeclaration(declaredElement, node.name,
subKind: isLocal ? schema.LOCAL_SUBKIND : schema.FIELD_SUBKIND,
type: declaredElement.type);
diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart
index 763d923..2717b4d 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart
@@ -1068,7 +1068,7 @@
@override
void visitVariableDeclaration(VariableDeclaration node) {
_addPatterns(
- nameToken: node.name2,
+ nameToken: node.name,
element: node.declaredElement2,
);
@@ -1335,7 +1335,7 @@
// declared local elements
var range = ref._visibleRangeMap[element];
if (range != null) {
- final name = node.name2.lexeme;
+ final name = node.name.lexeme;
var ranges = ref._localNames.putIfAbsent(name, () => <SourceRange>[]);
ranges.add(range);
}
diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart
index 004264c..ebdcebb 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/inline_method.dart
@@ -807,7 +807,7 @@
@override
void visitVariableDeclaration(VariableDeclaration node) {
- final nameRange = range.token(node.name2);
+ final nameRange = range.token(node.name);
if (bodyRange.covers(nameRange)) {
final declaredElement = node.declaredElement2;
if (declaredElement != null) {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart
index 8c1675b..dac82de 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/refactoring.dart
@@ -471,15 +471,15 @@
} else if (node is LibraryDirective) {
nameNode = node;
} else if (node is MethodDeclaration) {
- nameNode = node.name2;
+ nameNode = node.name;
} else if (node is NamedCompilationUnitMember) {
- nameNode = node.name2;
+ nameNode = node.name;
} else if (node is SimpleFormalParameter) {
nameNode = node.name;
} else if (node is SimpleIdentifier) {
nameNode = node.token;
} else if (node is VariableDeclaration) {
- nameNode = node.name2;
+ nameNode = node.name;
}
if (nameNode == null) {
return null;
diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart
index c677f90..f943949 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_class_member.dart
@@ -302,7 +302,7 @@
@override
void visitFunctionDeclaration(FunctionDeclaration node) {
- if (node.name2.lexeme == name) {
+ if (node.name.lexeme == name) {
final element = node.declaredElement2;
if (element is FunctionElement) {
elements.add(element);
@@ -326,7 +326,7 @@
@override
void visitVariableDeclaration(VariableDeclaration node) {
- if (node.name2.lexeme == name) {
+ if (node.name.lexeme == name) {
final element = node.declaredElement2;
if (element is LocalVariableElement) {
elements.add(element);
diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart
index 3c92e80..ccfda79 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_extension_member.dart
@@ -213,7 +213,7 @@
@override
void visitFunctionDeclaration(FunctionDeclaration node) {
- if (node.name2.lexeme == name) {
+ if (node.name.lexeme == name) {
final element = node.declaredElement2;
if (element is FunctionElement) {
elements.add(element);
@@ -237,7 +237,7 @@
@override
void visitVariableDeclaration(VariableDeclaration node) {
- if (node.name2.lexeme == name) {
+ if (node.name.lexeme == name) {
final element = node.declaredElement2;
if (element is LocalVariableElement) {
elements.add(element);
diff --git a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_local.dart b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_local.dart
index bca4747..7d77240 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_local.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/legacy/rename_local.dart
@@ -35,7 +35,7 @@
void visitFunctionDeclaration(FunctionDeclaration node) {
_checkDeclaration(
declaredElement: node.declaredElement2!,
- nameToken: node.name2,
+ nameToken: node.name,
);
super.visitFunctionDeclaration(node);
@@ -70,7 +70,7 @@
void visitVariableDeclaration(VariableDeclaration node) {
_checkDeclaration(
declaredElement: node.declaredElement2!,
- nameToken: node.name2,
+ nameToken: node.name,
);
super.visitVariableDeclaration(node);
diff --git a/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart b/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart
index 708e248..870a962 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/move_top_level_to_file.dart
@@ -45,28 +45,28 @@
var declaration = node.parent?.parent;
if (declaration is TopLevelVariableDeclaration &&
declaration.variables.variables.length == 1 &&
- selectionIsInToken(node.name2)) {
- return _memberFor(declaration, node.name2.lexeme);
+ selectionIsInToken(node.name)) {
+ return _memberFor(declaration, node.name.lexeme);
}
}
if (node is! CompilationUnitMember) {
return null;
}
String name;
- if (node is ClassDeclaration && selectionIsInToken(node.name2)) {
- name = node.name2.lexeme;
- } else if (node is EnumDeclaration && selectionIsInToken(node.name2)) {
- name = node.name2.lexeme;
- } else if (node is ExtensionDeclaration && selectionIsInToken(node.name2)) {
- name = node.name2!.lexeme;
+ if (node is ClassDeclaration && selectionIsInToken(node.name)) {
+ name = node.name.lexeme;
+ } else if (node is EnumDeclaration && selectionIsInToken(node.name)) {
+ name = node.name.lexeme;
+ } else if (node is ExtensionDeclaration && selectionIsInToken(node.name)) {
+ name = node.name!.lexeme;
} else if (node is FunctionDeclaration &&
node.parent is CompilationUnit &&
- selectionIsInToken(node.name2)) {
- name = node.name2.lexeme;
- } else if (node is MixinDeclaration && selectionIsInToken(node.name2)) {
- name = node.name2.lexeme;
- } else if (node is TypeAlias && selectionIsInToken(node.name2)) {
- name = node.name2.lexeme;
+ selectionIsInToken(node.name)) {
+ name = node.name.lexeme;
+ } else if (node is MixinDeclaration && selectionIsInToken(node.name)) {
+ name = node.name.lexeme;
+ } else if (node is TypeAlias && selectionIsInToken(node.name)) {
+ name = node.name.lexeme;
} else {
return null;
}
diff --git a/pkg/analysis_server/lib/src/status/ast_writer.dart b/pkg/analysis_server/lib/src/status/ast_writer.dart
index 8b8e20d..54e14ab 100644
--- a/pkg/analysis_server/lib/src/status/ast_writer.dart
+++ b/pkg/analysis_server/lib/src/status/ast_writer.dart
@@ -144,11 +144,11 @@
/// declaration.
String? _getName(AstNode node) {
if (node is ClassTypeAlias) {
- return node.name2.lexeme;
+ return node.name.lexeme;
} else if (node is ClassDeclaration) {
- return node.name2.lexeme;
+ return node.name.lexeme;
} else if (node is ConstructorDeclaration) {
- var name = node.name2;
+ var name = node.name;
if (name == null) {
return node.returnType.name;
} else {
@@ -159,21 +159,21 @@
} else if (node is FieldDeclaration) {
return _getNames(node.fields);
} else if (node is FunctionDeclaration) {
- return node.name2.lexeme;
+ return node.name.lexeme;
} else if (node is FunctionTypeAlias) {
- return node.name2.lexeme;
+ return node.name.lexeme;
} else if (node is Identifier) {
return node.name;
} else if (node is MethodDeclaration) {
- return node.name2.lexeme;
+ return node.name.lexeme;
} else if (node is TopLevelVariableDeclaration) {
return _getNames(node.variables);
} else if (node is TypeAnnotation) {
return node.toSource();
} else if (node is TypeParameter) {
- return node.name2.lexeme;
+ return node.name.lexeme;
} else if (node is VariableDeclaration) {
- return node.name2.lexeme;
+ return node.name.lexeme;
}
return null;
}
@@ -189,7 +189,7 @@
} else {
buffer.write(', ');
}
- buffer.write(variable.name2.lexeme);
+ buffer.write(variable.name.lexeme);
}
return buffer.toString();
}
diff --git a/pkg/analysis_server/test/integration/linter/lint_names_test.dart b/pkg/analysis_server/test/integration/linter/lint_names_test.dart
index 2372824..ed2c416 100644
--- a/pkg/analysis_server/test/integration/linter/lint_names_test.dart
+++ b/pkg/analysis_server/test/integration/linter/lint_names_test.dart
@@ -33,7 +33,7 @@
}
var lintNamesClass = parseResult.unit.declarations.firstWhere(
- (m) => m is ClassDeclaration && m.name2.lexeme == 'LintNames');
+ (m) => m is ClassDeclaration && m.name.lexeme == 'LintNames');
var collector = _FixCollector();
lintNamesClass.accept(collector);
@@ -65,7 +65,7 @@
@override
void visitFieldDeclaration(FieldDeclaration node) {
for (var v in node.fields.variables) {
- lintNames.add(v.name2.lexeme);
+ lintNames.add(v.name.lexeme);
}
}
}
diff --git a/pkg/analysis_server/test/src/utilities/flutter_test.dart b/pkg/analysis_server/test/src/utilities/flutter_test.dart
index b13dc48..5866349 100644
--- a/pkg/analysis_server/test/src/utilities/flutter_test.dart
+++ b/pkg/analysis_server/test/src/utilities/flutter_test.dart
@@ -543,7 +543,7 @@
for (var topDeclaration in unit.declarations) {
if (topDeclaration is TopLevelVariableDeclaration) {
for (var variable in topDeclaration.variables.variables) {
- if (variable.name2.lexeme == name) {
+ if (variable.name.lexeme == name) {
return variable;
}
}
diff --git a/pkg/analysis_server/tool/bulk_fix/parse_utils.dart b/pkg/analysis_server/tool/bulk_fix/parse_utils.dart
index 4e63e72..a43f801 100644
--- a/pkg/analysis_server/tool/bulk_fix/parse_utils.dart
+++ b/pkg/analysis_server/tool/bulk_fix/parse_utils.dart
@@ -33,10 +33,10 @@
if (classElement != null &&
classElement.allSupertypes.any(
(element) => element.element2.name == 'CorrectionProducer')) {
- var correctionName = classDecl.name2.lexeme;
+ var correctionName = classDecl.name.lexeme;
for (var method in classDecl.members.whereType<MethodDeclaration>()) {
- if (method.name2.lexeme == 'canBeAppliedInBulk') {
+ if (method.name.lexeme == 'canBeAppliedInBulk') {
var hasComment =
method.returnType?.beginToken.precedingComments != null;
diff --git a/pkg/analysis_server/tool/code_completion/code_metrics.dart b/pkg/analysis_server/tool/code_completion/code_metrics.dart
index c30111a..5d4ea8f 100644
--- a/pkg/analysis_server/tool/code_completion/code_metrics.dart
+++ b/pkg/analysis_server/tool/code_completion/code_metrics.dart
@@ -307,7 +307,7 @@
'documentationComment': node.documentationComment,
'metadata': node.metadata,
'abstractKeyword': node.abstractKeyword,
- 'name': node.name2,
+ 'name': node.name,
'typeParameters': node.typeParameters,
'extendsClause': node.extendsClause,
'withClause': node.withClause,
@@ -324,7 +324,7 @@
'documentationComment': node.documentationComment,
'metadata': node.metadata,
'abstractKeyword': node.abstractKeyword,
- 'name': node.name2,
+ 'name': node.name,
'typeParameters': node.typeParameters,
'superclass': node.superclass,
'withClause': node.withClause,
@@ -387,7 +387,7 @@
'constKeyword': node.constKeyword,
'factoryKeyword': node.factoryKeyword,
'returnType': node.returnType,
- 'name': node.name2,
+ 'name': node.name,
'parameters': node.parameters,
'initializers': node.initializers,
'redirectedConstructor': node.redirectedConstructor,
@@ -482,7 +482,7 @@
_visitChildren(node, {
'documentationComment': node.documentationComment,
'metadata': node.metadata,
- 'name': node.name2,
+ 'name': node.name,
});
super.visitEnumConstantDeclaration(node);
}
@@ -492,7 +492,7 @@
_visitChildren(node, {
'documentationComment': node.documentationComment,
'metadata': node.metadata,
- 'name': node.name2,
+ 'name': node.name,
'constants': node.constants,
});
super.visitEnumDeclaration(node);
@@ -539,7 +539,7 @@
@override
void visitExtensionDeclaration(ExtensionDeclaration node) {
_visitChildren(node, {
- 'name': node.name2,
+ 'name': node.name,
'typeParameters': node.typeParameters,
'extendedType': node.extendedType,
'member': node.members,
@@ -660,7 +660,7 @@
'metadata': node.metadata,
'externalKeyword': node.externalKeyword,
'propertyKeyword': node.propertyKeyword,
- 'name': node.name2,
+ 'name': node.name,
'functionExpression': node.functionExpression,
'returnType': node.returnType,
});
@@ -701,7 +701,7 @@
'documentationComment': node.documentationComment,
'metadata': node.metadata,
'returnType': node.returnType,
- 'name': node.name2,
+ 'name': node.name,
'typeParameters': node.typeParameters,
'parameters': node.parameters,
});
@@ -737,7 +737,7 @@
_visitChildren(node, {
'documentationComment': node.documentationComment,
'metadata': node.metadata,
- 'name': node.name2,
+ 'name': node.name,
'typeParameters': node.typeParameters,
'functionType': node.functionType,
});
@@ -910,7 +910,7 @@
'externalKeyword': node.externalKeyword,
'modifierKeyword': node.modifierKeyword,
'returnType': node.returnType,
- 'name': node.name2,
+ 'name': node.name,
'operatorKeyword': node.operatorKeyword,
'typeParameters': node.typeParameters,
'parameters': node.parameters,
@@ -935,7 +935,7 @@
_visitChildren(node, {
'documentationComment': node.documentationComment,
'metadata': node.metadata,
- 'name': node.name2,
+ 'name': node.name,
'typeParameters': node.typeParameters,
'onClause': node.onClause,
'implementsClause': node.implementsClause,
@@ -1232,7 +1232,7 @@
@override
void visitTypeParameter(TypeParameter node) {
_visitChildren(node, {
- 'name': node.name2,
+ 'name': node.name,
'bound': node.bound,
});
super.visitTypeParameter(node);
@@ -1249,7 +1249,7 @@
_visitChildren(node, {
'documentationComment': node.documentationComment,
'metadata': node.metadata,
- 'name': node.name2,
+ 'name': node.name,
'initializer': node.initializer,
});
super.visitVariableDeclaration(node);
diff --git a/pkg/analysis_server/tool/code_completion/implicit_type_declarations.dart b/pkg/analysis_server/tool/code_completion/implicit_type_declarations.dart
index 256995e..113f914 100644
--- a/pkg/analysis_server/tool/code_completion/implicit_type_declarations.dart
+++ b/pkg/analysis_server/tool/code_completion/implicit_type_declarations.dart
@@ -110,7 +110,7 @@
if (rhsType != null && !rhsType.isDynamic) {
// Record the name with the type.
data.recordImpliedType(
- node.name2.lexeme,
+ node.name.lexeme,
rhsType.getDisplayString(withNullability: false),
);
}
diff --git a/pkg/analysis_server/tool/code_completion/relevance_metrics.dart b/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
index 03fd699..67c2c33 100644
--- a/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
+++ b/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
@@ -993,7 +993,7 @@
if (node.target is SuperExpression) {
var enclosingMethod = node.thisOrAncestorOfType<MethodDeclaration>();
if (enclosingMethod != null) {
- if (enclosingMethod.name2.lexeme == node.methodName.name) {
+ if (enclosingMethod.name.lexeme == node.methodName.name) {
data.recordTypeMatch('super invocation member', 'same');
} else {
data.recordTypeMatch('super invocation member', 'different');
@@ -1120,7 +1120,7 @@
if (node.target is SuperExpression) {
var enclosingMethod = node.thisOrAncestorOfType<MethodDeclaration>();
if (enclosingMethod != null) {
- if (enclosingMethod.name2.lexeme == node.propertyName.name) {
+ if (enclosingMethod.name.lexeme == node.propertyName.name) {
data.recordTypeMatch('super property access member', 'same');
} else {
data.recordTypeMatch('super property access member', 'different');
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index 67e9437..6ddb22a 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -1,3 +1,6 @@
+## 5.1.0-dev
+* Deprecated `get name2`, use `get name` instead.
+
## 5.0.0
* Removed deprecated methods from AST.
* Removed deprecated `DiagnosticMessage.message`.
diff --git a/pkg/analyzer/doc/tutorial/ast.md b/pkg/analyzer/doc/tutorial/ast.md
index 145e975..c3e275c 100644
--- a/pkg/analyzer/doc/tutorial/ast.md
+++ b/pkg/analyzer/doc/tutorial/ast.md
@@ -90,19 +90,19 @@
void printMembers(CompilationUnit unit) {
for (CompilationUnitMember unitMember in unit.declarations) {
if (unitMember is ClassDeclaration) {
- print(unitMember.name2.lexeme);
+ print(unitMember.name.lexeme);
for (ClassMember classMember in unitMember.members) {
if (classMember is MethodDeclaration) {
- print(' ${classMember.name2.lexeme}');
+ print(' ${classMember.name.lexeme}');
} else if (classMember is FieldDeclaration) {
for (VariableDeclaration field in classMember.fields.variables) {
- print(' ${field.name2.lexeme}');
+ print(' ${field.name.lexeme}');
}
} else if (classMember is ConstructorDeclaration) {
- if (classMember.name2 == null) {
- print(' ${unitMember.name2.lexeme}');
+ if (classMember.name == null) {
+ print(' ${unitMember.name.lexeme}');
} else {
- print(' ${unitMember.name2.lexeme}.${classMember.name2.lexeme}');
+ print(' ${unitMember.name.lexeme}.${classMember.name.lexeme}');
}
}
}
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index c61d940..40e4945 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -1465,6 +1465,11 @@
/// Return the name of the constructor, or `null` if the constructor being
/// declared is unnamed.
+ Token? get name;
+
+ /// Return the name of the constructor, or `null` if the constructor being
+ /// declared is unnamed.
+ @Deprecated('Use name instead')
Token? get name2;
/// Return the parameters associated with the constructor.
@@ -1840,6 +1845,10 @@
ConstructorElement? get constructorElement;
/// Return the name of the constant.
+ Token get name;
+
+ /// Return the name of the constant.
+ @Deprecated('Use name instead')
Token get name2;
}
@@ -2041,6 +2050,11 @@
/// Return the name of the extension, or `null` if the extension does not have
/// a name.
+ Token? get name;
+
+ /// Return the name of the extension, or `null` if the extension does not have
+ /// a name.
+ @Deprecated('Use name instead')
Token? get name2;
/// Return the token representing the 'on' keyword.
@@ -3510,6 +3524,10 @@
Token? get modifierKeyword;
/// Return the name of the method.
+ Token get name;
+
+ /// Return the name of the method.
+ @Deprecated('Use name instead')
Token get name2;
/// Return the token representing the 'operator' keyword, or `null` if this
@@ -3684,6 +3702,10 @@
/// Clients may not extend, implement or mix-in this class.
abstract class NamedCompilationUnitMember implements CompilationUnitMember {
/// Return the name of the member being declared.
+ Token get name;
+
+ /// Return the name of the member being declared.
+ @Deprecated('Use name instead')
Token get name2;
}
@@ -5170,6 +5192,10 @@
Token? get extendsKeyword;
/// Return the name of the type parameter.
+ Token get name;
+
+ /// Return the name of the type parameter.
+ @Deprecated('Use name instead')
Token get name2;
}
@@ -5242,6 +5268,10 @@
bool get isLate;
/// Return the name of the variable being declared.
+ Token get name;
+
+ /// Return the name of the variable being declared.
+ @Deprecated('Use name instead')
Token get name2;
}
diff --git a/pkg/analyzer/lib/error/listener.dart b/pkg/analyzer/lib/error/listener.dart
index 4dc82be..79ed12f 100644
--- a/pkg/analyzer/lib/error/listener.dart
+++ b/pkg/analyzer/lib/error/listener.dart
@@ -86,10 +86,10 @@
// TODO(brianwilkerson) Consider extending this method to take any
// declaration and compute the correct range for the name of that
// declaration. This might make it easier to be consistent.
- if (constructor.name2 != null) {
+ if (constructor.name != null) {
var offset = constructor.returnType.offset;
reportErrorForOffset(
- code, offset, constructor.name2!.end - offset, arguments);
+ code, offset, constructor.name!.end - offset, arguments);
} else {
reportErrorForNode(code, constructor.returnType, arguments);
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/defined_names.dart b/pkg/analyzer/lib/src/dart/analysis/defined_names.dart
index a9295f5..6aeae87 100644
--- a/pkg/analyzer/lib/src/dart/analysis/defined_names.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/defined_names.dart
@@ -18,23 +18,23 @@
void appendClassMemberName(ClassMember member) {
if (member is MethodDeclaration) {
- appendName(names.classMemberNames, member.name2);
+ appendName(names.classMemberNames, member.name);
} else if (member is FieldDeclaration) {
for (VariableDeclaration field in member.fields.variables) {
- appendName(names.classMemberNames, field.name2);
+ appendName(names.classMemberNames, field.name);
}
}
}
void appendTopLevelName(CompilationUnitMember member) {
if (member is NamedCompilationUnitMember) {
- appendName(names.topLevelNames, member.name2);
+ appendName(names.topLevelNames, member.name);
if (member is ClassDeclaration) {
member.members.forEach(appendClassMemberName);
}
if (member is EnumDeclaration) {
for (var constant in member.constants) {
- appendName(names.classMemberNames, constant.name2);
+ appendName(names.classMemberNames, constant.name);
}
member.members.forEach(appendClassMemberName);
}
@@ -43,7 +43,7 @@
}
} else if (member is TopLevelVariableDeclaration) {
for (VariableDeclaration variable in member.variables.variables) {
- appendName(names.topLevelNames, variable.name2);
+ appendName(names.topLevelNames, variable.name);
}
}
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index c87f551..f97b9a1 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -910,13 +910,13 @@
if (declaration.macroKeyword != null) {
var constructors = declaration.members
.whereType<ConstructorDeclaration>()
- .map((e) => e.name2?.lexeme ?? '')
+ .map((e) => e.name?.lexeme ?? '')
.where((e) => !e.startsWith('_'))
.toList();
if (constructors.isNotEmpty) {
macroClasses.add(
MacroClass(
- name: declaration.name2.lexeme,
+ name: declaration.name.lexeme,
constructors: constructors,
),
);
@@ -940,21 +940,21 @@
final topLevelDeclarations = <String>{};
for (final declaration in unit.declarations) {
if (declaration is ClassDeclaration) {
- topLevelDeclarations.add(declaration.name2.lexeme);
+ topLevelDeclarations.add(declaration.name.lexeme);
} else if (declaration is EnumDeclaration) {
- topLevelDeclarations.add(declaration.name2.lexeme);
+ topLevelDeclarations.add(declaration.name.lexeme);
} else if (declaration is ExtensionDeclaration) {
- var name = declaration.name2;
+ var name = declaration.name;
if (name != null) {
topLevelDeclarations.add(name.lexeme);
}
} else if (declaration is FunctionDeclaration) {
- topLevelDeclarations.add(declaration.name2.lexeme);
+ topLevelDeclarations.add(declaration.name.lexeme);
} else if (declaration is MixinDeclaration) {
- topLevelDeclarations.add(declaration.name2.lexeme);
+ topLevelDeclarations.add(declaration.name.lexeme);
} else if (declaration is TopLevelVariableDeclaration) {
for (var variable in declaration.variables.variables) {
- topLevelDeclarations.add(variable.name2.lexeme);
+ topLevelDeclarations.add(variable.name.lexeme);
}
}
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/index.dart b/pkg/analyzer/lib/src/dart/analysis/index.dart
index ecd362c..f186e17 100644
--- a/pkg/analyzer/lib/src/dart/analysis/index.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/index.dart
@@ -565,7 +565,7 @@
if (node.extendsClause == null) {
final objectElement = declaredElement.supertype?.element2;
recordRelationOffset(objectElement, IndexRelationKind.IS_EXTENDED_BY,
- node.name2.offset, 0, true);
+ node.name.offset, 0, true);
}
recordIsAncestorOf(declaredElement);
super.visitClassDeclaration(node);
@@ -655,7 +655,7 @@
offset = constructorSelector.period.offset;
length = constructorSelector.name.end - offset;
} else {
- offset = node.name2.end;
+ offset = node.name.end;
length = 0;
}
recordRelationOffset(
@@ -675,7 +675,7 @@
@override
void visitEnumDeclaration(EnumDeclaration node) {
_addSubtype(
- node.name2.lexeme,
+ node.name.lexeme,
withClause: node.withClause,
implementsClause: node.implementsClause,
memberNodes: node.members,
@@ -942,10 +942,10 @@
for (ClassMember member in memberNodes) {
if (member is MethodDeclaration && !member.isStatic) {
- addMemberName(member.name2);
+ addMemberName(member.name);
} else if (member is FieldDeclaration && !member.isStatic) {
for (var field in member.fields.variables) {
- addMemberName(field.name2);
+ addMemberName(field.name);
}
}
}
@@ -958,7 +958,7 @@
/// Record the given class as a subclass of its direct superclasses.
void _addSubtypeForClassDeclaration(ClassDeclaration node) {
- _addSubtype(node.name2.lexeme,
+ _addSubtype(node.name.lexeme,
superclass: node.extendsClause?.superclass,
withClause: node.withClause,
implementsClause: node.implementsClause,
@@ -967,7 +967,7 @@
/// Record the given class as a subclass of its direct superclasses.
void _addSubtypeForClassTypeAlis(ClassTypeAlias node) {
- _addSubtype(node.name2.lexeme,
+ _addSubtype(node.name.lexeme,
superclass: node.superclass,
withClause: node.withClause,
implementsClause: node.implementsClause,
@@ -976,7 +976,7 @@
/// Record the given mixin as a subclass of its direct superclasses.
void _addSubtypeForMixinDeclaration(MixinDeclaration node) {
- _addSubtype(node.name2.lexeme,
+ _addSubtype(node.name.lexeme,
onClause: node.onClause,
implementsClause: node.implementsClause,
memberNodes: node.members);
diff --git a/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart b/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart
index 5f37b84..83a4f1a 100644
--- a/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart
@@ -65,7 +65,7 @@
_LocalNameScope scope = _LocalNameScope(enclosing);
for (Statement statement in node.statements) {
if (statement is FunctionDeclarationStatement) {
- scope.add(statement.functionDeclaration.name2);
+ scope.add(statement.functionDeclaration.name);
} else if (statement is VariableDeclarationStatement) {
scope.addVariableNames(statement.variables);
}
@@ -81,7 +81,7 @@
if (member is FieldDeclaration) {
scope.addVariableNames(member.fields);
} else if (member is MethodDeclaration) {
- scope.add(member.name2);
+ scope.add(member.name);
}
}
return scope;
@@ -128,7 +128,7 @@
_LocalNameScope scope = _LocalNameScope(null);
for (CompilationUnitMember declaration in node.declarations) {
if (declaration is NamedCompilationUnitMember) {
- scope.add(declaration.name2);
+ scope.add(declaration.name);
} else if (declaration is TopLevelVariableDeclaration) {
scope.addVariableNames(declaration.variables);
}
@@ -152,13 +152,13 @@
void addTypeParameters(TypeParameterList? typeParameterList) {
if (typeParameterList != null) {
- typeParameterList.typeParameters.map((p) => p.name2).forEach(add);
+ typeParameterList.typeParameters.map((p) => p.name).forEach(add);
}
}
void addVariableNames(VariableDeclarationList variableList) {
for (VariableDeclaration variable in variableList.variables) {
- add(variable.name2);
+ add(variable.name);
}
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/results.dart b/pkg/analyzer/lib/src/dart/analysis/results.dart
index e484603..5c352da 100644
--- a/pkg/analyzer/lib/src/dart/analysis/results.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/results.dart
@@ -344,26 +344,26 @@
if (element is InterfaceElement) {
if (node is ClassDeclaration) {
- if (_hasOffset2(node.name2)) {
+ if (_hasOffset2(node.name)) {
result = node;
}
} else if (node is ClassTypeAlias) {
- if (_hasOffset2(node.name2)) {
+ if (_hasOffset2(node.name)) {
result = node;
}
} else if (node is EnumDeclaration) {
- if (_hasOffset2(node.name2)) {
+ if (_hasOffset2(node.name)) {
result = node;
}
} else if (node is MixinDeclaration) {
- if (_hasOffset2(node.name2)) {
+ if (_hasOffset2(node.name)) {
result = node;
}
}
} else if (element is ConstructorElement) {
if (node is ConstructorDeclaration) {
- if (node.name2 != null) {
- if (_hasOffset2(node.name2)) {
+ if (node.name != null) {
+ if (_hasOffset2(node.name)) {
result = node;
}
} else {
@@ -374,30 +374,30 @@
}
} else if (element is ExtensionElement) {
if (node is ExtensionDeclaration) {
- if (_hasOffset2(node.name2)) {
+ if (_hasOffset2(node.name)) {
result = node;
}
}
} else if (element is FieldElement) {
if (node is EnumConstantDeclaration) {
- if (_hasOffset2(node.name2)) {
+ if (_hasOffset2(node.name)) {
result = node;
}
} else if (node is VariableDeclaration) {
- if (_hasOffset2(node.name2)) {
+ if (_hasOffset2(node.name)) {
result = node;
}
}
} else if (element is FunctionElement) {
- if (node is FunctionDeclaration && _hasOffset2(node.name2)) {
+ if (node is FunctionDeclaration && _hasOffset2(node.name)) {
result = node;
}
} else if (element is LocalVariableElement) {
- if (node is VariableDeclaration && _hasOffset2(node.name2)) {
+ if (node is VariableDeclaration && _hasOffset2(node.name)) {
result = node;
}
} else if (element is MethodElement) {
- if (node is MethodDeclaration && _hasOffset2(node.name2)) {
+ if (node is MethodDeclaration && _hasOffset2(node.name)) {
result = node;
}
} else if (element is ParameterElement) {
@@ -406,16 +406,16 @@
}
} else if (element is PropertyAccessorElement) {
if (node is FunctionDeclaration) {
- if (_hasOffset2(node.name2)) {
+ if (_hasOffset2(node.name)) {
result = node;
}
} else if (node is MethodDeclaration) {
- if (_hasOffset2(node.name2)) {
+ if (_hasOffset2(node.name)) {
result = node;
}
}
} else if (element is TopLevelVariableElement) {
- if (node is VariableDeclaration && _hasOffset2(node.name2)) {
+ if (node is VariableDeclaration && _hasOffset2(node.name)) {
result = node;
}
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/unlinked_api_signature.dart b/pkg/analyzer/lib/src/dart/analysis/unlinked_api_signature.dart
index b32db67..25d679a 100644
--- a/pkg/analyzer/lib/src/dart/analysis/unlinked_api_signature.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/unlinked_api_signature.dart
@@ -49,7 +49,7 @@
var functionExpression = declaration.functionExpression;
_addTokens(
declaration.beginToken,
- functionExpression.parameters?.endToken ?? declaration.name2,
+ functionExpression.parameters?.endToken ?? declaration.name,
);
_addFunctionBodyModifiers(functionExpression.body);
} else if (declaration is MixinDeclaration) {
@@ -140,7 +140,7 @@
signature.addInt(_kindMethodDeclaration);
_addTokens(
node.beginToken,
- node.parameters?.endToken ?? node.name2,
+ node.parameters?.endToken ?? node.name,
);
signature.addBool(node.body is EmptyFunctionBody);
_addFunctionBodyModifiers(node.body);
@@ -219,7 +219,7 @@
signature.addInt(variables.length);
for (var variable in variables) {
- _addToken(variable.name2);
+ _addToken(variable.name);
signature.addBool(variable.initializer != null);
if (includeInitializers) {
_addNode(variable.initializer);
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index b76570e..65306db 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -1842,7 +1842,7 @@
required this.macroKeyword,
required this.augmentKeyword,
required this.classKeyword,
- required super.name2,
+ required super.name,
required TypeParameterListImpl? typeParameters,
required ExtendsClauseImpl? extendsClause,
required WithClauseImpl? withClause,
@@ -1917,7 +1917,7 @@
..addToken('macroKeyword', macroKeyword)
..addToken('augmentKeyword', augmentKeyword)
..addToken('classKeyword', classKeyword)
- ..addToken('name', name2)
+ ..addToken('name', name)
..addNode('typeParameters', typeParameters)
..addNode('extendsClause', extendsClause)
..addNode('withClause', withClause)
@@ -2006,7 +2006,7 @@
required super.comment,
required super.metadata,
required super.typedefKeyword,
- required super.name2,
+ required super.name,
required TypeParameterListImpl? typeParameters,
required this.equals,
required this.abstractKeyword,
@@ -2063,7 +2063,7 @@
@override
ChildEntities get _childEntities => super._childEntities
..addToken('typedefKeyword', typedefKeyword)
- ..addToken('name', name2)
+ ..addToken('name', name)
..addNode('typeParameters', typeParameters)
..addToken('equals', equals)
..addToken('abstractKeyword', abstractKeyword)
@@ -2788,7 +2788,7 @@
/// The name of the constructor, or `null` if the constructor being declared
/// is unnamed.
@override
- Token? name2;
+ Token? name;
/// The parameters associated with the constructor.
FormalParameterListImpl _parameters;
@@ -2819,7 +2819,7 @@
/// [comment] and [metadata] can be `null` if the constructor does not have
/// the corresponding attribute. The [constKeyword] can be `null` if the
/// constructor cannot be used to create a constant. The [factoryKeyword] can
- /// be `null` if the constructor is not a factory. The [period] and [name2] can
+ /// be `null` if the constructor is not a factory. The [period] and [name] can
/// both be `null` if the constructor is not a named constructor. The
/// [separator] can be `null` if the constructor does not have any
/// initializers and does not redirect to a different constructor. The list of
@@ -2835,7 +2835,7 @@
required this.factoryKeyword,
required IdentifierImpl returnType,
required this.period,
- required this.name2,
+ required this.name,
required FormalParameterListImpl parameters,
required this.separator,
required List<ConstructorInitializer>? initializers,
@@ -2874,6 +2874,10 @@
@override
NodeListImpl<ConstructorInitializer> get initializers => _initializers;
+ @Deprecated('Use name instead')
+ @override
+ Token? get name2 => name;
+
@override
FormalParameterListImpl get parameters => _parameters;
@@ -2903,7 +2907,7 @@
..addToken('factoryKeyword', factoryKeyword)
..addNode('returnType', returnType)
..addToken('period', period)
- ..addToken('name', name2)
+ ..addToken('name', name)
..addNode('parameters', parameters)
..addToken('separator', separator)
..addNodeList('initializers', initializers)
@@ -3803,7 +3807,7 @@
class EnumConstantDeclarationImpl extends DeclarationImpl
implements EnumConstantDeclaration {
@override
- final Token name2;
+ final Token name;
@override
FieldElement? declaredElement2;
@@ -3820,21 +3824,25 @@
EnumConstantDeclarationImpl({
required super.comment,
required super.metadata,
- required this.name2,
+ required this.name,
required this.arguments,
}) {
_becomeParentOf(arguments);
}
@override
- Token get endToken => arguments?.endToken ?? name2;
+ Token get endToken => arguments?.endToken ?? name;
@override
- Token get firstTokenAfterCommentAndMetadata => name2;
+ Token get firstTokenAfterCommentAndMetadata => name;
+
+ @Deprecated('Use name instead')
+ @override
+ Token get name2 => name;
@override
ChildEntities get _childEntities => super._childEntities
- ..addToken('name', name2)
+ ..addToken('name', name)
..addNode('arguments', arguments);
@override
@@ -3900,7 +3908,7 @@
required super.comment,
required super.metadata,
required this.enumKeyword,
- required super.name2,
+ required super.name,
required TypeParameterListImpl? typeParameters,
required WithClauseImpl? withClause,
required ImplementsClauseImpl? implementsClause,
@@ -3957,7 +3965,7 @@
// TODO(brianwilkerson) Add commas?
ChildEntities get _childEntities => super._childEntities
..addToken('enumKeyword', enumKeyword)
- ..addToken('name', name2)
+ ..addToken('name', name)
..addNode('typeParameters', typeParameters)
..addNode('withClause', withClause)
..addNode('implementsClause', implementsClause)
@@ -4364,7 +4372,7 @@
HideClauseImpl? _hideClause;
@override
- Token? name2;
+ Token? name;
/// The show clause for the extension or `null` if the declaration does not
/// show any elements.
@@ -4397,7 +4405,7 @@
required super.metadata,
required this.extensionKeyword,
required this.typeKeyword,
- required this.name2,
+ required this.name,
required TypeParameterListImpl? typeParameters,
required this.onKeyword,
required TypeAnnotationImpl extendedType,
@@ -4438,6 +4446,10 @@
@override
NodeListImpl<ClassMember> get members => _members;
+ @Deprecated('Use name instead')
+ @override
+ Token? get name2 => name;
+
@override
ShowClauseImpl? get showClause => _showClause;
@@ -4455,7 +4467,7 @@
@override
ChildEntities get _childEntities => ChildEntities()
..addToken('extensionKeyword', extensionKeyword)
- ..addToken('name', name2)
+ ..addToken('name', name)
..addNode('typeParameters', typeParameters)
..addToken('onKeyword', onKeyword)
..addNode('extendedType', extendedType)
@@ -5626,7 +5638,7 @@
required this.externalKeyword,
required TypeAnnotationImpl? returnType,
required this.propertyKeyword,
- required super.name2,
+ required super.name,
required FunctionExpressionImpl functionExpression,
}) : _returnType = returnType,
_functionExpression = functionExpression {
@@ -5643,7 +5655,7 @@
externalKeyword ??
_returnType?.beginToken ??
propertyKeyword ??
- name2;
+ name;
}
@override
@@ -5673,7 +5685,7 @@
..addToken('externalKeyword', externalKeyword)
..addNode('returnType', returnType)
..addToken('propertyKeyword', propertyKeyword)
- ..addToken('name', name2)
+ ..addToken('name', name)
..addNode('functionExpression', functionExpression);
@override
@@ -5996,7 +6008,7 @@
required super.metadata,
required super.typedefKeyword,
required TypeAnnotationImpl? returnType,
- required super.name2,
+ required super.name,
required TypeParameterListImpl? typeParameters,
required FormalParameterListImpl parameters,
required super.semicolon,
@@ -6033,7 +6045,7 @@
ChildEntities get _childEntities => super._childEntities
..addToken('typedefKeyword', typedefKeyword)
..addNode('returnType', returnType)
- ..addToken('name', name2)
+ ..addToken('name', name)
..addNode('typeParameters', typeParameters)
..addNode('parameters', parameters)
..addToken('semicolon', semicolon);
@@ -6309,7 +6321,7 @@
required super.comment,
required super.metadata,
required super.typedefKeyword,
- required super.name2,
+ required super.name,
required TypeParameterListImpl? typeParameters,
required this.equals,
required TypeAnnotationImpl type,
@@ -6354,7 +6366,7 @@
ChildEntities get _childEntities => ChildEntities()
..addNodeList('metadata', metadata)
..addToken('typedefKeyword', typedefKeyword)
- ..addToken('name', name2)
+ ..addToken('name', name)
..addNode('typeParameters', typeParameters)
..addToken('equals', equals)
..addNode('type', type);
@@ -8198,7 +8210,7 @@
Token? operatorKeyword;
@override
- Token name2;
+ Token name;
/// The type parameters associated with the method, or `null` if the method is
/// not a generic method.
@@ -8236,7 +8248,7 @@
required TypeAnnotationImpl? returnType,
required this.propertyKeyword,
required this.operatorKeyword,
- required this.name2,
+ required this.name,
required TypeParameterListImpl? typeParameters,
required FormalParameterListImpl? parameters,
required FunctionBodyImpl body,
@@ -8265,7 +8277,7 @@
return Token.lexicallyFirst(externalKeyword, modifierKeyword) ??
_returnType?.beginToken ??
Token.lexicallyFirst(propertyKeyword, operatorKeyword) ??
- name2;
+ name;
}
@override
@@ -8287,6 +8299,10 @@
@override
bool get isStatic => modifierKeyword?.keyword == Keyword.STATIC;
+ @Deprecated('Use name instead')
+ @override
+ Token get name2 => name;
+
@override
FormalParameterListImpl? get parameters => _parameters;
@@ -8315,7 +8331,7 @@
..addNode('returnType', returnType)
..addToken('propertyKeyword', propertyKeyword)
..addToken('operatorKeyword', operatorKeyword)
- ..addToken('name', name2)
+ ..addToken('name', name)
..addNode('parameters', parameters)
..addNode('body', body);
@@ -8543,7 +8559,7 @@
required super.metadata,
required this.augmentKeyword,
required this.mixinKeyword,
- required super.name2,
+ required super.name,
required TypeParameterListImpl? typeParameters,
required OnClauseImpl? onClause,
required ImplementsClauseImpl? implementsClause,
@@ -8595,7 +8611,7 @@
@override
ChildEntities get _childEntities => super._childEntities
..addToken('mixinKeyword', mixinKeyword)
- ..addToken('name', name2)
+ ..addToken('name', name)
..addNode('typeParameters', typeParameters)
..addNode('onClause', onClause)
..addNode('implementsClause', implementsClause)
@@ -8621,16 +8637,20 @@
implements NamedCompilationUnitMember {
/// The name of the member being declared.
@override
- Token name2;
+ Token name;
- /// Initialize a newly created compilation unit member with the given [name2].
+ /// Initialize a newly created compilation unit member with the given [name].
/// Either or both of the [comment] and [metadata] can be `null` if the member
/// does not have the corresponding attribute.
NamedCompilationUnitMemberImpl({
required super.comment,
required super.metadata,
- required this.name2,
+ required this.name,
});
+
+ @Deprecated('Use name instead')
+ @override
+ Token get name2 => name;
}
/// An expression that has a name associated with it. They are used in method
@@ -12556,7 +12576,7 @@
required super.comment,
required super.metadata,
required this.typedefKeyword,
- required super.name2,
+ required super.name,
required this.semicolon,
});
@@ -12728,7 +12748,7 @@
/// typeParameterVariance ::= 'out' | 'inout' | 'in'
class TypeParameterImpl extends DeclarationImpl implements TypeParameter {
@override
- Token name2;
+ Token name;
/// The token representing the variance modifier keyword, or `null` if
/// there is no explicit variance modifier, meaning legacy covariance.
@@ -12753,7 +12773,7 @@
TypeParameterImpl({
required super.comment,
required super.metadata,
- required this.name2,
+ required this.name,
required this.extendsKeyword,
required TypeAnnotationImpl? bound,
this.varianceKeyword,
@@ -12771,17 +12791,21 @@
@override
Token get endToken {
if (_bound == null) {
- return name2;
+ return name;
}
return _bound!.endToken;
}
@override
- Token get firstTokenAfterCommentAndMetadata => name2;
+ Token get firstTokenAfterCommentAndMetadata => name;
+
+ @Deprecated('Use name instead')
+ @override
+ Token get name2 => name;
@override
ChildEntities get _childEntities => super._childEntities
- ..addToken('name', name2)
+ ..addToken('name', name)
..addToken('extendsKeyword', extendsKeyword)
..addNode('bound', bound);
@@ -12932,7 +12956,7 @@
class VariableDeclarationImpl extends DeclarationImpl
implements VariableDeclaration {
@override
- Token name2;
+ Token name;
@override
VariableElement? declaredElement2;
@@ -12955,7 +12979,7 @@
/// Initialize a newly created variable declaration. The [equals] and
/// [initializer] can be `null` if there is no initializer.
VariableDeclarationImpl({
- required this.name2,
+ required this.name,
required this.equals,
required ExpressionImpl? initializer,
}) : _initializer = initializer,
@@ -12983,11 +13007,11 @@
if (_initializer != null) {
return _initializer!.endToken;
}
- return name2;
+ return name;
}
@override
- Token get firstTokenAfterCommentAndMetadata => name2;
+ Token get firstTokenAfterCommentAndMetadata => name;
@override
ExpressionImpl? get initializer => _initializer;
@@ -13014,9 +13038,13 @@
return parent is VariableDeclarationList && parent.isLate;
}
+ @Deprecated('Use name instead')
+ @override
+ Token get name2 => name;
+
@override
ChildEntities get _childEntities => super._childEntities
- ..addToken('name', name2)
+ ..addToken('name', name)
..addToken('equals', equals)
..addNode('initializer', initializer);
diff --git a/pkg/analyzer/lib/src/dart/ast/element_locator.dart b/pkg/analyzer/lib/src/dart/ast/element_locator.dart
index 916c451..d642895 100644
--- a/pkg/analyzer/lib/src/dart/ast/element_locator.dart
+++ b/pkg/analyzer/lib/src/dart/ast/element_locator.dart
@@ -121,7 +121,7 @@
// Constructor Elements
var returnType = parent.returnType;
if (identical(returnType, node)) {
- var name = parent.name2;
+ var name = parent.name;
if (name != null) {
return parent.declaredElement2;
}
@@ -129,7 +129,7 @@
if (element is InterfaceElement) {
return element.unnamedConstructor;
}
- } else if (parent.name2 == node.endToken) {
+ } else if (parent.name == node.endToken) {
return parent.declaredElement2;
}
} else if (parent is LibraryIdentifier) {
diff --git a/pkg/analyzer/lib/src/dart/ast/invokes_super_self.dart b/pkg/analyzer/lib/src/dart/ast/invokes_super_self.dart
index c17d674..8525340 100644
--- a/pkg/analyzer/lib/src/dart/ast/invokes_super_self.dart
+++ b/pkg/analyzer/lib/src/dart/ast/invokes_super_self.dart
@@ -72,7 +72,7 @@
extension MethodDeclarationExtension on MethodDeclaration {
bool get invokesSuperSelf {
var visitor = _SuperVisitor(
- name2.lexeme,
+ name.lexeme,
isSetter ? _Usage.writing : _Usage.reading,
);
body.accept(visitor);
diff --git a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
index 9403a50..5ac9ea6 100644
--- a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
@@ -190,7 +190,7 @@
_visitToken(node.macroKeyword, suffix: ' ');
_visitToken(node.augmentKeyword, suffix: ' ');
sink.write('class ');
- _visitToken(node.name2);
+ _visitToken(node.name);
_visitNode(node.typeParameters);
_visitNode(node.extendsClause, prefix: ' ');
_visitNode(node.withClause, prefix: ' ');
@@ -207,7 +207,7 @@
_visitToken(node.abstractKeyword, suffix: ' ');
_visitToken(node.macroKeyword, suffix: ' ');
sink.write('class ');
- _visitToken(node.name2);
+ _visitToken(node.name);
_visitNode(node.typeParameters);
sink.write(' = ');
_visitNode(node.superclass);
@@ -264,7 +264,7 @@
_visitToken(node.constKeyword, suffix: ' ');
_visitToken(node.factoryKeyword, suffix: ' ');
_visitNode(node.returnType);
- _visitToken(node.name2, prefix: '.');
+ _visitToken(node.name, prefix: '.');
_visitNode(node.parameters);
_visitNodeList(node.initializers, prefix: ' : ', separator: ', ');
_visitNode(node.redirectedConstructor, prefix: ' = ');
@@ -363,7 +363,7 @@
@override
void visitEnumConstantDeclaration(EnumConstantDeclaration node) {
_visitNodeList(node.metadata, separator: ' ', suffix: ' ');
- _visitToken(node.name2);
+ _visitToken(node.name);
_visitNode(node.arguments);
}
@@ -371,7 +371,7 @@
void visitEnumDeclaration(EnumDeclaration node) {
_visitNodeList(node.metadata, separator: ' ', suffix: ' ');
sink.write('enum ');
- _visitToken(node.name2);
+ _visitToken(node.name);
_visitNode(node.typeParameters);
_visitNode(node.withClause, prefix: ' ');
_visitNode(node.implementsClause, prefix: ' ');
@@ -426,7 +426,7 @@
_visitNodeList(node.metadata, separator: ' ', suffix: ' ');
_visitToken(node.extensionKeyword, suffix: ' ');
_visitToken(node.typeKeyword, suffix: ' ');
- _visitToken(node.name2);
+ _visitToken(node.name);
_visitNode(node.typeParameters);
sink.write(' ');
_visitToken(node.onKeyword);
@@ -581,7 +581,7 @@
_visitToken(node.externalKeyword, suffix: ' ');
_visitNode(node.returnType, suffix: ' ');
_visitToken(node.propertyKeyword, suffix: ' ');
- _visitToken(node.name2);
+ _visitToken(node.name);
_visitNode(node.functionExpression);
}
@@ -615,7 +615,7 @@
_visitNodeList(node.metadata, separator: ' ', suffix: ' ');
sink.write('typedef ');
_visitNode(node.returnType, suffix: ' ');
- _visitToken(node.name2);
+ _visitToken(node.name);
_visitNode(node.typeParameters);
_visitNode(node.parameters);
sink.write(';');
@@ -650,7 +650,7 @@
void visitGenericTypeAlias(GenericTypeAlias node) {
_visitNodeList(node.metadata, separator: ' ', suffix: ' ');
sink.write('typedef ');
- _visitToken(node.name2);
+ _visitToken(node.name);
_visitNode(node.typeParameters);
sink.write(' = ');
_visitNode(node.type);
@@ -849,7 +849,7 @@
_visitNode(node.returnType, suffix: ' ');
_visitToken(node.propertyKeyword, suffix: ' ');
_visitToken(node.operatorKeyword, suffix: ' ');
- _visitToken(node.name2);
+ _visitToken(node.name);
if (!node.isGetter) {
_visitNode(node.typeParameters);
_visitNode(node.parameters);
@@ -870,7 +870,7 @@
void visitMixinDeclaration(MixinDeclaration node) {
_visitNodeList(node.metadata, separator: ' ', suffix: ' ');
sink.write('mixin ');
- _visitToken(node.name2);
+ _visitToken(node.name);
_visitNode(node.typeParameters);
_visitNode(node.onClause, prefix: ' ');
_visitNode(node.implementsClause, prefix: ' ');
@@ -1328,7 +1328,7 @@
if (varianceKeyword != null) {
sink.write('${varianceKeyword.lexeme} ');
}
- _visitToken(node.name2);
+ _visitToken(node.name);
_visitNode(node.bound, prefix: ' extends ');
}
@@ -1342,7 +1342,7 @@
@override
void visitVariableDeclaration(VariableDeclaration node) {
_visitNodeList(node.metadata, separator: ' ', suffix: ' ');
- _visitToken(node.name2);
+ _visitToken(node.name);
_visitNode(node.initializer, prefix: ' = ');
}
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index f062887..270915f 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -273,7 +273,7 @@
_isEqualNodeLists(node.metadata, other.metadata) &&
isEqualTokens(node.abstractKeyword, other.abstractKeyword) &&
isEqualTokens(node.classKeyword, other.classKeyword) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualNodes(node.typeParameters, other.typeParameters) &&
isEqualNodes(node.extendsClause, other.extendsClause) &&
isEqualNodes(node.withClause, other.withClause) &&
@@ -290,7 +290,7 @@
node.documentationComment, other.documentationComment) &&
_isEqualNodeLists(node.metadata, other.metadata) &&
isEqualTokens(node.typedefKeyword, other.typedefKeyword) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualNodes(node.typeParameters, other.typeParameters) &&
isEqualTokens(node.equals, other.equals) &&
isEqualTokens(node.abstractKeyword, other.abstractKeyword) &&
@@ -363,7 +363,7 @@
isEqualTokens(node.factoryKeyword, other.factoryKeyword) &&
isEqualNodes(node.returnType, other.returnType) &&
isEqualTokens(node.period, other.period) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualNodes(node.parameters, other.parameters) &&
isEqualTokens(node.separator, other.separator) &&
_isEqualNodeLists(node.initializers, other.initializers) &&
@@ -481,7 +481,7 @@
return isEqualNodes(
node.documentationComment, other.documentationComment) &&
_isEqualNodeLists(node.metadata, other.metadata) &&
- isEqualTokens(node.name2, other.name2);
+ isEqualTokens(node.name, other.name);
}
@override
@@ -491,7 +491,7 @@
node.documentationComment, other.documentationComment) &&
_isEqualNodeLists(node.metadata, other.metadata) &&
isEqualTokens(node.enumKeyword, other.enumKeyword) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualTokens(node.leftBracket, other.leftBracket) &&
_isEqualNodeLists(node.constants, other.constants) &&
isEqualTokens(node.rightBracket, other.rightBracket);
@@ -538,7 +538,7 @@
node.documentationComment, other.documentationComment) &&
_isEqualNodeLists(node.metadata, other.metadata) &&
isEqualTokens(node.extensionKeyword, other.extensionKeyword) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualNodes(node.typeParameters, other.typeParameters) &&
isEqualTokens(node.onKeyword, other.onKeyword) &&
isEqualNodes(node.extendedType, other.extendedType) &&
@@ -687,7 +687,7 @@
isEqualTokens(node.externalKeyword, other.externalKeyword) &&
isEqualNodes(node.returnType, other.returnType) &&
isEqualTokens(node.propertyKeyword, other.propertyKeyword) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualNodes(node.functionExpression, other.functionExpression);
}
@@ -726,7 +726,7 @@
_isEqualNodeLists(node.metadata, other.metadata) &&
isEqualTokens(node.typedefKeyword, other.typedefKeyword) &&
isEqualNodes(node.returnType, other.returnType) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualNodes(node.typeParameters, other.typeParameters) &&
isEqualNodes(node.parameters, other.parameters) &&
isEqualTokens(node.semicolon, other.semicolon);
@@ -760,7 +760,7 @@
node.documentationComment, other.documentationComment) &&
_isEqualNodeLists(node.metadata, other.metadata) &&
isEqualTokens(node.typedefKeyword, other.typedefKeyword) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualNodes(node.typeParameters, other.typeParameters) &&
isEqualTokens(node.equals, other.equals) &&
isEqualNodes(node.type, other.type);
@@ -980,7 +980,7 @@
isEqualNodes(node.returnType, other.returnType) &&
isEqualTokens(node.propertyKeyword, other.propertyKeyword) &&
isEqualTokens(node.operatorKeyword, other.operatorKeyword) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualNodes(node.parameters, other.parameters) &&
isEqualNodes(node.body, other.body);
}
@@ -1001,7 +1001,7 @@
node.documentationComment, other.documentationComment) &&
_isEqualNodeLists(node.metadata, other.metadata) &&
isEqualTokens(node.mixinKeyword, other.mixinKeyword) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualNodes(node.typeParameters, other.typeParameters) &&
isEqualNodes(node.onClause, other.onClause) &&
isEqualNodes(node.implementsClause, other.implementsClause) &&
@@ -1496,7 +1496,7 @@
return isEqualNodes(
node.documentationComment, other.documentationComment) &&
_isEqualNodeLists(node.metadata, other.metadata) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualTokens((node as TypeParameterImpl).varianceKeyword,
(other as TypeParameterImpl).varianceKeyword) &&
isEqualTokens(node.extendsKeyword, other.extendsKeyword) &&
@@ -1517,7 +1517,7 @@
return isEqualNodes(
node.documentationComment, other.documentationComment) &&
_isEqualNodeLists(node.metadata, other.metadata) &&
- isEqualTokens(node.name2, other.name2) &&
+ isEqualTokens(node.name, other.name) &&
isEqualTokens(node.equals, other.equals) &&
isEqualNodes(node.initializer, other.initializer);
}
@@ -3529,7 +3529,7 @@
void _addVariables(NodeList<VariableDeclaration> variables) {
for (VariableDeclaration variable in variables) {
- _addToScope(variable.name2);
+ _addToScope(variable.name);
}
}
@@ -3545,7 +3545,7 @@
_addVariables(statement.variables.variables);
} else if (statement is FunctionDeclarationStatement &&
!_referenceIsWithinLocalFunction) {
- _addToScope(statement.functionDeclaration.name2);
+ _addToScope(statement.functionDeclaration.name);
}
}
}
diff --git a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
index f731f1d..dfc7f9f 100644
--- a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
+++ b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
@@ -578,7 +578,7 @@
for (VariableDeclaration variableDeclaration
in member.fields.variables) {
if (isEnumDeclaration &&
- variableDeclaration.name2.lexeme == 'values') {
+ variableDeclaration.name.lexeme == 'values') {
continue;
}
var initializer = variableDeclaration.initializer;
@@ -599,7 +599,7 @@
CompileTimeErrorCode
.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST,
constKeyword,
- [variableDeclaration.name2.lexeme]);
+ [variableDeclaration.name.lexeme]);
}
}
}
diff --git a/pkg/analyzer/lib/src/dart/micro/utils.dart b/pkg/analyzer/lib/src/dart/micro/utils.dart
index 5978e58..5db0504 100644
--- a/pkg/analyzer/lib/src/dart/micro/utils.dart
+++ b/pkg/analyzer/lib/src/dart/micro/utils.dart
@@ -284,7 +284,7 @@
MatchInfo(e.nameOffset + e.nameLength, 0, MatchKind.DECLARATION));
} else {
var offset = node.period!.offset;
- var length = node.name2!.end - offset;
+ var length = node.name!.end - offset;
references.add(MatchInfo(offset, length, MatchKind.DECLARATION));
}
}
@@ -333,7 +333,7 @@
offset = constructorSelector.period.offset;
length = constructorSelector.name.end - offset;
} else {
- offset = node.name2.end;
+ offset = node.name.end;
length = 0;
}
var kind = node.arguments == null
diff --git a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
index e960686..718dec0 100644
--- a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
@@ -1205,7 +1205,7 @@
void _buildLocalFunctionElement(
covariant FunctionDeclarationStatementImpl statement) {
var node = statement.functionDeclaration;
- var nameToken = node.name2;
+ var nameToken = node.name;
var element = FunctionElementImpl(nameToken.lexeme, nameToken.offset);
node.declaredElement2 = element;
_define(element);
@@ -1218,7 +1218,7 @@
var isLate = variableList.isLate;
for (var variable in variableList.variables) {
variable as VariableDeclarationImpl;
- var nameToken = variable.name2;
+ var nameToken = variable.name;
LocalVariableElementImpl element;
if (isConst && variable.initializer != null) {
@@ -1250,7 +1250,7 @@
for (var typeParameter in typeParameterList.typeParameters) {
typeParameter as TypeParameterImpl;
- var name = typeParameter.name2;
+ var name = typeParameter.name;
TypeParameterElementImpl element;
if (_elementWalker != null) {
diff --git a/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
index da68580..cb837fb 100644
--- a/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
@@ -33,7 +33,7 @@
_resolver.errorReporter.reportErrorForNode(
HintCode.INFERENCE_FAILURE_ON_UNINITIALIZED_VARIABLE,
node,
- [node.name2.lexeme],
+ [node.name.lexeme],
);
}
return;
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index 93e81c0..10fc00f 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -304,9 +304,9 @@
if (undefinedParam != null) {
String? name;
if (parent is FunctionDeclaration) {
- name = parent.name2.lexeme;
+ name = parent.name.lexeme;
} else if (parent is MethodDeclaration) {
- name = parent.name2.lexeme;
+ name = parent.name.lexeme;
}
if (name != null) {
var paramName = undefinedParam is SimpleStringLiteral
@@ -506,8 +506,8 @@
// always named, so we can safely assume
// `overriddenElement.enclosingElement3.name` is non-`null`.
_errorReporter.reportErrorForToken(
- HintCode.INVALID_OVERRIDE_OF_NON_VIRTUAL_MEMBER, field.name2, [
- field.name2.lexeme,
+ HintCode.INVALID_OVERRIDE_OF_NON_VIRTUAL_MEMBER, field.name, [
+ field.name.lexeme,
overriddenElement.enclosingElement3.displayName
]);
}
@@ -546,7 +546,7 @@
// Return types are inferred only on non-recursive local functions.
if (node.parent is CompilationUnit && !node.isSetter) {
_checkStrictInferenceReturnType(
- node.returnType, node, node.name2.lexeme);
+ node.returnType, node, node.name.lexeme);
}
_checkStrictInferenceInParameters(node.functionExpression.parameters,
body: node.functionExpression.body);
@@ -583,7 +583,7 @@
@override
void visitFunctionTypeAlias(FunctionTypeAlias node) {
- _checkStrictInferenceReturnType(node.returnType, node, node.name2.lexeme);
+ _checkStrictInferenceReturnType(node.returnType, node, node.name.lexeme);
_checkStrictInferenceInParameters(node.parameters);
super.visitFunctionTypeAlias(node);
}
@@ -609,7 +609,7 @@
void visitGenericTypeAlias(GenericTypeAlias node) {
if (node.functionType != null) {
_checkStrictInferenceReturnType(
- node.functionType!.returnType, node, node.name2.lexeme);
+ node.functionType!.returnType, node, node.name.lexeme);
}
super.visitGenericTypeAlias(node);
}
@@ -684,7 +684,7 @@
if (!node.isSetter && !elementIsOverride) {
_checkStrictInferenceReturnType(
- node.returnType, node, node.name2.lexeme);
+ node.returnType, node, node.name.lexeme);
}
if (!elementIsOverride) {
_checkStrictInferenceInParameters(node.parameters, body: node.body);
@@ -701,8 +701,8 @@
// always named, so we can safely assume
// `overriddenElement.enclosingElement3.name` is non-`null`.
_errorReporter.reportErrorForToken(
- HintCode.INVALID_OVERRIDE_OF_NON_VIRTUAL_MEMBER, node.name2, [
- node.name2.lexeme,
+ HintCode.INVALID_OVERRIDE_OF_NON_VIRTUAL_MEMBER, node.name, [
+ node.name.lexeme,
overriddenElement.enclosingElement3.displayName
]);
}
@@ -1064,8 +1064,8 @@
definedOrInheritedNonFinalInstanceFields(
element, HashSet<InterfaceElement>());
if (nonFinalFields.isNotEmpty) {
- _errorReporter.reportErrorForToken(HintCode.MUST_BE_IMMUTABLE,
- node.name2, [nonFinalFields.join(', ')]);
+ _errorReporter.reportErrorForToken(
+ HintCode.MUST_BE_IMMUTABLE, node.name, [nonFinalFields.join(', ')]);
}
}
}
@@ -1137,8 +1137,8 @@
// Note that null return types are expected to be flagged by other analyses.
var returnType = decl.returnType?.type;
if (returnType is VoidType) {
- _errorReporter.reportErrorForToken(HintCode.INVALID_FACTORY_METHOD_DECL,
- decl.name2, [decl.name2.lexeme]);
+ _errorReporter.reportErrorForToken(
+ HintCode.INVALID_FACTORY_METHOD_DECL, decl.name, [decl.name.lexeme]);
return;
}
@@ -1167,7 +1167,7 @@
}
_errorReporter.reportErrorForToken(
- HintCode.INVALID_FACTORY_METHOD_IMPL, decl.name2, [decl.name2.lexeme]);
+ HintCode.INVALID_FACTORY_METHOD_IMPL, decl.name, [decl.name.lexeme]);
}
void _checkForInvalidSealedSuperclass(NamedCompilationUnitMember node) {
@@ -1331,13 +1331,13 @@
if (functionNode is FunctionDeclaration) {
_errorReporter.reportErrorForToken(
HintCode.MISSING_RETURN,
- functionNode.name2,
+ functionNode.name,
[returnType],
);
} else if (functionNode is MethodDeclaration) {
_errorReporter.reportErrorForToken(
HintCode.MISSING_RETURN,
- functionNode.name2,
+ functionNode.name,
[returnType],
);
} else {
@@ -1472,7 +1472,7 @@
///
/// Return `true` if and only if a hint code is generated on the passed node.
bool _checkForUnnecessaryNoSuchMethod(MethodDeclaration node) {
- if (node.name2.lexeme != FunctionElement.NO_SUCH_METHOD_METHOD_NAME) {
+ if (node.name.lexeme != FunctionElement.NO_SUCH_METHOD_METHOD_NAME) {
return false;
}
bool isNonObjectNoSuchMethodInvocation(Expression? invocation) {
@@ -1495,7 +1495,7 @@
if (body is ExpressionFunctionBody) {
if (isNonObjectNoSuchMethodInvocation(body.expression)) {
_errorReporter.reportErrorForToken(
- HintCode.UNNECESSARY_NO_SUCH_METHOD, node.name2);
+ HintCode.UNNECESSARY_NO_SUCH_METHOD, node.name);
return true;
}
} else if (body is BlockFunctionBody) {
@@ -1505,7 +1505,7 @@
if (returnStatement is ReturnStatement &&
isNonObjectNoSuchMethodInvocation(returnStatement.expression)) {
_errorReporter.reportErrorForToken(
- HintCode.UNNECESSARY_NO_SUCH_METHOD, node.name2);
+ HintCode.UNNECESSARY_NO_SUCH_METHOD, node.name);
return true;
}
}
@@ -1921,7 +1921,7 @@
if (node.leftOperand is SuperExpression) {
var methodDeclaration = node.thisOrAncestorOfType<MethodDeclaration>();
- if (methodDeclaration?.name2.lexeme == operator.lexeme) {
+ if (methodDeclaration?.name.lexeme == operator.lexeme) {
return;
}
}
@@ -2052,7 +2052,7 @@
parent is PropertyAccess && parent.target is SuperExpression) {
var methodDeclaration =
grandparent?.thisOrAncestorOfType<MethodDeclaration>();
- if (methodDeclaration?.name2.lexeme == identifier.name) {
+ if (methodDeclaration?.name.lexeme == identifier.name) {
validOverride = true;
}
}
diff --git a/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart b/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart
index 163872a..69e3849 100644
--- a/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart
+++ b/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart
@@ -60,9 +60,9 @@
var staticSetters = <String, Element>{};
for (EnumConstantDeclaration constant in node.constants) {
- _checkDuplicateIdentifier(staticGetters, constant.name2,
+ _checkDuplicateIdentifier(staticGetters, constant.name,
element: constant.declaredElement2!);
- _checkValuesDeclarationInEnum(constant.name2);
+ _checkValuesDeclarationInEnum(constant.name);
}
for (var member in node.members) {
@@ -86,7 +86,7 @@
}
} else if (member is FieldDeclaration) {
for (var field in member.fields.variables) {
- var identifier = field.name2;
+ var identifier = field.name;
_checkDuplicateIdentifier(
member.isStatic ? staticGetters : instanceGetters,
identifier,
@@ -98,12 +98,12 @@
} else if (member is MethodDeclaration) {
_checkDuplicateIdentifier(
member.isStatic ? staticGetters : instanceGetters,
- member.name2,
+ member.name,
element: member.declaredElement2!,
setterScope: member.isStatic ? staticSetters : instanceSetters,
);
if (!(member.isStatic && member.isSetter)) {
- _checkValuesDeclarationInEnum2(member.name2);
+ _checkValuesDeclarationInEnum2(member.name);
}
}
}
@@ -111,15 +111,15 @@
if (enumName == 'values') {
_errorReporter.reportErrorForToken(
CompileTimeErrorCode.ENUM_WITH_NAME_VALUES,
- node.name2,
+ node.name,
);
}
for (var constant in node.constants) {
- if (constant.name2.lexeme == enumName) {
+ if (constant.name.lexeme == enumName) {
_errorReporter.reportErrorForToken(
CompileTimeErrorCode.ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING,
- constant.name2,
+ constant.name,
);
}
}
@@ -195,7 +195,7 @@
for (var member in node.members) {
if (member is FieldDeclaration) {
for (var field in member.fields.variables) {
- var identifier = field.name2;
+ var identifier = field.name;
_checkDuplicateIdentifier(
member.isStatic ? staticGetters : instanceGetters,
identifier,
@@ -206,7 +206,7 @@
} else if (member is MethodDeclaration) {
_checkDuplicateIdentifier(
member.isStatic ? staticGetters : instanceGetters,
- member.name2,
+ member.name,
element: member.declaredElement2!,
setterScope: member.isStatic ? staticSetters : instanceSetters,
);
@@ -218,7 +218,7 @@
if (member is FieldDeclaration) {
if (member.isStatic) {
for (var field in member.fields.variables) {
- var identifier = field.name2;
+ var identifier = field.name;
var name = identifier.lexeme;
if (instanceGetters.containsKey(name) ||
instanceSetters.containsKey(name)) {
@@ -232,7 +232,7 @@
}
} else if (member is MethodDeclaration) {
if (member.isStatic) {
- var identifier = member.name2;
+ var identifier = member.name;
var name = identifier.lexeme;
if (instanceGetters.containsKey(name) ||
instanceSetters.containsKey(name)) {
@@ -252,7 +252,7 @@
void checkForVariables(VariableDeclarationList node) {
Map<String, Element> definedNames = HashMap<String, Element>();
for (VariableDeclaration variable in node.variables) {
- _checkDuplicateIdentifier(definedNames, variable.name2,
+ _checkDuplicateIdentifier(definedNames, variable.name,
element: variable.declaredElement2!);
}
}
@@ -281,13 +281,13 @@
for (Statement statement in statements) {
if (statement is VariableDeclarationStatement) {
for (VariableDeclaration variable in statement.variables.variables) {
- _checkDuplicateIdentifier(definedNames, variable.name2,
+ _checkDuplicateIdentifier(definedNames, variable.name,
element: variable.declaredElement2!);
}
} else if (statement is FunctionDeclarationStatement) {
_checkDuplicateIdentifier(
definedNames,
- statement.functionDeclaration.name2,
+ statement.functionDeclaration.name,
element: statement.functionDeclaration.declaredElement2!,
);
}
@@ -298,7 +298,7 @@
void checkTypeParameters(TypeParameterList node) {
Map<String, Element> definedNames = HashMap<String, Element>();
for (TypeParameter parameter in node.typeParameters) {
- _checkDuplicateIdentifier(definedNames, parameter.name2,
+ _checkDuplicateIdentifier(definedNames, parameter.name,
element: parameter.declaredElement2!);
}
}
@@ -354,17 +354,17 @@
}
for (CompilationUnitMember member in node.declarations) {
if (member is ExtensionDeclaration) {
- var identifier = member.name2;
+ var identifier = member.name;
if (identifier != null) {
_checkDuplicateIdentifier(definedGetters, identifier,
element: member.declaredElement2!, setterScope: definedSetters);
}
} else if (member is NamedCompilationUnitMember) {
- _checkDuplicateIdentifier(definedGetters, member.name2,
+ _checkDuplicateIdentifier(definedGetters, member.name,
element: member.declaredElement2!, setterScope: definedSetters);
} else if (member is TopLevelVariableDeclaration) {
for (VariableDeclaration variable in member.variables.variables) {
- _checkDuplicateIdentifier(definedGetters, variable.name2,
+ _checkDuplicateIdentifier(definedGetters, variable.name,
element: variable.declaredElement2!, setterScope: definedSetters);
}
}
@@ -385,7 +385,7 @@
// [member] is erroneous; do not count it as a possible duplicate.
continue;
}
- var name = member.name2?.lexeme ?? '';
+ var name = member.name?.lexeme ?? '';
if (name == 'new') {
name = '';
}
@@ -403,7 +403,7 @@
for (VariableDeclaration field in member.fields.variables) {
_checkDuplicateIdentifier(
member.isStatic ? staticGetters : instanceGetters,
- field.name2,
+ field.name,
element: field.declaredElement2!,
setterScope: member.isStatic ? staticSetters : instanceSetters,
);
@@ -411,7 +411,7 @@
} else if (member is MethodDeclaration) {
_checkDuplicateIdentifier(
member.isStatic ? staticGetters : instanceGetters,
- member.name2,
+ member.name,
element: member.declaredElement2!,
setterScope: member.isStatic ? staticSetters : instanceSetters,
);
@@ -431,7 +431,7 @@
if (member is FieldDeclaration) {
if (member.isStatic) {
for (VariableDeclaration field in member.fields.variables) {
- final identifier = field.name2;
+ final identifier = field.name;
String name = identifier.lexeme;
if (instanceGetters.containsKey(name) ||
instanceSetters.containsKey(name)) {
@@ -445,7 +445,7 @@
}
} else if (member is MethodDeclaration) {
if (member.isStatic) {
- final identifier = member.name2;
+ final identifier = member.name;
String name = identifier.lexeme;
if (instanceGetters.containsKey(name) ||
instanceSetters.containsKey(name)) {
diff --git a/pkg/analyzer/lib/src/error/inheritance_override.dart b/pkg/analyzer/lib/src/error/inheritance_override.dart
index 183860d..27ff215 100644
--- a/pkg/analyzer/lib/src/error/inheritance_override.dart
+++ b/pkg/analyzer/lib/src/error/inheritance_override.dart
@@ -45,7 +45,7 @@
reporter: _reporter,
featureSet: unit.featureSet,
library: library,
- classNameToken: declaration.name2,
+ classNameToken: declaration.name,
classElement: declaration.declaredElement2!,
implementsClause: declaration.implementsClause,
members: declaration.members,
@@ -60,7 +60,7 @@
reporter: _reporter,
featureSet: unit.featureSet,
library: library,
- classNameToken: declaration.name2,
+ classNameToken: declaration.name,
classElement: declaration.declaredElement2!,
implementsClause: declaration.implementsClause,
superclass: declaration.superclass,
@@ -74,7 +74,7 @@
reporter: _reporter,
featureSet: unit.featureSet,
library: library,
- classNameToken: declaration.name2,
+ classNameToken: declaration.name,
classElement: declaration.declaredElement2!,
implementsClause: declaration.implementsClause,
members: declaration.members,
@@ -88,7 +88,7 @@
reporter: _reporter,
featureSet: unit.featureSet,
library: library,
- classNameToken: declaration.name2,
+ classNameToken: declaration.name,
classElement: declaration.declaredElement2!,
implementsClause: declaration.implementsClause,
members: declaration.members,
@@ -109,7 +109,7 @@
/// Returns [ExecutableElement] members that are in the interface of the
/// given class, but don't have concrete implementations.
static List<ExecutableElement> missingOverrides(ClassDeclaration node) {
- return _missingOverrides[node.name2] ?? const [];
+ return _missingOverrides[node.name] ?? const [];
}
}
@@ -216,13 +216,13 @@
var fieldList = member.fields;
for (var field in fieldList.variables) {
var fieldElement = field.declaredElement2 as FieldElement;
- _checkDeclaredMember(field.name2, libraryUri, fieldElement.getter);
- _checkDeclaredMember(field.name2, libraryUri, fieldElement.setter);
+ _checkDeclaredMember(field.name, libraryUri, fieldElement.getter);
+ _checkDeclaredMember(field.name, libraryUri, fieldElement.setter);
if (!member.isStatic && classElement is! EnumElement) {
- _checkIllegalEnumValuesDeclaration(field.name2);
+ _checkIllegalEnumValuesDeclaration(field.name);
}
if (!member.isStatic) {
- _checkIllegalConcreteEnumMemberDeclaration(field.name2);
+ _checkIllegalConcreteEnumMemberDeclaration(field.name);
}
}
} else if (member is MethodDeclaration) {
@@ -231,13 +231,13 @@
continue;
}
- _checkDeclaredMember(member.name2, libraryUri, member.declaredElement2,
+ _checkDeclaredMember(member.name, libraryUri, member.declaredElement2,
methodParameterNodes: member.parameters?.parameters);
if (!(member.isStatic || member.isAbstract || member.isSetter)) {
- _checkIllegalConcreteEnumMemberDeclaration(member.name2);
+ _checkIllegalConcreteEnumMemberDeclaration(member.name);
}
if (!member.isStatic && classElement is! EnumElement) {
- _checkIllegalEnumValuesDeclaration(member.name2);
+ _checkIllegalEnumValuesDeclaration(member.name);
}
}
}
@@ -805,15 +805,15 @@
for (var member in members) {
if (member is MethodDeclaration) {
- var displayName = member.name2.lexeme;
- var name2 = displayName;
+ var displayName = member.name.lexeme;
+ var name = displayName;
if (member.isSetter) {
- name2 += '=';
+ name += '=';
}
- if (checkMemberNameCombo(member, name2, displayName)) return true;
+ if (checkMemberNameCombo(member, name, displayName)) return true;
} else if (member is FieldDeclaration) {
for (var variableDeclaration in member.fields.variables) {
- var name = variableDeclaration.name2.lexeme;
+ var name = variableDeclaration.name.lexeme;
if (checkMemberNameCombo(member, name, name)) return true;
if (!variableDeclaration.isFinal) {
if (checkMemberNameCombo(member, '$name=', name)) return true;
@@ -935,7 +935,7 @@
TopLevelInferenceErrorKind.overrideNoCombinedSuperSignature) {
reporter.reportErrorForToken(
CompileTimeErrorCode.NO_COMBINED_SUPER_SIGNATURE,
- node.name2,
+ node.name,
[
classElement.name,
inferenceError!.arguments[0],
diff --git a/pkg/analyzer/lib/src/error/must_call_super_verifier.dart b/pkg/analyzer/lib/src/error/must_call_super_verifier.dart
index 906e5f4..2ffd972 100644
--- a/pkg/analyzer/lib/src/error/must_call_super_verifier.dart
+++ b/pkg/analyzer/lib/src/error/must_call_super_verifier.dart
@@ -144,7 +144,7 @@
// Overridable elements are always enclosed in named elements, so it is
// safe to assume [overriddenEnclosingName] is non-`null`.
_errorReporter.reportErrorForToken(
- HintCode.MUST_CALL_SUPER, node.name2, [overriddenEnclosingName!]);
+ HintCode.MUST_CALL_SUPER, node.name, [overriddenEnclosingName!]);
}
return;
}
diff --git a/pkg/analyzer/lib/src/error/override_verifier.dart b/pkg/analyzer/lib/src/error/override_verifier.dart
index 5a50cf48..6e2509d 100644
--- a/pkg/analyzer/lib/src/error/override_verifier.dart
+++ b/pkg/analyzer/lib/src/error/override_verifier.dart
@@ -56,7 +56,7 @@
_errorReporter.reportErrorForToken(
HintCode.OVERRIDE_ON_NON_OVERRIDING_FIELD,
- field.name2,
+ field.name,
);
}
}
@@ -69,18 +69,18 @@
if (element is MethodElement) {
_errorReporter.reportErrorForToken(
HintCode.OVERRIDE_ON_NON_OVERRIDING_METHOD,
- node.name2,
+ node.name,
);
} else if (element is PropertyAccessorElement) {
if (element.isGetter) {
_errorReporter.reportErrorForToken(
HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER,
- node.name2,
+ node.name,
);
} else {
_errorReporter.reportErrorForToken(
HintCode.OVERRIDE_ON_NON_OVERRIDING_SETTER,
- node.name2,
+ node.name,
);
}
}
diff --git a/pkg/analyzer/lib/src/error/required_parameters_verifier.dart b/pkg/analyzer/lib/src/error/required_parameters_verifier.dart
index bdac2d4..8dbae46 100644
--- a/pkg/analyzer/lib/src/error/required_parameters_verifier.dart
+++ b/pkg/analyzer/lib/src/error/required_parameters_verifier.dart
@@ -39,7 +39,7 @@
_check(
parameters: node.constructorElement?.parameters,
arguments: node.arguments?.argumentList.arguments ?? <Expression>[],
- errorNode: node.name2,
+ errorNode: node.name,
);
}
diff --git a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
index 0bfffc7..012f253 100644
--- a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
+++ b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
@@ -131,7 +131,7 @@
bound = substitution.substituteType(bound);
if (!_typeSystem.isSubtypeOf(typeArgument, bound)) {
- final errorTarget = typeArgumentNodes?[i] ?? node.name2;
+ final errorTarget = typeArgumentNodes?[i] ?? node.name;
_errorReporter.reportErrorForOffset(
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
errorTarget.offset,
diff --git a/pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart b/pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart
index 6a153f8..22291ed 100644
--- a/pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart
+++ b/pkg/analyzer/lib/src/error/unused_local_elements_verifier.dart
@@ -470,7 +470,7 @@
@override
void visitConstructorDeclaration(ConstructorDeclaration node) {
- if (node.name2 != null) {
+ if (node.name != null) {
final declaredElement = node.declaredElement2!;
_visitConstructorElement(declaredElement);
}
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 4811afe..5bb878a 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -382,7 +382,7 @@
var typeParameter = TypeParameterImpl(
comment: comment,
metadata: metadata,
- name2: name.token,
+ name: name.token,
extendsKeyword: null,
bound: null,
);
@@ -911,7 +911,7 @@
factoryKeyword: null,
returnType: ast.simpleIdentifier(prefixOrName.token),
period: period,
- name2: nameOrNull?.token,
+ name: nameOrNull?.token,
parameters: parameters,
separator: separator,
initializers: initializers,
@@ -1002,7 +1002,7 @@
factoryKeyword: factoryKeyword,
returnType: ast.simpleIdentifier(returnType.token),
period: period,
- name2: name?.token,
+ name: name?.token,
parameters: parameters,
separator: separator,
initializers: null,
@@ -1142,7 +1142,7 @@
returnType: returnType,
propertyKeyword: getOrSet,
operatorKeyword: operatorKeyword,
- name2: nameId.token,
+ name: nameId.token,
typeParameters: typeParameters,
parameters: parameters,
body: body,
@@ -1476,7 +1476,7 @@
returnType: null,
propertyKeyword: null,
operatorKeyword: null,
- name2: methodName.token,
+ name: methodName.token,
typeParameters: typeParameters,
parameters: parameters,
body: body,
@@ -1532,7 +1532,7 @@
var name = pop() as SimpleIdentifierImpl;
push(
VariableDeclarationImpl(
- name2: name.token,
+ name: name.token,
equals: equals,
initializer: initializer,
),
@@ -2044,7 +2044,7 @@
variable = node;
} else if (node is SimpleIdentifierImpl) {
variable = VariableDeclarationImpl(
- name2: node.token,
+ name: node.token,
equals: null,
initializer: null,
);
@@ -2236,7 +2236,7 @@
externalKeyword: null,
returnType: returnType,
propertyKeyword: null,
- name2: name.token,
+ name: name.token,
functionExpression: functionExpression,
);
push(
@@ -2406,7 +2406,7 @@
comment: comment,
metadata: metadata,
typedefKeyword: classKeyword,
- name2: name.token,
+ name: name.token,
typeParameters: typeParameters,
equals: equalsToken,
abstractKeyword: abstractKeyword,
@@ -2864,7 +2864,7 @@
externalKeyword: externalKeyword,
returnType: returnType,
propertyKeyword: getOrSet,
- name2: name.token,
+ name: name.token,
functionExpression: FunctionExpressionImpl(
typeParameters: typeParameters,
parameters: parameters,
@@ -2918,7 +2918,7 @@
metadata: metadata,
typedefKeyword: typedefKeyword,
returnType: returnType,
- name2: name.token,
+ name: name.token,
typeParameters: typeParameters,
parameters: parameters,
semicolon: semicolon,
@@ -2941,7 +2941,7 @@
comment: comment,
metadata: metadata,
typedefKeyword: typedefKeyword,
- name2: name.token,
+ name: name.token,
typeParameters: templateParameters,
equals: equals,
type: type,
@@ -3007,7 +3007,7 @@
// TODO(ahe): Don't push initializers, instead install them.
push(
VariableDeclarationImpl(
- name2: identifier.token,
+ name: identifier.token,
equals: equals,
initializer: initializer,
),
@@ -3454,7 +3454,7 @@
constant = EnumConstantDeclarationImpl(
comment: constant.documentationComment,
metadata: constant.metadata,
- name2: constant.name2,
+ name: constant.name,
arguments: EnumConstantArgumentsImpl(
typeArguments: typeArguments,
constructorSelector: constructorSelector,
@@ -3671,7 +3671,7 @@
metadata: variableList.metadata,
keyword: variableList.keyword,
type: variableList.type as TypeAnnotationImpl?,
- name: variableList.variables.first.name2,
+ name: variableList.variables.first.name,
),
inKeyword: inKeyword,
iterable: iterable,
@@ -3774,7 +3774,7 @@
EnumConstantDeclarationImpl(
comment: comment,
metadata: metadata,
- name2: token,
+ name: token,
arguments: null,
),
);
@@ -4198,7 +4198,7 @@
var name = pop() as SimpleIdentifierImpl;
push(
VariableDeclarationImpl(
- name2: name.token,
+ name: name.token,
equals: null,
initializer: null,
),
@@ -4879,7 +4879,7 @@
macroKeyword: macroKeyword,
augmentKeyword: augmentKeyword,
classKeyword: classKeyword,
- name2: name,
+ name: name,
typeParameters: typeParameters,
extendsClause: extendsClause,
withClause: withClause,
@@ -4943,7 +4943,7 @@
comment: comment,
metadata: metadata,
enumKeyword: enumKeyword,
- name2: name,
+ name: name,
typeParameters: typeParameters,
withClause: withClause,
implementsClause: implementsClause,
@@ -4982,7 +4982,7 @@
metadata: metadata,
extensionKeyword: extensionKeyword,
typeKeyword: typeKeyword,
- name2: name,
+ name: name,
typeParameters: typeParameters,
onKeyword: onKeyword,
extendedType: extendedType,
@@ -5021,7 +5021,7 @@
metadata: metadata,
augmentKeyword: augmentKeyword,
mixinKeyword: mixinKeyword,
- name2: name,
+ name: name,
typeParameters: typeParameters,
onClause: onClause,
implementsClause: implementsClause,
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 0d91c2b..b0041f0 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -428,7 +428,7 @@
_duplicateDefinitionVerifier.checkClass(node);
if (!element.isDartCoreFunctionImpl) {
_checkForBuiltInIdentifierAsName(
- node.name2, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
+ node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
}
_checkForConflictingClassTypeVariableErrorCodes();
var superclass = node.extendsClause?.superclass;
@@ -447,7 +447,7 @@
_checkForFinalNotInitializedInClass(members);
_checkForBadFunctionUse(node);
_checkForWrongTypeParameterVarianceInSuperinterfaces();
- _checkForMainFunction1(node.name2, node.declaredElement2!);
+ _checkForMainFunction1(node.name, node.declaredElement2!);
_reportMacroApplicationErrors(
annotations: node.metadata,
macroErrors: element.macroApplicationErrors,
@@ -469,13 +469,13 @@
@override
void visitClassTypeAlias(ClassTypeAlias node) {
_checkForBuiltInIdentifierAsName(
- node.name2, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
+ node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
var outerClassElement = _enclosingClass;
try {
_enclosingClass = node.declaredElement2 as ClassElementImpl;
_checkClassInheritance(
node, node.superclass, node.withClause, node.implementsClause);
- _checkForMainFunction1(node.name2, node.declaredElement2!);
+ _checkForMainFunction1(node.name, node.declaredElement2!);
_checkForWrongTypeParameterVarianceInSuperinterfaces();
} finally {
_enclosingClass = outerClassElement;
@@ -600,7 +600,7 @@
_duplicateDefinitionVerifier.checkEnum(node);
_checkForBuiltInIdentifierAsName(
- node.name2, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
+ node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
_checkForConflictingEnumTypeVariableErrorCodes(element);
var implementsClause = node.implementsClause;
var withClause = node.withClause;
@@ -612,7 +612,7 @@
_constructorFieldsVerifier.enterEnum(node, element);
_checkForFinalNotInitializedInClass(node.members);
_checkForWrongTypeParameterVarianceInSuperinterfaces();
- _checkForMainFunction1(node.name2, node.declaredElement2!);
+ _checkForMainFunction1(node.name, node.declaredElement2!);
_checkForEnumInstantiatedToBoundsIsNotWellBounded(node, element);
GetterSetterTypesVerifier(
@@ -663,7 +663,7 @@
errorReporter: errorReporter,
).checkExtension(element);
- final name = node.name2;
+ final name = node.name;
if (name != null) {
_checkForBuiltInIdentifierAsName(
name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME);
@@ -763,13 +763,13 @@
if (node.isSetter) {
FunctionExpression functionExpression = node.functionExpression;
_checkForWrongNumberOfParametersForSetter(
- node.name2, functionExpression.parameters);
+ node.name, functionExpression.parameters);
_checkForNonVoidReturnTypeForSetter(returnType);
}
_checkForTypeAnnotationDeferredClass(returnType);
_returnTypeVerifier.verifyReturnType(returnType);
- _checkForImplicitDynamicReturn(node.name2, node.declaredElement2!);
- _checkForMainFunction1(node.name2, node.declaredElement2!);
+ _checkForImplicitDynamicReturn(node.name, node.declaredElement2!);
+ _checkForMainFunction1(node.name, node.declaredElement2!);
_checkForMainFunction2(node);
super.visitFunctionDeclaration(node);
});
@@ -815,10 +815,10 @@
@override
void visitFunctionTypeAlias(FunctionTypeAlias node) {
_checkForBuiltInIdentifierAsName(
- node.name2, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
- _checkForMainFunction1(node.name2, node.declaredElement2!);
+ node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
+ _checkForMainFunction1(node.name, node.declaredElement2!);
_checkForTypeAliasCannotReferenceItself(
- node.name2, node.declaredElement2 as TypeAliasElementImpl);
+ node.name, node.declaredElement2 as TypeAliasElementImpl);
super.visitFunctionTypeAlias(node);
}
@@ -852,10 +852,10 @@
@override
void visitGenericTypeAlias(GenericTypeAlias node) {
_checkForBuiltInIdentifierAsName(
- node.name2, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
- _checkForMainFunction1(node.name2, node.declaredElement2!);
+ node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
+ _checkForMainFunction1(node.name, node.declaredElement2!);
_checkForTypeAliasCannotReferenceItself(
- node.name2, node.declaredElement2 as TypeAliasElementImpl);
+ node.name, node.declaredElement2 as TypeAliasElementImpl);
super.visitGenericTypeAlias(node);
}
@@ -949,7 +949,7 @@
_withEnclosingExecutable(node.declaredElement2!, () {
var returnType = node.returnType;
if (node.isSetter) {
- _checkForWrongNumberOfParametersForSetter(node.name2, node.parameters);
+ _checkForWrongNumberOfParametersForSetter(node.name, node.parameters);
_checkForNonVoidReturnTypeForSetter(returnType);
} else if (node.isOperator) {
var hasWrongNumberOfParameters =
@@ -964,7 +964,7 @@
_checkForExtensionDeclaresMemberOfObject(node);
_checkForTypeAnnotationDeferredClass(returnType);
_returnTypeVerifier.verifyReturnType(returnType);
- _checkForImplicitDynamicReturn(node.name2, node.declaredElement2!);
+ _checkForImplicitDynamicReturn(node.name, node.declaredElement2!);
_checkForWrongTypeParameterVarianceInMethod(node);
super.visitMethodDeclaration(node);
});
@@ -999,7 +999,7 @@
List<ClassMember> members = node.members;
_duplicateDefinitionVerifier.checkMixin(node);
_checkForBuiltInIdentifierAsName(
- node.name2, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
+ node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
_checkForConflictingClassTypeVariableErrorCodes();
var onClause = node.onClause;
@@ -1012,7 +1012,7 @@
_checkForConflictingClassMembers();
_checkForFinalNotInitializedInClass(members);
- _checkForMainFunction1(node.name2, node.declaredElement2!);
+ _checkForMainFunction1(node.name, node.declaredElement2!);
_checkForWrongTypeParameterVarianceInSuperinterfaces();
// _checkForBadFunctionUse(node);
super.visitMixinDeclaration(node);
@@ -1273,7 +1273,7 @@
_checkForNotInitializedNonNullableVariable(node.variables, true);
for (var variable in node.variables.variables) {
- _checkForMainFunction1(variable.name2, variable.declaredElement2!);
+ _checkForMainFunction1(variable.name, variable.declaredElement2!);
}
super.visitTopLevelVariableDeclaration(node);
@@ -1290,7 +1290,7 @@
@override
void visitTypeParameter(TypeParameter node) {
- _checkForBuiltInIdentifierAsName(node.name2,
+ _checkForBuiltInIdentifierAsName(node.name,
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME);
_checkForTypeAnnotationDeferredClass(node.bound);
_checkForImplicitDynamicType(node.bound);
@@ -1308,7 +1308,7 @@
@override
void visitVariableDeclaration(VariableDeclaration node) {
- final nameToken = node.name2;
+ final nameToken = node.name;
var initializerNode = node.initializer;
// do checks
_checkForImplicitDynamicIdentifier(node, nameToken,
@@ -1423,16 +1423,16 @@
if (declaredElement is FieldElement) {
if (declaredElement.isAbstract) {
errorReporter.reportErrorForToken(
- CompileTimeErrorCode.ABSTRACT_FIELD_INITIALIZER, node.name2);
+ CompileTimeErrorCode.ABSTRACT_FIELD_INITIALIZER, node.name);
}
if (declaredElement.isExternal) {
errorReporter.reportErrorForToken(
- CompileTimeErrorCode.EXTERNAL_FIELD_INITIALIZER, node.name2);
+ CompileTimeErrorCode.EXTERNAL_FIELD_INITIALIZER, node.name);
}
} else if (declaredElement is TopLevelVariableElement) {
if (declaredElement.isExternal) {
errorReporter.reportErrorForToken(
- CompileTimeErrorCode.EXTERNAL_VARIABLE_INITIALIZER, node.name2);
+ CompileTimeErrorCode.EXTERNAL_VARIABLE_INITIALIZER, node.name);
}
}
}
@@ -1934,7 +1934,7 @@
if (error is IncompatibleInterfacesClassHierarchyError) {
errorReporter.reportErrorForToken(
CompileTimeErrorCode.CONFLICTING_GENERIC_INTERFACES,
- node.name2,
+ node.name,
[
_enclosingClass!.name,
error.first.getDisplayString(withNullability: true),
@@ -2497,7 +2497,7 @@
if (isWellBounded is NotWellBoundedTypeResult) {
errorReporter.reportErrorForToken(
CompileTimeErrorCode.ENUM_INSTANTIATED_TO_BOUNDS_IS_NOT_WELL_BOUNDED,
- node.name2,
+ node.name,
);
}
}
@@ -2640,7 +2640,7 @@
void _checkForExtensionDeclaresMemberOfObject(MethodDeclaration node) {
if (_enclosingExtension == null) return;
- var name = node.name2.lexeme;
+ var name = node.name.lexeme;
if (name == '==' ||
name == 'hashCode' ||
name == 'toString' ||
@@ -2648,7 +2648,7 @@
name == FunctionElement.NO_SUCH_METHOD_METHOD_NAME) {
errorReporter.reportErrorForToken(
CompileTimeErrorCode.EXTENSION_DECLARES_MEMBER_OF_OBJECT,
- node.name2,
+ node.name,
);
}
}
@@ -2717,8 +2717,8 @@
if (isConst) {
errorReporter.reportErrorForToken(
CompileTimeErrorCode.CONST_NOT_INITIALIZED,
- variable.name2,
- [variable.name2.lexeme]);
+ variable.name,
+ [variable.name.lexeme]);
} else {
var variableElement = variable.declaredElement2;
if (variableElement is FieldElement &&
@@ -2730,8 +2730,8 @@
} else if (!_isNonNullableByDefault || !variable.isLate) {
errorReporter.reportErrorForToken(
CompileTimeErrorCode.FINAL_NOT_INITIALIZED,
- variable.name2,
- [variable.name2.lexeme]);
+ variable.name,
+ [variable.name.lexeme]);
}
}
}
@@ -3215,7 +3215,7 @@
return;
}
- if (functionDeclaration.name2.lexeme != 'main') {
+ if (functionDeclaration.name.lexeme != 'main') {
return;
}
@@ -3236,14 +3236,14 @@
if (requiredPositional.length > 2) {
errorReporter.reportErrorForToken(
CompileTimeErrorCode.MAIN_HAS_TOO_MANY_REQUIRED_POSITIONAL_PARAMETERS,
- functionDeclaration.name2,
+ functionDeclaration.name,
);
}
if (parameters.any((e) => e.isRequiredNamed)) {
errorReporter.reportErrorForToken(
CompileTimeErrorCode.MAIN_HAS_REQUIRED_NAMED_PARAMETERS,
- functionDeclaration.name2,
+ functionDeclaration.name,
);
}
@@ -3646,7 +3646,7 @@
if (superUnnamedConstructor.isFactory) {
errorReporter.reportErrorForToken(
CompileTimeErrorCode.NON_GENERATIVE_IMPLICIT_CONSTRUCTOR,
- declaration.name2, [
+ declaration.name, [
superElement.name,
_enclosingClass!.name,
superUnnamedConstructor
@@ -3663,7 +3663,7 @@
// real problem was already reported.
errorReporter.reportErrorForToken(
CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT,
- declaration.name2,
+ declaration.name,
[superType, _enclosingClass!.displayName]);
}
}
@@ -3751,7 +3751,7 @@
errorReporter.reportErrorForToken(
CompileTimeErrorCode.NON_FINAL_FIELD_IN_ENUM,
- variableList.variables.first.name2,
+ variableList.variables.first.name,
);
}
@@ -3761,7 +3761,7 @@
/// See [CompileTimeErrorCode.NON_VOID_RETURN_FOR_OPERATOR].
void _checkForNonVoidReturnTypeForOperator(MethodDeclaration declaration) {
// check that []= operator
- if (declaration.name2.lexeme != "[]=") {
+ if (declaration.name.lexeme != "[]=") {
return;
}
// check return type
@@ -3814,7 +3814,7 @@
errorReporter.reportErrorForNode(
CompileTimeErrorCode.NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD,
field,
- [field.name2.lexeme],
+ [field.name.lexeme],
);
}
}
@@ -3867,8 +3867,8 @@
if (variable.initializer == null) {
errorReporter.reportErrorForToken(
CompileTimeErrorCode.NOT_INITIALIZED_NON_NULLABLE_VARIABLE,
- variable.name2,
- [variable.name2.lexeme],
+ variable.name,
+ [variable.name.lexeme],
);
}
}
@@ -4069,8 +4069,8 @@
!redirectedElement.isFactory) {
String enclosingNamedType = _enclosingClass!.displayName;
String constructorStrName = enclosingNamedType;
- if (declaration.name2 != null) {
- constructorStrName += ".${declaration.name2!.lexeme}";
+ if (declaration.name != null) {
+ constructorStrName += ".${declaration.name!.lexeme}";
}
errorReporter.reportErrorForNode(
CompileTimeErrorCode.REDIRECT_TO_ABSTRACT_CLASS_CONSTRUCTOR,
@@ -4316,7 +4316,7 @@
// assume `element.bound` is non-`null`.
errorReporter.reportErrorForToken(
CompileTimeErrorCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND,
- parameter.name2,
+ parameter.name,
[element.displayName, element.bound!],
);
break;
@@ -4421,7 +4421,7 @@
void reportError(ErrorCode errorCode, List<Object> arguments) {
Identifier returnType = constructor.returnType;
- var name = constructor.name2;
+ var name = constructor.name;
int offset = returnType.offset;
int length = (name != null ? name.end : returnType.end) - offset;
errorReporter.reportErrorForOffset(errorCode, offset, length, arguments);
@@ -4673,7 +4673,7 @@
}
int numParameters = parameterList.parameters.length;
// prepare operator name
- final nameToken = declaration.name2;
+ final nameToken = declaration.name;
final name = nameToken.lexeme;
// check for exact number of parameters
int expected = -1;
@@ -4746,7 +4746,7 @@
if (!(typeParameter as TypeParameterElementImpl).isLegacyCovariant) {
var fields = node.fields;
var fieldElement = fields.variables.first.declaredElement2!;
- var fieldName = fields.variables.first.name2;
+ var fieldName = fields.variables.first.name;
Variance fieldVariance = Variance(typeParameter, fieldElement.type);
_checkForWrongVariancePosition(
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
index 070190c..e956e3c 100644
--- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -87,8 +87,8 @@
inCompound = true;
compound = node;
if (node.declaredElement2!.isEmptyStruct) {
- _errorReporter.reportErrorForToken(FfiCode.EMPTY_STRUCT, node.name2,
- [node.name2.lexeme, className]);
+ _errorReporter.reportErrorForToken(
+ FfiCode.EMPTY_STRUCT, node.name, [node.name.lexeme, className]);
}
if (className == _structClassName) {
_validatePackedAnnotation(node.metadata);
@@ -96,21 +96,21 @@
} else if (className == _abiSpecificIntegerClassName) {
_validateAbiSpecificIntegerAnnotation(node);
_validateAbiSpecificIntegerMappingAnnotation(
- node.name2, node.metadata);
+ node.name, node.metadata);
} else if (className != _allocatorClassName &&
className != _opaqueClassName &&
className != _abiSpecificIntegerClassName) {
_errorReporter.reportErrorForNode(
FfiCode.SUBTYPE_OF_FFI_CLASS_IN_EXTENDS,
superclass.name,
- [node.name2.lexeme, superclass.name.name]);
+ [node.name.lexeme, superclass.name.name]);
}
} else if (superclass.isCompoundSubtype ||
superclass.isAbiSpecificIntegerSubtype) {
_errorReporter.reportErrorForNode(
FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS,
superclass,
- [node.name2.lexeme, superclass.name.name]);
+ [node.name.lexeme, superclass.name.name]);
}
}
@@ -124,11 +124,11 @@
}
if (typename.ffiClass != null) {
_errorReporter.reportErrorForNode(subtypeOfFfiCode, typename,
- [node.name2.lexeme, typename.name.toSource()]);
+ [node.name.lexeme, typename.name.toSource()]);
} else if (typename.isCompoundSubtype ||
typename.isAbiSpecificIntegerSubtype) {
_errorReporter.reportErrorForNode(subtypeOfStructCode, typename,
- [node.name2.lexeme, typename.name.toSource()]);
+ [node.name.lexeme, typename.name.toSource()]);
}
}
@@ -150,7 +150,7 @@
if (inCompound) {
if (node.declaredElement2!.typeParameters.isNotEmpty) {
_errorReporter.reportErrorForToken(
- FfiCode.GENERIC_STRUCT_SUBCLASS, node.name2, [node.name2.lexeme]);
+ FfiCode.GENERIC_STRUCT_SUBCLASS, node.name, [node.name.lexeme]);
}
final implementsClause = node.implementsClause;
if (implementsClause != null) {
@@ -162,8 +162,8 @@
if (typeSystem.isSubtypeOf(compoundType, finalizableType)) {
_errorReporter.reportErrorForToken(
FfiCode.COMPOUND_IMPLEMENTS_FINALIZABLE,
- node.name2,
- [node.name2.lexeme]);
+ node.name,
+ [node.name.lexeme]);
}
}
}
@@ -634,7 +634,7 @@
node.members.single is! ConstructorDeclaration ||
(node.members.single as ConstructorDeclaration).constKeyword == null) {
_errorReporter.reportErrorForToken(
- FfiCode.ABI_SPECIFIC_INTEGER_INVALID, node.name2);
+ FfiCode.ABI_SPECIFIC_INTEGER_INVALID, node.name);
}
}
@@ -973,7 +973,7 @@
if (node.externalKeyword == null) {
_errorReporter.reportErrorForToken(
FfiCode.FIELD_MUST_BE_EXTERNAL_IN_STRUCT,
- fields.variables[0].name2,
+ fields.variables[0].name,
);
}
}
@@ -981,7 +981,7 @@
var fieldType = fields.type;
if (fieldType == null) {
_errorReporter.reportErrorForToken(
- FfiCode.MISSING_FIELD_TYPE_IN_STRUCT, fields.variables[0].name2);
+ FfiCode.MISSING_FIELD_TYPE_IN_STRUCT, fields.variables[0].name);
} else {
DartType declaredType = fieldType.typeOrThrow;
if (declaredType.isDartCoreInt) {
@@ -1026,7 +1026,7 @@
if (field.initializer != null) {
_errorReporter.reportErrorForToken(
FfiCode.FIELD_IN_STRUCT_WITH_INITIALIZER,
- field.name2,
+ field.name,
);
}
}
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 16b3a56..bff234d 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -1718,7 +1718,7 @@
node.constructorElement = constructorElement;
if (!constructorElement.isConst && constructorElement.isFactory) {
final errorTarget =
- node.arguments?.constructorSelector?.name ?? node.name2;
+ node.arguments?.constructorSelector?.name ?? node.name;
errorReporter.reportErrorForOffset(
CompileTimeErrorCode.ENUM_CONSTANT_WITH_NON_CONST_CONSTRUCTOR,
errorTarget.offset,
@@ -1738,7 +1738,7 @@
} else {
errorReporter.reportErrorForToken(
CompileTimeErrorCode.UNDEFINED_ENUM_CONSTRUCTOR_UNNAMED,
- node.name2,
+ node.name,
);
}
}
@@ -1771,7 +1771,7 @@
if (requiredParameterCount != 0) {
errorReporter.reportErrorForToken(
CompileTimeErrorCode.NOT_ENOUGH_POSITIONAL_ARGUMENTS,
- node.name2,
+ node.name,
[requiredParameterCount, 0],
);
}
@@ -1962,7 +1962,7 @@
if (!node.isSetter) {
checkForBodyMayCompleteNormally(
body: node.functionExpression.body,
- errorNode: node.name2,
+ errorNode: node.name,
);
}
flowAnalysis.executableDeclaration_exit(
@@ -2277,7 +2277,7 @@
if (!node.isSetter) {
checkForBodyMayCompleteNormally(
body: node.body,
- errorNode: node.name2,
+ errorNode: node.name,
);
}
flowAnalysis.executableDeclaration_exit(node.body, false);
@@ -2891,7 +2891,7 @@
if (error.kind == TopLevelInferenceErrorKind.dependencyCycle) {
var argumentsText = error.arguments.join(', ');
errorReporter.reportErrorForToken(CompileTimeErrorCode.TOP_LEVEL_CYCLE,
- node.name2, [node.name2.lexeme, argumentsText]);
+ node.name, [node.name.lexeme, argumentsText]);
}
}
diff --git a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
index 0e1363d..94964b0 100644
--- a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
@@ -77,8 +77,7 @@
augmentKeyword:
isAugmentation ? TokenFactory.tokenFromString('augment') : null,
classKeyword: TokenFactory.tokenFromKeyword(Keyword.CLASS),
- name2:
- TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, name),
+ name: TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, name),
typeParameters: typeParameters as TypeParameterListImpl?,
extendsClause: extendsClause as ExtendsClauseImpl?,
withClause: withClause as WithClauseImpl?,
@@ -157,7 +156,7 @@
returnType: returnType as IdentifierImpl,
period:
name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD),
- name2: name == null ? null : identifier3(name).token,
+ name: name == null ? null : identifier3(name).token,
parameters: parameters as FormalParameterListImpl,
separator: initializers.isEmpty
? null
@@ -206,7 +205,7 @@
typeKeyword: isExtensionTypeDeclaration
? TokenFactory.tokenFromString('type')
: null,
- name2: identifier3(name).token,
+ name: identifier3(name).token,
typeParameters: typeParameters as TypeParameterListImpl?,
onKeyword: TokenFactory.tokenFromKeyword(Keyword.ON),
extendedType: extendedType as TypeAnnotationImpl,
@@ -455,7 +454,7 @@
property == null ? null : TokenFactory.tokenFromKeyword(property),
operatorKeyword:
operator == null ? null : TokenFactory.tokenFromKeyword(operator),
- name2: name.token,
+ name: name.token,
typeParameters: null,
parameters: parameters as FormalParameterListImpl?,
body: EmptyFunctionBodyImpl(
@@ -757,7 +756,7 @@
static TypeParameterImpl typeParameter(String name) => TypeParameterImpl(
comment: null,
metadata: null,
- name2: identifier3(name).token,
+ name: identifier3(name).token,
extendsKeyword: null,
bound: null,
);
@@ -768,7 +767,7 @@
TypeParameterImpl(
comment: null,
metadata: null,
- name2: identifier3(name).token,
+ name: identifier3(name).token,
extendsKeyword: null,
bound: null,
varianceKeyword: TokenFactory.tokenFromString(varianceLexeme),
@@ -795,7 +794,7 @@
static VariableDeclarationImpl variableDeclaration(String name) =>
VariableDeclarationImpl(
- name2: identifier3(name).token,
+ name: identifier3(name).token,
equals: null,
initializer: null,
);
@@ -803,7 +802,7 @@
static VariableDeclarationImpl variableDeclaration2(
String name, Expression initializer) =>
VariableDeclarationImpl(
- name2: identifier3(name).token,
+ name: identifier3(name).token,
equals: TokenFactory.tokenFromType(TokenType.EQ),
initializer: initializer as ExpressionImpl,
);
diff --git a/pkg/analyzer/lib/src/hint/sdk_constraint_verifier.dart b/pkg/analyzer/lib/src/hint/sdk_constraint_verifier.dart
index bb90940..9ccbffa 100644
--- a/pkg/analyzer/lib/src/hint/sdk_constraint_verifier.dart
+++ b/pkg/analyzer/lib/src/hint/sdk_constraint_verifier.dart
@@ -225,9 +225,9 @@
@override
void visitMethodDeclaration(MethodDeclaration node) {
- if (checkTripleShift && node.isOperator && node.name2.lexeme == '>>>') {
+ if (checkTripleShift && node.isOperator && node.name.lexeme == '>>>') {
_errorReporter.reportErrorForToken(
- HintCode.SDK_VERSION_GT_GT_GT_OPERATOR, node.name2);
+ HintCode.SDK_VERSION_GT_GT_GT_OPERATOR, node.name);
}
super.visitMethodDeclaration(node);
}
diff --git a/pkg/analyzer/lib/src/services/available_declarations.dart b/pkg/analyzer/lib/src/services/available_declarations.dart
index b146553..382747d 100644
--- a/pkg/analyzer/lib/src/services/available_declarations.dart
+++ b/pkg/analyzer/lib/src/services/available_declarations.dart
@@ -1472,7 +1472,7 @@
var defaultArguments = _computeDefaultArguments(parameters);
var isConst = classMember.constKeyword != null;
- var constructorName = classMember.name2;
+ var constructorName = classMember.name;
constructorName ??= StringToken(
TokenType.IDENTIFIER,
'',
@@ -1513,7 +1513,7 @@
isFinal: isFinal,
isStatic: isStatic,
kind: DeclarationKind.FIELD,
- name: field.name2,
+ name: field.name,
parent: parent,
relevanceTags: [
'ElementKind.FIELD',
@@ -1531,7 +1531,7 @@
isDeprecated: isDeprecated,
isStatic: isStatic,
kind: DeclarationKind.GETTER,
- name: classMember.name2,
+ name: classMember.name,
parent: parent,
relevanceTags: ['ElementKind.FIELD'],
returnType: _getTypeAnnotationString(classMember.returnType),
@@ -1541,7 +1541,7 @@
isDeprecated: isDeprecated,
isStatic: isStatic,
kind: DeclarationKind.SETTER,
- name: classMember.name2,
+ name: classMember.name,
parameters: parameters.toSource(),
parameterNames: _getFormalParameterNames(parameters),
parameterTypes: _getFormalParameterTypes(parameters),
@@ -1558,7 +1558,7 @@
isDeprecated: isDeprecated,
isStatic: isStatic,
kind: DeclarationKind.METHOD,
- name: classMember.name2,
+ name: classMember.name,
parameters: parameters.toSource(),
parameterNames: _getFormalParameterNames(parameters),
parameterTypes: _getFormalParameterTypes(parameters),
@@ -1579,7 +1579,7 @@
isAbstract: node.abstractKeyword != null,
isDeprecated: isDeprecated,
kind: DeclarationKind.CLASS,
- name: node.name2,
+ name: node.name,
relevanceTags: ['ElementKind.CLASS'],
);
if (classDeclaration == null) continue;
@@ -1614,7 +1614,7 @@
parent: classDeclaration,
relevanceTagsInFile: ['ElementKind.CONSTRUCTOR'],
requiredParameterCount: 0,
- returnType: node.name2.lexeme,
+ returnType: node.name.lexeme,
typeParameters: null,
));
}
@@ -1622,14 +1622,14 @@
addDeclaration(
isDeprecated: isDeprecated,
kind: DeclarationKind.CLASS_TYPE_ALIAS,
- name: node.name2,
+ name: node.name,
relevanceTags: ['ElementKind.CLASS'],
);
} else if (node is EnumDeclaration) {
var enumDeclaration = addDeclaration(
isDeprecated: isDeprecated,
kind: DeclarationKind.ENUM,
- name: node.name2,
+ name: node.name,
relevanceTags: ['ElementKind.ENUM'],
);
if (enumDeclaration == null) continue;
@@ -1640,7 +1640,7 @@
addDeclaration(
isDeprecated: isDeprecated,
kind: DeclarationKind.ENUM_CONSTANT,
- name: constant.name2,
+ name: constant.name,
parent: enumDeclaration,
relevanceTags: [
'ElementKind.ENUM_CONSTANT',
@@ -1649,7 +1649,7 @@
);
}
} else if (node is ExtensionDeclaration) {
- var name = node.name2;
+ var name = node.name;
if (name != null) {
addDeclaration(
isDeprecated: isDeprecated,
@@ -1667,7 +1667,7 @@
addDeclaration(
isDeprecated: isDeprecated,
kind: DeclarationKind.GETTER,
- name: node.name2,
+ name: node.name,
relevanceTags: ['ElementKind.FUNCTION'],
returnType: _getTypeAnnotationString(node.returnType),
);
@@ -1675,7 +1675,7 @@
addDeclaration(
isDeprecated: isDeprecated,
kind: DeclarationKind.SETTER,
- name: node.name2,
+ name: node.name,
parameters: parameters.toSource(),
parameterNames: _getFormalParameterNames(parameters),
parameterTypes: _getFormalParameterTypes(parameters),
@@ -1690,7 +1690,7 @@
defaultArgumentListTextRanges: defaultArguments?.ranges,
isDeprecated: isDeprecated,
kind: DeclarationKind.FUNCTION,
- name: node.name2,
+ name: node.name,
parameters: parameters.toSource(),
parameterNames: _getFormalParameterNames(parameters),
parameterTypes: _getFormalParameterTypes(parameters),
@@ -1709,7 +1709,7 @@
addDeclaration(
isDeprecated: isDeprecated,
kind: DeclarationKind.FUNCTION_TYPE_ALIAS,
- name: node.name2,
+ name: node.name,
parameters: parameters.toSource(),
parameterNames: _getFormalParameterNames(parameters),
parameterTypes: _getFormalParameterTypes(parameters),
@@ -1723,7 +1723,7 @@
addDeclaration(
isDeprecated: isDeprecated,
kind: DeclarationKind.TYPE_ALIAS,
- name: node.name2,
+ name: node.name,
relevanceTags: ['ElementKind.TYPE_ALIAS'],
);
}
@@ -1732,7 +1732,7 @@
addDeclaration(
isDeprecated: isDeprecated,
kind: DeclarationKind.FUNCTION_TYPE_ALIAS,
- name: node.name2,
+ name: node.name,
parameters: parameters.toSource(),
parameterNames: _getFormalParameterNames(parameters),
parameterTypes: _getFormalParameterTypes(parameters),
@@ -1745,7 +1745,7 @@
var mixinDeclaration = addDeclaration(
isDeprecated: isDeprecated,
kind: DeclarationKind.MIXIN,
- name: node.name2,
+ name: node.name,
relevanceTags: ['ElementKind.MIXIN'],
);
if (mixinDeclaration == null) continue;
@@ -1760,7 +1760,7 @@
isDeprecated: isDeprecated,
isFinal: isFinal,
kind: DeclarationKind.VARIABLE,
- name: variable.name2,
+ name: variable.name,
relevanceTags: [
'ElementKind.TOP_LEVEL_VARIABLE',
if (isConst) 'ElementKind.TOP_LEVEL_VARIABLE+const',
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
index 0b86ee8..65b8ce1 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
@@ -1206,7 +1206,7 @@
var node = TypeParameterImpl(
comment: null,
metadata: metadata,
- name2: name,
+ name: name,
extendsKeyword: bound != null ? Tokens.extends_() : null,
bound: bound,
);
@@ -1233,7 +1233,7 @@
var initializer = _readOptionalNode() as ExpressionImpl?;
var node = VariableDeclarationImpl(
- name2: name,
+ name: name,
equals: Tokens.eq(),
initializer: initializer,
);
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
index 69cc493..1fc605e 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
@@ -776,7 +776,7 @@
@override
void visitTypeParameter(TypeParameter node) {
_writeByte(Tag.TypeParameter);
- _writeDeclarationName(node.name2);
+ _writeDeclarationName(node.name);
_writeOptionalNode(node.bound);
_storeDeclaration(node);
}
diff --git a/pkg/analyzer/lib/src/summary2/ast_text_printer.dart b/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
index c1c63e0..0f1feb5 100644
--- a/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
@@ -152,7 +152,7 @@
_token(node.abstractKeyword);
_token(node.macroKeyword);
_token(node.classKeyword);
- _token(node.name2);
+ _token(node.name);
node.typeParameters?.accept(this);
node.extendsClause?.accept(this);
node.withClause?.accept(this);
@@ -169,7 +169,7 @@
_token(node.abstractKeyword);
_token(node.macroKeyword);
_token(node.typedefKeyword);
- _token(node.name2);
+ _token(node.name);
node.typeParameters?.accept(this);
_token(node.equals);
node.superclass.accept(this);
@@ -217,7 +217,7 @@
_token(node.factoryKeyword);
node.returnType.accept(this);
_token(node.period);
- _token(node.name2);
+ _token(node.name);
node.parameters.accept(this);
_token(node.separator);
_nodeList(node.initializers, node.body.beginToken);
@@ -316,7 +316,7 @@
@override
void visitEnumConstantDeclaration(EnumConstantDeclaration node) {
_declaration(node);
- _token(node.name2);
+ _token(node.name);
node.arguments?.accept(this);
}
@@ -324,7 +324,7 @@
void visitEnumDeclaration(EnumDeclaration node) {
_compilationUnitMember(node);
_token(node.enumKeyword);
- _token(node.name2);
+ _token(node.name);
node.typeParameters?.accept(this);
node.withClause?.accept(this);
node.implementsClause?.accept(this);
@@ -370,7 +370,7 @@
_compilationUnitMember(node);
_token(node.extensionKeyword);
_token(node.typeKeyword);
- _token(node.name2);
+ _token(node.name);
node.typeParameters?.accept(this);
_token(node.onKeyword);
node.extendedType.accept(this);
@@ -495,7 +495,7 @@
_token(node.externalKeyword);
node.returnType?.accept(this);
_token(node.propertyKeyword);
- _token(node.name2);
+ _token(node.name);
node.functionExpression.accept(this);
}
@@ -529,7 +529,7 @@
_compilationUnitMember(node);
_token(node.typedefKeyword);
node.returnType?.accept(this);
- _token(node.name2);
+ _token(node.name);
node.typeParameters?.accept(this);
node.parameters.accept(this);
_token(node.semicolon);
@@ -558,7 +558,7 @@
void visitGenericTypeAlias(GenericTypeAlias node) {
_compilationUnitMember(node);
_token(node.typedefKeyword);
- _token(node.name2);
+ _token(node.name);
node.typeParameters?.accept(this);
_token(node.equals);
node.type.accept(this);
@@ -702,7 +702,7 @@
node.returnType?.accept(this);
_token(node.propertyKeyword);
_token(node.operatorKeyword);
- _token(node.name2);
+ _token(node.name);
node.typeParameters?.accept(this);
node.parameters?.accept(this);
node.body.accept(this);
@@ -721,7 +721,7 @@
void visitMixinDeclaration(MixinDeclaration node) {
_compilationUnitMember(node);
_token(node.mixinKeyword);
- _token(node.name2);
+ _token(node.name);
node.typeParameters?.accept(this);
node.onClause?.accept(this);
node.implementsClause?.accept(this);
@@ -994,7 +994,7 @@
// TODO (kallentu) : Clean up TypeParameterImpl casting once variance is
// added to the interface.
_token((node as TypeParameterImpl).varianceKeyword);
- _token(node.name2);
+ _token(node.name);
_token(node.extendsKeyword);
node.bound?.accept(this);
}
@@ -1009,7 +1009,7 @@
@override
void visitVariableDeclaration(VariableDeclaration node) {
_annotatedNode(node);
- _token(node.name2);
+ _token(node.name);
_token(node.equals);
node.initializer?.accept(this);
}
diff --git a/pkg/analyzer/lib/src/summary2/default_types_builder.dart b/pkg/analyzer/lib/src/summary2/default_types_builder.dart
index 52b201a..0a56084 100644
--- a/pkg/analyzer/lib/src/summary2/default_types_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/default_types_builder.dart
@@ -119,7 +119,7 @@
if (typeParametersByName == null) {
typeParametersByName = {};
for (var parameterNode in typeParameters) {
- var name = parameterNode.name2.lexeme;
+ var name = parameterNode.name.lexeme;
typeParametersByName[name] = parameterNode;
}
}
diff --git a/pkg/analyzer/lib/src/summary2/element_builder.dart b/pkg/analyzer/lib/src/summary2/element_builder.dart
index 577597d..114fa1d 100644
--- a/pkg/analyzer/lib/src/summary2/element_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/element_builder.dart
@@ -88,7 +88,7 @@
@override
void visitClassDeclaration(covariant ClassDeclarationImpl node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var element = ClassElementImpl(name, nameToken.offset);
@@ -121,7 +121,7 @@
@override
void visitClassTypeAlias(covariant ClassTypeAliasImpl node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var element = ClassElementImpl(name, nameToken.offset);
@@ -156,8 +156,8 @@
void visitConstructorDeclaration(
covariant ConstructorDeclarationImpl node,
) {
- var nameNode = node.name2 ?? node.returnType;
- var name = node.name2?.lexeme ?? '';
+ var nameNode = node.name ?? node.returnType;
+ var name = node.name?.lexeme ?? '';
if (name == 'new') {
// A constructor declared as `C.new` is unnamed, and is modeled as such.
name = '';
@@ -196,7 +196,7 @@
@override
void visitEnumDeclaration(covariant EnumDeclarationImpl node) {
- var nameNode = node.name2;
+ var nameNode = node.name;
var name = nameNode.lexeme;
var nameOffset = nameNode.offset;
@@ -222,8 +222,8 @@
var valuesElements = <Expression>[];
for (var i = 0; i < constants.length; ++i) {
var constant = constants[i] as EnumConstantDeclarationImpl;
- var name = constant.name2.lexeme;
- var field = ConstFieldElementImpl(name, constant.name2.offset)
+ var name = constant.name.lexeme;
+ var field = ConstFieldElementImpl(name, constant.name.offset)
..hasImplicitType = true
..hasInitializer = true
..isConst = true
@@ -267,7 +267,7 @@
);
var variableDeclaration = VariableDeclarationImpl(
- name2: StringToken(TokenType.STRING, name, -1),
+ name: StringToken(TokenType.STRING, name, -1),
equals: Tokens.eq(),
initializer: initializer,
);
@@ -308,7 +308,7 @@
valuesField.constantInitializer = initializer;
var variableDeclaration = VariableDeclarationImpl(
- name2: StringToken(TokenType.STRING, 'values', -1),
+ name: StringToken(TokenType.STRING, 'values', -1),
equals: Tokens.eq(),
initializer: initializer,
);
@@ -397,7 +397,7 @@
@override
void visitExtensionDeclaration(covariant ExtensionDeclarationImpl node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken?.lexeme;
var nameOffset = nameToken?.offset ?? -1;
@@ -446,7 +446,7 @@
var metadata = _buildAnnotations(node.metadata);
for (var variable in node.fields.variables) {
variable as VariableDeclarationImpl;
- var nameToken = variable.name2;
+ var nameToken = variable.name;
var name = nameToken.lexeme;
var nameOffset = nameToken.offset;
@@ -543,7 +543,7 @@
@override
void visitFunctionDeclaration(covariant FunctionDeclarationImpl node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var nameOffset = nameToken.offset;
@@ -606,7 +606,7 @@
@override
void visitFunctionTypeAlias(covariant FunctionTypeAliasImpl node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var element = TypeAliasElementImpl(name, nameToken.offset);
@@ -715,7 +715,7 @@
@override
void visitGenericTypeAlias(covariant GenericTypeAliasImpl node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var element = TypeAliasElementImpl(name, nameToken.offset);
@@ -777,7 +777,7 @@
@override
void visitMethodDeclaration(covariant MethodDeclarationImpl node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var nameOffset = nameToken.offset;
@@ -851,7 +851,7 @@
@override
void visitMixinDeclaration(covariant MixinDeclarationImpl node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var element = MixinElementImpl(name, nameToken.offset);
@@ -1036,7 +1036,7 @@
var metadata = _buildAnnotations(node.metadata);
for (var variable in node.variables.variables) {
variable as VariableDeclarationImpl;
- var nameToken = variable.name2;
+ var nameToken = variable.name;
var name = nameToken.lexeme;
var nameOffset = nameToken.offset;
@@ -1090,7 +1090,7 @@
@override
void visitTypeParameter(covariant TypeParameterImpl node) {
- var nameToken = node.name2;
+ var nameToken = node.name;
var name = nameToken.lexeme;
var element = TypeParameterElementImpl(name, nameToken.offset);
diff --git a/pkg/analyzer/lib/src/summary2/informative_data.dart b/pkg/analyzer/lib/src/summary2/informative_data.dart
index f5d36aa..365c339 100644
--- a/pkg/analyzer/lib/src/summary2/informative_data.dart
+++ b/pkg/analyzer/lib/src/summary2/informative_data.dart
@@ -1116,7 +1116,7 @@
sink.writeList2<ClassDeclaration>(unit.declarations, (node) {
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
_writeTypeParameters(node.typeParameters);
_writeConstructors(node.members);
@@ -1132,7 +1132,7 @@
sink.writeList2<ClassTypeAlias>(unit.declarations, (node) {
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
_writeTypeParameters(node.typeParameters);
_writeOffsets(
@@ -1144,7 +1144,7 @@
sink.writeList2<EnumDeclaration>(unit.declarations, (node) {
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
_writeTypeParameters(node.typeParameters);
_writeConstructors(node.members);
@@ -1161,7 +1161,7 @@
sink.writeList2<ExtensionDeclaration>(unit.declarations, (node) {
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(1 + (node.name2?.offset ?? -1));
+ sink.writeUInt30(1 + (node.name?.offset ?? -1));
_writeDocumentationComment(node);
_writeTypeParameters(node.typeParameters);
_writeConstructors(node.members);
@@ -1182,7 +1182,7 @@
(node) {
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
_writeTypeParameters(node.functionExpression.typeParameters);
_writeFormalParameters(node.functionExpression.parameters);
@@ -1201,7 +1201,7 @@
.toList(), (node) {
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
_writeTypeParameters(node.functionExpression.typeParameters);
_writeFormalParameters(node.functionExpression.parameters);
@@ -1215,7 +1215,7 @@
sink.writeList2<FunctionTypeAlias>(unit.declarations, (node) {
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
_writeTypeParameters(node.typeParameters);
_writeFormalParameters(node.parameters);
@@ -1230,7 +1230,7 @@
var aliasedType = node.type;
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
_writeTypeParameters(node.typeParameters);
if (aliasedType is GenericFunctionType) {
@@ -1250,7 +1250,7 @@
sink.writeList2<MixinDeclaration>(unit.declarations, (node) {
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
_writeTypeParameters(node.typeParameters);
_writeConstructors(node.members);
@@ -1293,7 +1293,7 @@
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
sink.writeOptionalUInt30(node.period?.offset);
- var nameNode = node.name2 ?? node.returnType;
+ var nameNode = node.name ?? node.returnType;
sink.writeUInt30(nameNode.offset);
sink.writeUInt30(nameNode.end);
_writeDocumentationComment(node);
@@ -1331,7 +1331,7 @@
var codeOffset = node.offset;
sink.writeUInt30(codeOffset);
sink.writeUInt30(node.end - codeOffset);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
_writeOffsets(
metadata: node.metadata,
@@ -1348,7 +1348,7 @@
var codeOffset = _codeOffsetForVariable(node);
sink.writeUInt30(codeOffset);
sink.writeUInt30(node.end - codeOffset);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
// TODO(scheglov) Replace with some kind of double-iterating list.
@@ -1403,7 +1403,7 @@
(node) {
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
_writeTypeParameters(node.typeParameters);
_writeFormalParameters(node.parameters);
@@ -1449,7 +1449,7 @@
(node) {
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
_writeTypeParameters(node.typeParameters);
_writeFormalParameters(node.parameters);
@@ -1537,7 +1537,7 @@
var codeOffset = _codeOffsetForVariable(node);
sink.writeUInt30(codeOffset);
sink.writeUInt30(node.end - codeOffset);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
_writeDocumentationComment(node);
// TODO(scheglov) Replace with some kind of double-iterating list.
@@ -1554,7 +1554,7 @@
sink.writeList<TypeParameter>(parameters, (node) {
sink.writeUInt30(node.offset);
sink.writeUInt30(node.length);
- sink.writeUInt30(node.name2.offset);
+ sink.writeUInt30(node.name.offset);
});
}
}
diff --git a/pkg/analyzer/lib/src/summary2/macro_declarations.dart b/pkg/analyzer/lib/src/summary2/macro_declarations.dart
index ed16196..d1a2fcc 100644
--- a/pkg/analyzer/lib/src/summary2/macro_declarations.dart
+++ b/pkg/analyzer/lib/src/summary2/macro_declarations.dart
@@ -214,7 +214,7 @@
assert(!_classMap.containsKey(node));
return IntrospectableClassDeclarationImpl._(
id: macro.RemoteInstance.uniqueId,
- identifier: _declaredIdentifier(node.name2, node.declaredElement2!),
+ identifier: _declaredIdentifier(node.name, node.declaredElement2!),
typeParameters: _typeParameters(node.typeParameters),
interfaces: _typeAnnotations(node.implementsClause?.interfaces),
isAbstract: node.abstractKeyword != null,
@@ -290,7 +290,7 @@
) {
return macro.TypeParameterDeclarationImpl(
id: macro.RemoteInstance.uniqueId,
- identifier: _declaredIdentifier(node.name2, node.declaredElement2!),
+ identifier: _declaredIdentifier(node.name, node.declaredElement2!),
bound: node.bound.mapOrNull(_typeAnnotation),
);
}
diff --git a/pkg/analyzer/lib/src/summary2/top_level_inference.dart b/pkg/analyzer/lib/src/summary2/top_level_inference.dart
index aeeb2ed..d54134b 100644
--- a/pkg/analyzer/lib/src/summary2/top_level_inference.dart
+++ b/pkg/analyzer/lib/src/summary2/top_level_inference.dart
@@ -455,7 +455,7 @@
@override
String get displayName {
- return _node.name2.lexeme;
+ return _node.name.lexeme;
}
@override
diff --git a/pkg/analyzer/lib/src/summary2/types_builder.dart b/pkg/analyzer/lib/src/summary2/types_builder.dart
index c07c7c0..890f350 100644
--- a/pkg/analyzer/lib/src/summary2/types_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/types_builder.dart
@@ -194,7 +194,7 @@
if (returnType == null) {
if (node.isSetter) {
returnType = _voidType;
- } else if (node.isOperator && node.name2.lexeme == '[]=') {
+ } else if (node.isOperator && node.name.lexeme == '[]=') {
returnType = _voidType;
} else {
returnType = _dynamicType;
diff --git a/pkg/analyzer/lib/src/test_utilities/find_node.dart b/pkg/analyzer/lib/src/test_utilities/find_node.dart
index 791270b..f7d4652 100644
--- a/pkg/analyzer/lib/src/test_utilities/find_node.dart
+++ b/pkg/analyzer/lib/src/test_utilities/find_node.dart
@@ -634,7 +634,7 @@
for (var declaration in unit.declarations) {
if (declaration is TopLevelVariableDeclaration) {
for (var variable in declaration.variables.variables) {
- if (variable.name2.lexeme == name) {
+ if (variable.name.lexeme == name) {
return variable;
}
}
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index 4b29623..96dbc21 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
name: analyzer
-version: 5.0.0
+version: 5.1.0-dev
description: This package provides a library that performs static analysis of Dart code.
repository: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer
diff --git a/pkg/analyzer/test/error/error_test.dart b/pkg/analyzer/test/error/error_test.dart
index d766e0e..854990c 100644
--- a/pkg/analyzer/test/error/error_test.dart
+++ b/pkg/analyzer/test/error/error_test.dart
@@ -38,13 +38,13 @@
var extendsClause = declaration.extendsClause;
if (extendsClause != null &&
extendsClause.superclass.name.name == 'ErrorCode') {
- String className = declaration.name2.lexeme;
+ String className = declaration.name.lexeme;
for (ClassMember member in declaration.members) {
if (member is FieldDeclaration && member.isStatic) {
var fields = member.fields;
if ((fields.type == null ? bad() : true) &&
fields.type!.toSource() == className) {
- String fieldName = fields.variables[0].name2.lexeme;
+ String fieldName = fields.variables[0].name.lexeme;
declaredCodes.add('$className.$fieldName');
}
}
@@ -61,7 +61,7 @@
TopLevelVariableDeclaration declaration = listingUnit.declarations
.whereType<TopLevelVariableDeclaration>()
.firstWhere((member) =>
- member.variables.variables[0].name2.lexeme == 'errorCodeValues');
+ member.variables.variables[0].name.lexeme == 'errorCodeValues');
var listLiteral =
declaration.variables.variables[0].initializer as ListLiteral;
for (var element in listLiteral.elements.cast<PrefixedIdentifier>()) {
diff --git a/pkg/analyzer/test/generated/class_member_parser_test.dart b/pkg/analyzer/test/generated/class_member_parser_test.dart
index 7d55bed..64cf9e8 100644
--- a/pkg/analyzer/test/generated/class_member_parser_test.dart
+++ b/pkg/analyzer/test/generated/class_member_parser_test.dart
@@ -39,7 +39,7 @@
expect(constructor.externalKeyword, isNull);
expect(constructor.constKeyword, isNull);
expect(constructor.factoryKeyword, isNull);
- expect(constructor.name2, isNull);
+ expect(constructor.name, isNull);
expect(constructor.parameters, isNotNull);
expect(constructor.period, isNull);
expect(constructor.returnType, isNotNull);
@@ -96,7 +96,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2.lexeme, 'late');
+ expect(method.name.lexeme, 'late');
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -295,7 +295,7 @@
expect(constructor.externalKeyword, isNull);
expect(constructor.constKeyword, isNull);
expect(constructor.factoryKeyword, isNull);
- expect(constructor.name2, isNull);
+ expect(constructor.name, isNull);
expect(constructor.parameters, isNotNull);
expect(constructor.period, isNull);
expect(constructor.returnType, isNotNull);
@@ -389,7 +389,7 @@
expect(constructor.externalKeyword, isNull);
expect(constructor.constKeyword, isNull);
expect(constructor.factoryKeyword, isNull);
- expect(constructor.name2, isNull);
+ expect(constructor.name, isNull);
expect(constructor.parameters, isNotNull);
expect(constructor.period, isNull);
expect(constructor.returnType, isNotNull);
@@ -417,7 +417,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseClassMember_field_generic() {
@@ -452,7 +452,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseClassMember_field_gftType_gftReturnType() {
@@ -499,7 +499,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseClassMember_field_namedGet() {
@@ -524,7 +524,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseClassMember_field_namedOperator() {
@@ -549,7 +549,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseClassMember_field_namedOperator_withAssignment() {
@@ -574,7 +574,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
expect(variable.initializer, isNotNull);
}
@@ -600,7 +600,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseClassMember_field_nameKeyword() {
@@ -650,7 +650,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseClassMember_finalAndCovariantLateWithInitializer() {
@@ -676,7 +676,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNotNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.body, isNotNull);
expect(method.parameters, isNull);
@@ -694,7 +694,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNotNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.body, isNotNull);
expect(method.parameters, isNull);
@@ -710,7 +710,7 @@
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNotNull);
expect(method.modifierKeyword, isNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -734,7 +734,7 @@
expect(method.documentationComment, isNull);
expect(method.externalKeyword, isNotNull);
expect(method.modifierKeyword, isNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -754,7 +754,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNotNull);
expect(method.parameters, isNotNull);
@@ -773,7 +773,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNotNull);
@@ -799,7 +799,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNotNull);
expect(method.parameters, isNotNull);
@@ -818,11 +818,11 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect((method.returnType as NamedType).name.name, 'T');
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNotNull);
TypeParameter tp = method.typeParameters!.typeParameters[0];
- expect(tp.name2.lexeme, 'T');
+ expect(tp.name.lexeme, 'T');
expect(tp.extendsKeyword, isNotNull);
expect((tp.bound as NamedType).name.name, 'num');
expect(method.parameters, isNotNull);
@@ -852,7 +852,7 @@
expect((typeArguments[1] as NamedType).name.name, 'T');
}
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNotNull);
expect(method.parameters, isNotNull);
@@ -872,7 +872,7 @@
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
expect((method.returnType as NamedType).name.name, 'T');
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNotNull);
expect(method.parameters, isNotNull);
@@ -891,7 +891,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNotNull);
expect(method.parameters, isNotNull);
@@ -910,7 +910,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -931,7 +931,7 @@
expect(method.modifierKeyword, isNotNull);
expect(method.propertyKeyword, isNotNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNull);
@@ -950,7 +950,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -969,7 +969,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1062,7 +1062,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1081,7 +1081,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1100,7 +1100,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1119,8 +1119,8 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
- expect(method.name2.lexeme, 'm');
+ expect(method.name, isNotNull);
+ expect(method.name.lexeme, 'm');
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1139,7 +1139,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1158,7 +1158,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1179,7 +1179,7 @@
expect(method.modifierKeyword, isNotNull);
expect(method.propertyKeyword, isNotNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1198,7 +1198,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1217,7 +1217,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1234,7 +1234,7 @@
expect(method.modifierKeyword, isNotNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1250,7 +1250,7 @@
expect(method.modifierKeyword, isNotNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1269,7 +1269,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1288,7 +1288,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isGenericFunctionType);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNotNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1311,7 +1311,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2.lexeme, '>>>');
+ expect(method.name.lexeme, '>>>');
expect(method.operatorKeyword, isNotNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1348,7 +1348,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNotNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1367,7 +1367,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNotNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1386,7 +1386,7 @@
expect(method.modifierKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2.lexeme, '<');
+ expect(method.name.lexeme, '<');
expect(method.operatorKeyword, isNotNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -1403,7 +1403,7 @@
expect(constructor.factoryKeyword!.keyword, Keyword.FACTORY);
expect(constructor.returnType.name, 'C');
expect(constructor.period, isNull);
- expect(constructor.name2, isNull);
+ expect(constructor.name, isNull);
expect(constructor.parameters, isNotNull);
expect(constructor.parameters.parameters, isEmpty);
expect(constructor.separator!.type, TokenType.EQ);
@@ -1425,7 +1425,7 @@
expect(constructor.factoryKeyword!.keyword, Keyword.FACTORY);
expect(constructor.returnType.name, 'C');
expect(constructor.period, isNull);
- expect(constructor.name2, isNull);
+ expect(constructor.name, isNull);
expect(constructor.parameters, isNotNull);
expect(constructor.parameters.parameters, isEmpty);
expect(constructor.separator, isNull);
@@ -1452,7 +1452,7 @@
expect(constructor.factoryKeyword!.keyword, Keyword.FACTORY);
expect(constructor.returnType.name, 'C');
expect(constructor.period, isNull);
- expect(constructor.name2, isNull);
+ expect(constructor.name, isNull);
expect(constructor.parameters, isNotNull);
expect(constructor.parameters.parameters, isEmpty);
expect(constructor.separator!.type, TokenType.EQ);
@@ -1500,7 +1500,7 @@
expect(constructor.factoryKeyword, isNotNull);
expect(constructor.returnType.name, 'C');
expect(constructor.period!.type, TokenType.PERIOD);
- expect(constructor.name2!.lexeme, 'foo');
+ expect(constructor.name!.lexeme, 'foo');
expect(constructor.parameters, isNotNull);
expect(constructor.parameters.parameters, isEmpty);
expect(constructor.separator, isNull);
@@ -1554,7 +1554,7 @@
expect(constructor.factoryKeyword, isNull);
expect(constructor.returnType.name, 'C');
expect(constructor.period!.type, TokenType.PERIOD);
- expect(constructor.name2!.lexeme, 'foo');
+ expect(constructor.name!.lexeme, 'foo');
expect(constructor.parameters, isNotNull);
expect(constructor.parameters.parameters, isEmpty);
expect(constructor.separator, isNull);
@@ -1605,7 +1605,7 @@
expect(constructor.constKeyword, isNull);
expect(constructor.factoryKeyword, isNull);
expect(constructor.returnType.name, 'C');
- expect(constructor.name2, isNull);
+ expect(constructor.name, isNull);
expect(constructor.parameters, isNotNull);
expect(constructor.parameters.parameters, isEmpty);
expect(constructor.separator!.lexeme, ':');
@@ -1628,7 +1628,7 @@
expect(constructor.constKeyword, isNull);
expect(constructor.factoryKeyword, isNull);
expect(constructor.returnType.name, 'C');
- expect(constructor.name2, isNull);
+ expect(constructor.name, isNull);
expect(constructor.parameters, isNotNull);
expect(constructor.parameters.parameters, isEmpty);
expect(constructor.separator!.lexeme, ':');
@@ -1650,7 +1650,7 @@
expect(constructor.factoryKeyword, isNull);
expect(constructor.returnType.name, 'C');
expect(constructor.period, isNull);
- expect(constructor.name2, isNull);
+ expect(constructor.name, isNull);
expect(constructor.parameters, isNotNull);
expect(constructor.parameters.parameters, isEmpty);
expect(constructor.separator, isNull);
@@ -1783,7 +1783,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseField_external() {
@@ -1866,7 +1866,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseField_late() {
@@ -1890,7 +1890,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseField_late_const() {
@@ -1916,7 +1916,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseField_late_final() {
@@ -1940,7 +1940,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseField_late_var() {
@@ -1963,7 +1963,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseField_non_abstract() {
@@ -2009,7 +2009,7 @@
NodeList<VariableDeclaration> variables = list.variables;
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
- expect(variable.name2, isNotNull);
+ expect(variable.name, isNotNull);
}
void test_parseGetter_identifier_colon_issue_36961() {
@@ -2026,7 +2026,7 @@
expect(constructor.body, isNotNull);
expect(constructor.documentationComment, isNull);
expect(constructor.externalKeyword, isNull);
- expect(constructor.name2, isNull);
+ expect(constructor.name, isNull);
expect(constructor.parameters, isNotNull);
expect(constructor.returnType, isNotNull);
}
@@ -2040,7 +2040,7 @@
expectCommentText(method.documentationComment, '/// Doc');
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.parameters, isNull);
expect(method.propertyKeyword, isNotNull);
@@ -2056,7 +2056,7 @@
expectCommentText(method.documentationComment, '/// Doc');
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword!.lexeme, 'static');
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNull);
@@ -2103,7 +2103,7 @@
expectCommentText(method.documentationComment, '/// Doc');
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNotNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -2120,7 +2120,7 @@
expectCommentText(method.documentationComment, '/// Doc');
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword, isNull);
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
@@ -2137,7 +2137,7 @@
expectCommentText(method.documentationComment, '/// Doc');
expect(method.externalKeyword, isNull);
expect(method.modifierKeyword!.lexeme, 'static');
- expect(method.name2, isNotNull);
+ expect(method.name, isNotNull);
expect(method.operatorKeyword, isNull);
expect(method.typeParameters, isNull);
expect(method.parameters, isNotNull);
diff --git a/pkg/analyzer/test/generated/collection_literal_parser_test.dart b/pkg/analyzer/test/generated/collection_literal_parser_test.dart
index 3c171bb..2a65303 100644
--- a/pkg/analyzer/test/generated/collection_literal_parser_test.dart
+++ b/pkg/analyzer/test/generated/collection_literal_parser_test.dart
@@ -97,7 +97,7 @@
expect(second.rightParenthesis.lexeme, ')');
var forLoopParts = second.forLoopParts as ForPartsWithDeclarations;
VariableDeclaration forLoopVar = forLoopParts.variables.variables[0];
- expect(forLoopVar.name2.lexeme, 'x');
+ expect(forLoopVar.name.lexeme, 'x');
var condition = forLoopParts.condition as BinaryExpression;
var rightOperand = condition.rightOperand as IntegerLiteral;
expect(rightOperand.value, 10);
diff --git a/pkg/analyzer/test/generated/error_parser_test.dart b/pkg/analyzer/test/generated/error_parser_test.dart
index f226c4b..8428cce 100644
--- a/pkg/analyzer/test/generated/error_parser_test.dart
+++ b/pkg/analyzer/test/generated/error_parser_test.dart
@@ -852,7 +852,7 @@
expect(semicolon, isNotNull);
expect(semicolon.isSynthetic, isTrue);
ClassDeclaration clazz = unit.declarations[0] as ClassDeclaration;
- expect(clazz.name2.lexeme, 'A');
+ expect(clazz.name.lexeme, 'A');
}
void test_expectedToken_semicolonMissingAfterExpression() {
@@ -888,7 +888,7 @@
expect(semicolon, isNotNull);
expect(semicolon.isSynthetic, isTrue);
ClassDeclaration clazz = unit.declarations[0] as ClassDeclaration;
- expect(clazz.name2.lexeme, 'A');
+ expect(clazz.name.lexeme, 'A');
}
void test_expectedToken_whileMissingInDoStatement() {
diff --git a/pkg/analyzer/test/generated/extension_methods_parser_test.dart b/pkg/analyzer/test/generated/extension_methods_parser_test.dart
index 3407fe0..8f98507 100644
--- a/pkg/analyzer/test/generated/extension_methods_parser_test.dart
+++ b/pkg/analyzer/test/generated/extension_methods_parser_test.dart
@@ -29,7 +29,7 @@
]);
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'extends');
expect((extension.extendedType as NamedType).name.name, 'A');
expect(extension.members, hasLength(0));
@@ -42,7 +42,7 @@
]);
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'implements');
expect((extension.extendedType as NamedType).name.name, 'C');
expect(extension.members, hasLength(0));
@@ -52,7 +52,7 @@
var unit = parseCompilationUnit('extension E on C<T> { }');
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'on');
var namedType = extension.extendedType as NamedType;
expect(namedType.name.name, 'C');
@@ -64,7 +64,7 @@
var unit = parseCompilationUnit('extension E<T> on C<T> { }');
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'on');
var namedType = extension.extendedType as NamedType;
expect(namedType.name.name, 'C');
@@ -76,7 +76,7 @@
var unit = parseCompilationUnit('extension<T> on C<T> { }');
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2, isNull);
+ expect(extension.name, isNull);
expect(extension.onKeyword.lexeme, 'on');
var namedType = extension.extendedType as NamedType;
expect(namedType.name.name, 'C');
@@ -120,7 +120,7 @@
]);
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'on');
expect((extension.extendedType as NamedType).name.name, '');
expect(extension.members, hasLength(0));
@@ -133,7 +133,7 @@
]);
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'on');
expect((extension.extendedType as NamedType).name.name, '');
expect(extension.members, hasLength(0));
@@ -145,7 +145,7 @@
]);
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'on');
expect((extension.extendedType as NamedType).name.name, 'C');
expect(extension.members, hasLength(0));
@@ -159,7 +159,7 @@
expect(method.externalKeyword, isNull);
expect(method.propertyKeyword, isNull);
expect(method.returnType, isNotNull);
- expect(method.name2.lexeme, 'late');
+ expect(method.name.lexeme, 'late');
expect(method.functionExpression, isNotNull);
var body = method.functionExpression.body as BlockFunctionBody;
@@ -173,7 +173,7 @@
var unit = parseCompilationUnit('extension E on C { }');
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'on');
expect((extension.extendedType as NamedType).name.name, 'C');
var namedType = extension.extendedType as NamedType;
@@ -188,7 +188,7 @@
]);
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'extends');
expect((extension.extendedType as NamedType).name.name, 'C');
expect(extension.members, hasLength(0));
@@ -200,7 +200,7 @@
]);
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'implements');
expect((extension.extendedType as NamedType).name.name, 'C');
expect(extension.members, hasLength(0));
@@ -210,7 +210,7 @@
var unit = parseCompilationUnit('extension on C { }');
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2, isNull);
+ expect(extension.name, isNull);
expect(extension.onKeyword.lexeme, 'on');
expect((extension.extendedType as NamedType).name.name, 'C');
var namedType = extension.extendedType as NamedType;
@@ -236,7 +236,7 @@
]);
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'with');
expect((extension.extendedType as NamedType).name.name, 'C');
expect(extension.members, hasLength(0));
@@ -246,7 +246,7 @@
var unit = parseCompilationUnit('extension E on void { }');
expect(unit.declarations, hasLength(1));
var extension = unit.declarations[0] as ExtensionDeclaration;
- expect(extension.name2!.lexeme, 'E');
+ expect(extension.name!.lexeme, 'E');
expect(extension.onKeyword.lexeme, 'on');
expect((extension.extendedType as NamedType).name.name, 'void');
expect(extension.members, hasLength(0));
diff --git a/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart b/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart
index e50a3a7..6fc3b56 100644
--- a/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart
+++ b/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart
@@ -194,7 +194,7 @@
var classDeclaration = unit.declarations.single as ClassDeclaration;
var constructorDeclaration =
classDeclaration.members.single as ConstructorDeclaration;
- expect(constructorDeclaration.name2!.lexeme, 'new');
+ expect(constructorDeclaration.name!.lexeme, 'new');
}
void test_constructor_name_factory() {
@@ -207,7 +207,7 @@
var classDeclaration = unit.declarations.single as ClassDeclaration;
var constructorDeclaration =
classDeclaration.members[0] as ConstructorDeclaration;
- expect(constructorDeclaration.name2!.lexeme, 'new');
+ expect(constructorDeclaration.name!.lexeme, 'new');
}
void test_constructor_tearoff() {
@@ -320,7 +320,7 @@
var classDeclaration = unit.declarations.single as ClassDeclaration;
var constructorDeclaration =
classDeclaration.members.single as ConstructorDeclaration;
- expect(constructorDeclaration.name2!.lexeme, 'new');
+ expect(constructorDeclaration.name!.lexeme, 'new');
}
void test_factory_redirection() {
diff --git a/pkg/analyzer/test/generated/recovery_parser_test.dart b/pkg/analyzer/test/generated/recovery_parser_test.dart
index 7d85bb6..9a891bd 100644
--- a/pkg/analyzer/test/generated/recovery_parser_test.dart
+++ b/pkg/analyzer/test/generated/recovery_parser_test.dart
@@ -389,7 +389,7 @@
expect(unit.declarations, hasLength(1));
var classDecl = unit.childEntities.first as ClassDeclaration;
expect(classDecl, isNotNull);
- expect(classDecl.name2.lexeme, 'foo');
+ expect(classDecl.name.lexeme, 'foo');
}
void test_equalityExpression_missing_LHS() {
@@ -500,7 +500,7 @@
NodeList<VariableDeclaration> vars =
(fieldDecl as FieldDeclaration).fields.variables;
expect(vars, hasLength(1));
- expect(vars[0].name2.lexeme, "v");
+ expect(vars[0].name.lexeme, "v");
}
void test_functionExpression_named() {
@@ -660,7 +660,7 @@
NodeList<VariableDeclaration> variables =
(member as TopLevelVariableDeclaration).variables.variables;
expect(variables, hasLength(1));
- final name = variables[0].name2;
+ final name = variables[0].name;
expect(name.isSynthetic, isFalse);
}
@@ -676,7 +676,7 @@
NodeList<VariableDeclaration> variables =
(member as TopLevelVariableDeclaration).variables.variables;
expect(variables, hasLength(1));
- final name = variables[0].name2;
+ final name = variables[0].name;
expect(name.isSynthetic, isTrue);
}
@@ -692,7 +692,7 @@
NodeList<VariableDeclaration> variables =
(member as TopLevelVariableDeclaration).variables.variables;
expect(variables, hasLength(1));
- final name = variables[0].name2;
+ final name = variables[0].name;
expect(name.isSynthetic, isTrue);
}
@@ -708,7 +708,7 @@
NodeList<VariableDeclaration> variables =
(member as TopLevelVariableDeclaration).variables.variables;
expect(variables, hasLength(1));
- final name = variables[0].name2;
+ final name = variables[0].name;
expect(name.isSynthetic, isTrue);
}
@@ -734,7 +734,7 @@
NodeList<VariableDeclaration> fields = fieldList.variables;
expect(fields, hasLength(1));
VariableDeclaration field = fields[0];
- expect(field.name2.isSynthetic, isTrue);
+ expect(field.name.isSynthetic, isTrue);
}
void test_incompleteField_final() {
@@ -759,7 +759,7 @@
NodeList<VariableDeclaration> fields = fieldList.variables;
expect(fields, hasLength(1));
VariableDeclaration field = fields[0];
- expect(field.name2.isSynthetic, isTrue);
+ expect(field.name.isSynthetic, isTrue);
}
void test_incompleteField_static() {
@@ -785,7 +785,7 @@
NodeList<VariableDeclaration> fields = fieldList.variables;
expect(fields, hasLength(1));
VariableDeclaration field = fields[0];
- expect(field.name2.isSynthetic, isFalse);
+ expect(field.name.isSynthetic, isFalse);
}
void test_incompleteField_static2() {
@@ -808,7 +808,7 @@
NodeList<VariableDeclaration> fields = fieldList.variables;
expect(fields, hasLength(1));
VariableDeclaration field = fields[0];
- expect(field.name2.isSynthetic, isFalse);
+ expect(field.name.isSynthetic, isFalse);
}
void test_incompleteField_type() {
@@ -834,7 +834,7 @@
expect(fields, hasLength(1));
VariableDeclaration field = fields[0];
expect(type, isNull);
- expect(field.name2.lexeme, 'A');
+ expect(field.name.lexeme, 'A');
}
void test_incompleteField_var() {
@@ -859,7 +859,7 @@
NodeList<VariableDeclaration> fields = fieldList.variables;
expect(fields, hasLength(1));
VariableDeclaration field = fields[0];
- expect(field.name2.isSynthetic, isTrue);
+ expect(field.name.isSynthetic, isTrue);
}
void test_incompleteForEach() {
@@ -964,7 +964,7 @@
List<VariableDeclaration> fields = fieldList.variables;
expect(fields, hasLength(1));
VariableDeclaration field = fields[0];
- expect(field.name2.lexeme, 'f');
+ expect(field.name.lexeme, 'f');
// validate the type
var typeArguments = (fieldList.type as NamedType).typeArguments!;
expect(typeArguments.arguments, hasLength(1));
@@ -1056,7 +1056,7 @@
var fields = classDecl.members.first as FieldDeclaration;
expect(fields.fields.variables, hasLength(1));
VariableDeclaration field = fields.fields.variables.first;
- expect(field.name2.lexeme, 'g');
+ expect(field.name.lexeme, 'g');
}
void test_invalidTypeParameters_super() {
@@ -1099,7 +1099,7 @@
]);
var declaration = unit.declarations[0] as ClassDeclaration;
var method = declaration.members[0] as ConstructorDeclaration;
- expect(method.name2!.lexeme, 'named');
+ expect(method.name!.lexeme, 'named');
expect(method.parameters, isNotNull);
}
@@ -1110,7 +1110,7 @@
]);
var declaration = unit.declarations[0] as ClassDeclaration;
var constructor = declaration.members[0] as ConstructorDeclaration;
- expect(constructor.name2!.lexeme, 'named');
+ expect(constructor.name!.lexeme, 'named');
expect(constructor.parameters, isNotNull);
expect(constructor.parameters.parameters, hasLength(0));
}
@@ -1121,7 +1121,7 @@
]);
var declaration = unit.declarations[0] as ClassDeclaration;
var constructor = declaration.members[0] as ConstructorDeclaration;
- expect(constructor.name2, isNull);
+ expect(constructor.name, isNull);
expect(constructor.parameters, isNotNull);
expect(constructor.parameters.parameters, hasLength(0));
}
@@ -1132,7 +1132,7 @@
]);
var declaration = unit.declarations[0] as ClassDeclaration;
var constructor = declaration.members[0] as ConstructorDeclaration;
- expect(constructor.name2!.lexeme, 'named');
+ expect(constructor.name!.lexeme, 'named');
expect(constructor.parameters, isNotNull);
expect(constructor.parameters.parameters, hasLength(0));
}
@@ -1145,7 +1145,7 @@
]);
var declaration = unit.declarations[0] as ClassDeclaration;
var method = declaration.members[0] as ConstructorDeclaration;
- expect(method.name2!.lexeme, 'named');
+ expect(method.name!.lexeme, 'named');
expect(method.parameters, isNotNull);
expect(method.parameters.parameters, hasLength(0));
}
@@ -1284,7 +1284,7 @@
expect(members[0], isMethodDeclaration);
ClassMember member = members[1];
expect(member, isMethodDeclaration);
- expect((member as MethodDeclaration).name2.lexeme, "foo");
+ expect((member as MethodDeclaration).name.lexeme, "foo");
}
void test_missingIdentifier_afterAnnotation() {
@@ -1309,7 +1309,7 @@
expect(variables, hasLength(1));
VariableDeclaration variable = variables[0];
expect(variableList.type.toString(), expectedTypeName);
- expect(variable.name2.lexeme, expectedName);
+ expect(variable.name.lexeme, expectedName);
if (expectedSemicolon.isEmpty) {
expect(declaration.semicolon.isSynthetic, isTrue);
} else {
diff --git a/pkg/analyzer/test/generated/simple_parser_test.dart b/pkg/analyzer/test/generated/simple_parser_test.dart
index f01c1d1..0f1b1ea 100644
--- a/pkg/analyzer/test/generated/simple_parser_test.dart
+++ b/pkg/analyzer/test/generated/simple_parser_test.dart
@@ -108,10 +108,10 @@
class C<@Foo.bar(const [], const [1], const{"":r""}, 0xFF + 2, .3, 4.5) T> {}
''');
var clazz = unit.declarations[0] as ClassDeclaration;
- expect(clazz.name2.lexeme, 'C');
+ expect(clazz.name.lexeme, 'C');
expect(clazz.typeParameters!.typeParameters, hasLength(1));
TypeParameter typeParameter = clazz.typeParameters!.typeParameters[0];
- expect(typeParameter.name2.lexeme, 'T');
+ expect(typeParameter.name.lexeme, 'T');
expect(typeParameter.metadata, hasLength(1));
Annotation metadata = typeParameter.metadata[0];
expect(metadata.name.name, 'Foo.bar');
@@ -1850,7 +1850,7 @@
assertNoErrors();
expect(parameter.bound, isGenericFunctionType);
expect(parameter.extendsKeyword, isNotNull);
- expect(parameter.name2, isNotNull);
+ expect(parameter.name, isNotNull);
}
void test_parseTypeParameter_bounded_functionType_return() {
@@ -1860,7 +1860,7 @@
assertNoErrors();
expect(parameter.bound, isGenericFunctionType);
expect(parameter.extendsKeyword, isNotNull);
- expect(parameter.name2, isNotNull);
+ expect(parameter.name, isNotNull);
}
void test_parseTypeParameter_bounded_generic() {
@@ -1870,7 +1870,7 @@
assertNoErrors();
expect(parameter.bound, isNamedType);
expect(parameter.extendsKeyword, isNotNull);
- expect(parameter.name2, isNotNull);
+ expect(parameter.name, isNotNull);
}
void test_parseTypeParameter_bounded_simple() {
@@ -1880,7 +1880,7 @@
assertNoErrors();
expect(parameter.bound, isNamedType);
expect(parameter.extendsKeyword, isNotNull);
- expect(parameter.name2, isNotNull);
+ expect(parameter.name, isNotNull);
}
void test_parseTypeParameter_simple() {
@@ -1890,7 +1890,7 @@
assertNoErrors();
expect(parameter.bound, isNull);
expect(parameter.extendsKeyword, isNull);
- expect(parameter.name2, isNotNull);
+ expect(parameter.name, isNotNull);
}
void test_parseTypeParameterList_multiple() {
@@ -1922,7 +1922,7 @@
expect(parameterList.rightBracket, isNotNull);
expect(parameterList.typeParameters, hasLength(1));
TypeParameter typeParameter = parameterList.typeParameters[0];
- expect(typeParameter.name2.lexeme, 'A');
+ expect(typeParameter.name.lexeme, 'A');
var bound = typeParameter.bound as NamedType;
expect(bound.name.name, 'B');
var typeArguments = bound.typeArguments!;
@@ -1956,7 +1956,7 @@
VariableDeclaration declaration = parseVariableDeclaration('var a = b;');
expectNotNullIfNoErrors(declaration);
assertNoErrors();
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.equals, isNotNull);
expect(declaration.initializer, isNotNull);
}
@@ -2041,7 +2041,7 @@
VariableDeclaration declaration = parseVariableDeclaration('var a;');
expectNotNullIfNoErrors(declaration);
assertNoErrors();
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.equals, isNull);
expect(declaration.initializer, isNull);
}
@@ -2073,7 +2073,7 @@
expectedError(ScannerErrorCode.EXPECTED_TOKEN, 23, 1),
]);
var typeAlias = unit.declarations[0] as GenericTypeAlias;
- expect(typeAlias.name2.lexeme, 'K');
+ expect(typeAlias.name.lexeme, 'K');
var functionType = typeAlias.functionType!;
expect(functionType.parameters.parameters, hasLength(1));
var parameter = functionType.parameters.parameters[0];
@@ -2087,7 +2087,7 @@
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 19, 1),
]);
var typeAlias = unit.declarations[0] as GenericTypeAlias;
- expect(typeAlias.name2.lexeme, 'T');
+ expect(typeAlias.name.lexeme, 'T');
var functionType = typeAlias.functionType!;
expect(functionType.parameters.parameters, hasLength(1));
var parameter = functionType.parameters.parameters[0];
diff --git a/pkg/analyzer/test/generated/statement_parser_test.dart b/pkg/analyzer/test/generated/statement_parser_test.dart
index f358b2a..2843c1c 100644
--- a/pkg/analyzer/test/generated/statement_parser_test.dart
+++ b/pkg/analyzer/test/generated/statement_parser_test.dart
@@ -1072,7 +1072,7 @@
assertNoErrors();
List<VariableDeclaration> variables = statement.variables.variables;
expect(variables, hasLength(1));
- expect(variables[0].name2.lexeme, 'Function');
+ expect(variables[0].name.lexeme, 'Function');
}
void test_parseNonLabeledStatement_variableDeclaration_gftType() {
@@ -1082,7 +1082,7 @@
VariableDeclarationList variableList = statement.variables;
List<VariableDeclaration> variables = variableList.variables;
expect(variables, hasLength(1));
- expect(variables[0].name2.lexeme, 'v');
+ expect(variables[0].name.lexeme, 'v');
expect(variableList.type, isGenericFunctionType);
}
@@ -1095,7 +1095,7 @@
VariableDeclarationList variableList = statement.variables;
List<VariableDeclaration> variables = variableList.variables;
expect(variables, hasLength(1));
- expect(variables[0].name2.lexeme, 'v');
+ expect(variables[0].name.lexeme, 'v');
expect(variableList.type, isGenericFunctionType);
}
@@ -1107,7 +1107,7 @@
VariableDeclarationList variableList = statement.variables;
List<VariableDeclaration> variables = variableList.variables;
expect(variables, hasLength(1));
- expect(variables[0].name2.lexeme, 'v');
+ expect(variables[0].name.lexeme, 'v');
expect(variableList.type, isGenericFunctionType);
}
@@ -1119,7 +1119,7 @@
VariableDeclarationList variableList = statement.variables;
List<VariableDeclaration> variables = variableList.variables;
expect(variables, hasLength(1));
- expect(variables[0].name2.lexeme, 'v');
+ expect(variables[0].name.lexeme, 'v');
expect(variableList.type, isGenericFunctionType);
}
@@ -1131,7 +1131,7 @@
VariableDeclarationList variableList = statement.variables;
List<VariableDeclaration> variables = variableList.variables;
expect(variables, hasLength(1));
- expect(variables[0].name2.lexeme, 'v');
+ expect(variables[0].name.lexeme, 'v');
expect(variableList.type, isGenericFunctionType);
}
@@ -1142,7 +1142,7 @@
VariableDeclarationList variableList = statement.variables;
List<VariableDeclaration> variables = variableList.variables;
expect(variables, hasLength(1));
- expect(variables[0].name2.lexeme, 'v');
+ expect(variables[0].name.lexeme, 'v');
expect(variableList.type, isGenericFunctionType);
}
@@ -1154,7 +1154,7 @@
VariableDeclarationList variableList = statement.variables;
List<VariableDeclaration> variables = variableList.variables;
expect(variables, hasLength(1));
- expect(variables[0].name2.lexeme, 'v');
+ expect(variables[0].name.lexeme, 'v');
expect(variableList.type, isGenericFunctionType);
}
@@ -1164,7 +1164,7 @@
VariableDeclarationList variableList = statement.variables;
List<VariableDeclaration> variables = variableList.variables;
expect(variables, hasLength(1));
- expect(variables[0].name2.lexeme, 'v');
+ expect(variables[0].name.lexeme, 'v');
var typeName = variableList.type as NamedType;
expect(typeName.name.name, 'C');
expect(typeName.typeArguments!.arguments, hasLength(1));
@@ -1179,7 +1179,7 @@
VariableDeclarationList variableList = statement.variables;
List<VariableDeclaration> variables = variableList.variables;
expect(variables, hasLength(1));
- expect(variables[0].name2.lexeme, 'v');
+ expect(variables[0].name.lexeme, 'v');
var typeName = variableList.type as NamedType;
expect(typeName.name.name, 'C');
expect(typeName.typeArguments!.arguments, hasLength(1));
@@ -1194,7 +1194,7 @@
VariableDeclarationList variableList = statement.variables;
List<VariableDeclaration> variables = variableList.variables;
expect(variables, hasLength(1));
- expect(variables[0].name2.lexeme, 'v');
+ expect(variables[0].name.lexeme, 'v');
var typeName = variableList.type as NamedType;
expect(typeName.name.name, 'C');
expect(typeName.typeArguments!.arguments, hasLength(1));
diff --git a/pkg/analyzer/test/generated/top_level_parser_test.dart b/pkg/analyzer/test/generated/top_level_parser_test.dart
index a628cb6..5cf20d3 100644
--- a/pkg/analyzer/test/generated/top_level_parser_test.dart
+++ b/pkg/analyzer/test/generated/top_level_parser_test.dart
@@ -119,7 +119,7 @@
expect(declaration.implementsClause, isNull);
expect(declaration.classKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -138,7 +138,7 @@
expect(declaration.implementsClause, isNull);
expect(declaration.classKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -157,7 +157,7 @@
expect(declaration.implementsClause, isNull);
expect(declaration.classKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -176,7 +176,7 @@
expect(declaration.implementsClause, isNotNull);
expect(declaration.classKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -192,7 +192,7 @@
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.classKeyword, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.typeParameters, isNull);
expect(declaration.extendsClause, isNotNull);
expect(declaration.withClause, isNotNull);
@@ -212,7 +212,7 @@
expect(declaration.documentationComment, isNull);
expect(declaration.abstractKeyword, isNull);
expect(declaration.classKeyword, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.typeParameters, isNull);
expect(declaration.extendsClause, isNotNull);
expect(declaration.withClause, isNotNull);
@@ -235,7 +235,7 @@
expect(declaration.implementsClause, isNotNull);
expect(declaration.classKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -377,7 +377,7 @@
expect(declaration.implementsClause, isNull);
expect(declaration.classKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.members, hasLength(1));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -391,7 +391,7 @@
expect(member, isClassTypeAlias);
var typeAlias = member as ClassTypeAlias;
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.implementsClause, isNotNull);
@@ -408,7 +408,7 @@
expect(member, isClassTypeAlias);
var typeAlias = member as ClassTypeAlias;
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.withClause.withKeyword, isNotNull);
@@ -430,7 +430,7 @@
expect(declaration.implementsClause, isNull);
expect(declaration.classKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNotNull);
@@ -652,7 +652,7 @@
assertNoErrors();
expect(member, isClassDeclaration);
var declaration = member as ClassDeclaration;
- expect(declaration.name2.lexeme, "A");
+ expect(declaration.name.lexeme, "A");
expect(declaration.members, hasLength(0));
}
@@ -663,7 +663,7 @@
assertNoErrors();
expect(member, isClassTypeAlias);
var declaration = member as ClassTypeAlias;
- expect(declaration.name2.lexeme, "A");
+ expect(declaration.name.lexeme, "A");
expect(declaration.abstractKeyword, isNotNull);
}
@@ -921,7 +921,7 @@
expect(member, isClassTypeAlias);
var typeAlias = member as ClassTypeAlias;
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2.lexeme, "C");
+ expect(typeAlias.name.lexeme, "C");
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNotNull);
@@ -939,7 +939,7 @@
expect(member, isClassTypeAlias);
var typeAlias = member as ClassTypeAlias;
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2.lexeme, "C");
+ expect(typeAlias.name.lexeme, "C");
expect(typeAlias.typeParameters!.typeParameters, hasLength(1));
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNull);
@@ -957,7 +957,7 @@
expect(member, isClassTypeAlias);
var typeAlias = member as ClassTypeAlias;
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2.lexeme, "C");
+ expect(typeAlias.name.lexeme, "C");
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNull);
@@ -975,7 +975,7 @@
expect(member, isClassTypeAlias);
var typeAlias = member as ClassTypeAlias;
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2.lexeme, "C");
+ expect(typeAlias.name.lexeme, "C");
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNull);
@@ -992,7 +992,7 @@
assertNoErrors();
expect(member, TypeMatcher<FunctionTypeAlias>());
var typeAlias = member as FunctionTypeAlias;
- expect(typeAlias.name2.lexeme, "F");
+ expect(typeAlias.name.lexeme, "F");
expect(typeAlias.parameters.parameters, hasLength(0));
}
@@ -1305,7 +1305,7 @@
expect(declaration.documentationComment, isNull);
expect(declaration.enumKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.constants, hasLength(1));
expect(declaration.rightBracket, isNotNull);
}
@@ -1318,7 +1318,7 @@
expect(declaration.documentationComment, isNull);
expect(declaration.enumKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.constants, hasLength(1));
expect(declaration.rightBracket, isNotNull);
}
@@ -1331,7 +1331,7 @@
expect(declaration.documentationComment, isNull);
expect(declaration.enumKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
expect(declaration.constants, hasLength(2));
expect(declaration.rightBracket, isNotNull);
}
@@ -1456,7 +1456,7 @@
assertNoErrors();
expectCommentText(declaration.documentationComment, '/// Doc');
expect((declaration.returnType as NamedType).name.name, 'T');
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
FunctionExpression expression = declaration.functionExpression;
expect(expression, isNotNull);
expect(expression.body, isNotNull);
@@ -1472,7 +1472,7 @@
assertNoErrors();
expectCommentText(declaration.documentationComment, '/// Doc');
expect((declaration.returnType as NamedType).name.name, 'T');
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
FunctionExpression expression = declaration.functionExpression;
expect(expression, isNotNull);
expect(expression.body, isNotNull);
@@ -1488,7 +1488,7 @@
assertNoErrors();
expectCommentText(declaration.documentationComment, '/// Doc');
expect((declaration.returnType as NamedType).name.name, 'T');
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
FunctionExpression expression = declaration.functionExpression;
expect(expression, isNotNull);
expect(expression.body, isNotNull);
@@ -1505,7 +1505,7 @@
assertNoErrors();
expect(declaration.documentationComment, isNull);
expect((declaration.returnType as NamedType).name.name, 'T');
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
FunctionExpression expression = declaration.functionExpression;
expect(expression, isNotNull);
expect(expression.body, isNotNull);
@@ -1566,7 +1566,7 @@
assertNoErrors();
expectCommentText(declaration.documentationComment, '/// Doc');
expect((declaration.returnType as NamedType).name.name, 'T');
- expect(declaration.name2, isNotNull);
+ expect(declaration.name, isNotNull);
FunctionExpression expression = declaration.functionExpression;
expect(expression, isNotNull);
expect(expression.body, isNotNull);
@@ -1580,8 +1580,8 @@
var alias = parseFullCompilationUnitMember() as GenericTypeAlias;
expect(alias, isNotNull);
assertNoErrors();
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters, isNull);
expect(alias.equals, isNotNull);
expect(alias.functionType, isNotNull);
@@ -1593,8 +1593,8 @@
var alias = parseFullCompilationUnitMember() as GenericTypeAlias;
expect(alias, isNotNull);
assertNoErrors();
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters!.typeParameters, hasLength(1));
expect(alias.equals, isNotNull);
expect(alias.functionType, isNotNull);
@@ -1608,8 +1608,8 @@
var alias = parseFullCompilationUnitMember() as GenericTypeAlias;
expect(alias, isNotNull);
assertNoErrors();
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters!.typeParameters, hasLength(1));
expect(alias.equals, isNotNull);
expect(alias.functionType, isNotNull);
@@ -1621,8 +1621,8 @@
var alias = parseFullCompilationUnitMember() as GenericTypeAlias;
expect(alias, isNotNull);
assertNoErrors();
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters!.typeParameters, hasLength(3));
expect(alias.equals, isNotNull);
expect(alias.functionType, isNotNull);
@@ -1636,8 +1636,8 @@
var alias = parseFullCompilationUnitMember() as GenericTypeAlias;
expect(alias, isNotNull);
assertNoErrors();
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters!.typeParameters, hasLength(3));
expect(alias.equals, isNotNull);
expect(alias.functionType, isNotNull);
@@ -1649,8 +1649,8 @@
var alias = parseFullCompilationUnitMember() as GenericTypeAlias;
expect(alias, isNotNull);
assertNoErrors();
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters!.typeParameters, hasLength(3));
TypeParameter typeParam = alias.typeParameters!.typeParameters[2];
var type = typeParam.bound as NamedType;
@@ -1666,8 +1666,8 @@
var alias = parseFullCompilationUnitMember() as GenericTypeAlias;
expect(alias, isNotNull);
assertNoErrors();
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters!.typeParameters, hasLength(3));
TypeParameter typeParam = alias.typeParameters!.typeParameters[2];
var type = typeParam.bound as NamedType;
@@ -1684,8 +1684,8 @@
var alias = parseFullCompilationUnitMember() as GenericTypeAlias;
expect(alias, isNotNull);
assertNoErrors();
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters!.typeParameters, hasLength(3));
TypeParameter typeParam = alias.typeParameters!.typeParameters[2];
var type = typeParam.bound as NamedType;
@@ -1702,8 +1702,8 @@
var alias = parseFullCompilationUnitMember() as GenericTypeAlias;
expect(alias, isNotNull);
assertNoErrors();
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters!.typeParameters, hasLength(3));
TypeParameter typeParam = alias.typeParameters!.typeParameters[2];
var type = typeParam.bound as NamedType;
@@ -1721,11 +1721,11 @@
assertErrors(errors: [
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 11, 1),
]);
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters, isNotNull);
expect(alias.typeParameters!.typeParameters.length, 1);
- expect(alias.typeParameters!.typeParameters.single.name2.lexeme, '');
+ expect(alias.typeParameters!.typeParameters.single.name.lexeme, '');
expect(alias.equals, isNotNull);
expect(alias.functionType, isNotNull);
expect(alias.semicolon, isNotNull);
@@ -1739,11 +1739,11 @@
assertErrors(errors: [
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 10, 2),
]);
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters, isNotNull);
expect(alias.typeParameters!.typeParameters.length, 1);
- expect(alias.typeParameters!.typeParameters.single.name2.lexeme, '');
+ expect(alias.typeParameters!.typeParameters.single.name.lexeme, '');
expect(alias.equals, isNotNull);
expect(alias.functionType, isNotNull);
expect(alias.semicolon, isNotNull);
@@ -1757,11 +1757,11 @@
assertErrors(errors: [
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 10, 1),
]);
- expect(alias.name2, isNotNull);
- expect(alias.name2.lexeme, 'F');
+ expect(alias.name, isNotNull);
+ expect(alias.name.lexeme, 'F');
expect(alias.typeParameters, isNotNull);
expect(alias.typeParameters!.typeParameters.length, 1);
- expect(alias.typeParameters!.typeParameters.single.name2.lexeme, '');
+ expect(alias.typeParameters!.typeParameters.single.name.lexeme, '');
expect(alias.equals, isNotNull);
expect(alias.functionType, isNotNull);
expect(alias.semicolon, isNotNull);
@@ -1919,7 +1919,7 @@
expect(declaration.implementsClause, isNull);
expect(declaration.mixinKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2.lexeme, 'A');
+ expect(declaration.name.lexeme, 'A');
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -1941,7 +1941,7 @@
expect(interfaces[0].typeArguments, isNull);
expect(declaration.mixinKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2.lexeme, 'A');
+ expect(declaration.name.lexeme, 'A');
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -1965,7 +1965,7 @@
expect(interfaces[1].typeArguments, isNull);
expect(declaration.mixinKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2.lexeme, 'A');
+ expect(declaration.name.lexeme, 'A');
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -1984,7 +1984,7 @@
expect(declaration.implementsClause, isNull);
expect(declaration.mixinKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2.lexeme, 'A');
+ expect(declaration.name.lexeme, 'A');
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -2006,7 +2006,7 @@
expect(declaration.implementsClause, isNull);
expect(declaration.mixinKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2.lexeme, 'A');
+ expect(declaration.name.lexeme, 'A');
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -2030,7 +2030,7 @@
expect(declaration.implementsClause, isNull);
expect(declaration.mixinKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2.lexeme, 'A');
+ expect(declaration.name.lexeme, 'A');
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -2057,7 +2057,7 @@
expect(interfaces[0].typeArguments, isNull);
expect(declaration.mixinKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2.lexeme, 'A');
+ expect(declaration.name.lexeme, 'A');
expect(declaration.members, hasLength(0));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -2080,7 +2080,7 @@
expect(declaration.implementsClause, isNull);
expect(declaration.mixinKeyword, isNotNull);
expect(declaration.leftBracket, isNotNull);
- expect(declaration.name2.lexeme, 'A');
+ expect(declaration.name.lexeme, 'A');
expect(declaration.members, hasLength(4));
expect(declaration.rightBracket, isNotNull);
expect(declaration.typeParameters, isNull);
@@ -2209,7 +2209,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
expect(typeAlias.returnType, isNotNull);
expect(typeAlias.semicolon, isNotNull);
@@ -2222,7 +2222,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
expect(typeAlias.returnType, isNull);
expect(typeAlias.semicolon, isNotNull);
@@ -2235,7 +2235,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
expect(typeAlias.returnType, isNotNull);
expect(typeAlias.semicolon, isNotNull);
@@ -2248,7 +2248,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
expect(typeAlias.returnType, isNotNull);
expect(typeAlias.semicolon, isNotNull);
@@ -2261,7 +2261,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
expect(typeAlias.returnType, isNotNull);
expect(typeAlias.semicolon, isNotNull);
@@ -2274,7 +2274,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.parameters, isNotNull);
expect(typeAlias.returnType, isNotNull);
expect(typeAlias.semicolon, isNotNull);
@@ -2287,7 +2287,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
@@ -2303,7 +2303,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
@@ -2319,7 +2319,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
@@ -2335,7 +2335,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
@@ -2351,7 +2351,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
@@ -2367,7 +2367,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNotNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
@@ -2383,7 +2383,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNotNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
@@ -2400,7 +2400,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNotNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
@@ -2416,7 +2416,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNotNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
@@ -2432,7 +2432,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNotNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
@@ -2448,7 +2448,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNotNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
@@ -2464,7 +2464,7 @@
expect(typeAlias, isNotNull);
assertNoErrors();
expect(typeAlias.typedefKeyword, isNotNull);
- expect(typeAlias.name2, isNotNull);
+ expect(typeAlias.name, isNotNull);
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.semicolon, isNotNull);
var functionType = typeAlias.functionType as GenericFunctionType;
diff --git a/pkg/analyzer/test/generated/variance_parser_test.dart b/pkg/analyzer/test/generated/variance_parser_test.dart
index 358a867..82be47c 100644
--- a/pkg/analyzer/test/generated/variance_parser_test.dart
+++ b/pkg/analyzer/test/generated/variance_parser_test.dart
@@ -64,14 +64,14 @@
var unit = parseCompilationUnit('class A<in T, inout U, out V, W> { }');
expect(unit.declarations, hasLength(1));
var classDecl = unit.declarations[0] as ClassDeclaration;
- expect(classDecl.name2.lexeme, 'A');
+ expect(classDecl.name.lexeme, 'A');
var typeParameters = classDecl.typeParameters!;
expect(typeParameters.typeParameters, hasLength(4));
- expect(typeParameters.typeParameters[0].name2.lexeme, 'T');
- expect(typeParameters.typeParameters[1].name2.lexeme, 'U');
- expect(typeParameters.typeParameters[2].name2.lexeme, 'V');
- expect(typeParameters.typeParameters[3].name2.lexeme, 'W');
+ expect(typeParameters.typeParameters[0].name.lexeme, 'T');
+ expect(typeParameters.typeParameters[1].name.lexeme, 'U');
+ expect(typeParameters.typeParameters[2].name.lexeme, 'V');
+ expect(typeParameters.typeParameters[3].name.lexeme, 'W');
var typeParameterImplList = typeParameters.typeParameters;
expect((typeParameterImplList[0] as TypeParameterImpl).varianceKeyword,
@@ -100,22 +100,22 @@
]);
expect(unit.declarations, hasLength(1));
var classDecl = unit.declarations[0] as ClassDeclaration;
- expect(classDecl.name2.lexeme, 'A');
+ expect(classDecl.name.lexeme, 'A');
var typeParameters = classDecl.typeParameters!;
expect(typeParameters.typeParameters, hasLength(1));
- expect(typeParameters.typeParameters[0].name2.lexeme, 'T');
+ expect(typeParameters.typeParameters[0].name.lexeme, 'T');
}
void test_class_enabled_single() {
var unit = parseCompilationUnit('class A<in T> { }');
expect(unit.declarations, hasLength(1));
var classDecl = unit.declarations[0] as ClassDeclaration;
- expect(classDecl.name2.lexeme, 'A');
+ expect(classDecl.name.lexeme, 'A');
var typeParameters = classDecl.typeParameters!;
expect(typeParameters.typeParameters, hasLength(1));
- expect(typeParameters.typeParameters[0].name2.lexeme, 'T');
+ expect(typeParameters.typeParameters[0].name.lexeme, 'T');
var typeParameterImpl =
typeParameters.typeParameters[0] as TypeParameterImpl;
@@ -175,11 +175,11 @@
var unit = parseCompilationUnit('mixin A<inout T> { }');
expect(unit.declarations, hasLength(1));
var mixinDecl = unit.declarations[0] as MixinDeclaration;
- expect(mixinDecl.name2.lexeme, 'A');
+ expect(mixinDecl.name.lexeme, 'A');
var typeParameters = mixinDecl.typeParameters!;
expect(typeParameters.typeParameters, hasLength(1));
- expect(typeParameters.typeParameters[0].name2.lexeme, 'T');
+ expect(typeParameters.typeParameters[0].name.lexeme, 'T');
}
void test_typedef_disabled() {
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
index 48c15e0..5641fe57 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
@@ -7025,7 +7025,7 @@
assertType(node.declaredElement2!.type, 'C Function(int)');
expect(node.returnType.staticElement, same(cElement));
expect(node.returnType.staticType, isNull);
- expect(node.name2, isNull);
+ expect(node.name, isNull);
}
// named constructor
@@ -8526,7 +8526,7 @@
List<Statement> _getMainStatements(ResolvedUnitResult result) {
for (var declaration in result.unit.declarations) {
if (declaration is FunctionDeclaration &&
- declaration.name2.lexeme == 'main') {
+ declaration.name.lexeme == 'main') {
var body = declaration.functionExpression.body as BlockFunctionBody;
return body.block.statements;
}
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 522fc5d..9ff9122 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -3531,7 +3531,7 @@
ClassDeclaration _getClass(CompilationUnit unit, String name) {
for (CompilationUnitMember declaration in unit.declarations) {
if (declaration is ClassDeclaration) {
- if (declaration.name2.lexeme == name) {
+ if (declaration.name.lexeme == name) {
return declaration;
}
}
@@ -3545,7 +3545,7 @@
for (ClassMember declaration in classDeclaration.members) {
if (declaration is FieldDeclaration) {
for (var field in declaration.fields.variables) {
- if (field.name2.lexeme == fieldName) {
+ if (field.name.lexeme == fieldName) {
return field;
}
}
@@ -3559,7 +3559,7 @@
ClassDeclaration classDeclaration = _getClass(unit, className);
for (ClassMember declaration in classDeclaration.members) {
if (declaration is MethodDeclaration &&
- declaration.name2.lexeme == methodName) {
+ declaration.name.lexeme == methodName) {
return declaration;
}
}
@@ -3581,7 +3581,7 @@
for (CompilationUnitMember declaration in unit.declarations) {
if (declaration is TopLevelVariableDeclaration) {
for (VariableDeclaration variable in declaration.variables.variables) {
- if (variable.name2.lexeme == name) {
+ if (variable.name.lexeme == name) {
return variable;
}
}
diff --git a/pkg/analyzer/test/src/dart/analysis/results/get_element_declaration_test.dart b/pkg/analyzer/test/src/dart/analysis/results/get_element_declaration_test.dart
index 7000d88..9110f3f 100644
--- a/pkg/analyzer/test/src/dart/analysis/results/get_element_declaration_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/results/get_element_declaration_test.dart
@@ -28,7 +28,7 @@
var element = findNode.classDeclaration('A').declaredElement2!;
var result = await getElementDeclaration(element);
var node = result!.node as ClassDeclaration;
- expect(node.name2.lexeme, 'A');
+ expect(node.name.lexeme, 'A');
}
test_class_duplicate() async {
@@ -40,9 +40,9 @@
var element = findNode.classDeclaration('A {} // 1').declaredElement2!;
var result = await getElementDeclaration(element);
var node = result!.node as ClassDeclaration;
- expect(node.name2.lexeme, 'A');
+ expect(node.name.lexeme, 'A');
expect(
- node.name2.offset,
+ node.name.offset,
this.result.content.indexOf('A {} // 1'),
);
}
@@ -51,9 +51,9 @@
var element = findNode.classDeclaration('A {} // 2').declaredElement2!;
var result = await getElementDeclaration(element);
var node = result!.node as ClassDeclaration;
- expect(node.name2.lexeme, 'A');
+ expect(node.name.lexeme, 'A');
expect(
- node.name2.offset,
+ node.name.offset,
this.result.content.indexOf('A {} // 2'),
);
}
@@ -71,7 +71,7 @@
var element = library.getClass('A')!;
var result = await getElementDeclaration(element);
var node = result!.node as ClassDeclaration;
- expect(node.name2.lexeme, 'A');
+ expect(node.name.lexeme, 'A');
}
test_class_missingName() async {
@@ -81,8 +81,8 @@
var element = findNode.classDeclaration('class {}').declaredElement2!;
var result = await getElementDeclaration(element);
var node = result!.node as ClassDeclaration;
- expect(node.name2.lexeme, '');
- expect(node.name2.offset, 6);
+ expect(node.name.lexeme, '');
+ expect(node.name.offset, 6);
}
test_classTypeAlias() async {
@@ -94,7 +94,7 @@
var element = findElement.class_('B');
var result = await getElementDeclaration(element);
var node = result!.node as ClassTypeAlias;
- expect(node.name2.lexeme, 'B');
+ expect(node.name.lexeme, 'B');
}
test_compilationUnit() async {
@@ -115,14 +115,14 @@
var unnamed = findNode.constructor('A();').declaredElement2!;
var result = await getElementDeclaration(unnamed);
var node = result!.node as ConstructorDeclaration;
- expect(node.name2, isNull);
+ expect(node.name, isNull);
}
{
var named = findNode.constructor('A.named();').declaredElement2!;
var result = await getElementDeclaration(named);
var node = result!.node as ConstructorDeclaration;
- expect(node.name2!.lexeme, 'named');
+ expect(node.name!.lexeme, 'named');
}
}
@@ -137,9 +137,9 @@
var element = findNode.constructor('A.named(); // 1').declaredElement2!;
var result = await getElementDeclaration(element);
var node = result!.node as ConstructorDeclaration;
- expect(node.name2!.lexeme, 'named');
+ expect(node.name!.lexeme, 'named');
expect(
- node.name2!.offset,
+ node.name!.offset,
this.result.content.indexOf('named(); // 1'),
);
}
@@ -148,9 +148,9 @@
var element = findNode.constructor('A.named(); // 2').declaredElement2!;
var result = await getElementDeclaration(element);
var node = result!.node as ConstructorDeclaration;
- expect(node.name2!.lexeme, 'named');
+ expect(node.name!.lexeme, 'named');
expect(
- node.name2!.offset,
+ node.name!.offset,
this.result.content.indexOf('named(); // 2'),
);
}
@@ -167,7 +167,7 @@
var element = findNode.constructor('A(); // 1').declaredElement2!;
var result = await getElementDeclaration(element);
var node = result!.node as ConstructorDeclaration;
- expect(node.name2, isNull);
+ expect(node.name, isNull);
expect(
node.returnType.offset,
this.result.content.indexOf('A(); // 1'),
@@ -178,7 +178,7 @@
var element = findNode.constructor('A(); // 2').declaredElement2!;
var result = await getElementDeclaration(element);
var node = result!.node as ConstructorDeclaration;
- expect(node.name2, isNull);
+ expect(node.name, isNull);
expect(
node.returnType.offset,
this.result.content.indexOf('A(); // 2'),
@@ -204,7 +204,7 @@
var element = findElement.enum_('MyEnum');
var result = await getElementDeclaration(element);
var node = result!.node as EnumDeclaration;
- expect(node.name2.lexeme, 'MyEnum');
+ expect(node.name.lexeme, 'MyEnum');
}
test_enum_constant() async {
@@ -214,7 +214,7 @@
var element = findElement.field('a');
var result = await getElementDeclaration(element);
var node = result!.node as EnumConstantDeclaration;
- expect(node.name2.lexeme, 'a');
+ expect(node.name.lexeme, 'a');
}
test_extension() async {
@@ -224,7 +224,7 @@
var element = findNode.extensionDeclaration('E').declaredElement2!;
var result = await getElementDeclaration(element);
var node = result!.node as ExtensionDeclaration;
- expect(node.name2!.lexeme, 'E');
+ expect(node.name!.lexeme, 'E');
}
test_field() async {
@@ -237,7 +237,7 @@
var result = await getElementDeclaration(element);
var node = result!.node as VariableDeclaration;
- expect(node.name2.lexeme, 'foo');
+ expect(node.name.lexeme, 'foo');
}
test_functionDeclaration_local() async {
@@ -250,7 +250,7 @@
var result = await getElementDeclaration(element);
var node = result!.node as FunctionDeclaration;
- expect(node.name2.lexeme, 'foo');
+ expect(node.name.lexeme, 'foo');
}
test_functionDeclaration_top() async {
@@ -261,7 +261,7 @@
var result = await getElementDeclaration(element);
var node = result!.node as FunctionDeclaration;
- expect(node.name2.lexeme, 'foo');
+ expect(node.name.lexeme, 'foo');
}
test_genericFunctionTypeElement() async {
@@ -282,7 +282,7 @@
var element = findElement.getter('x');
var result = await getElementDeclaration(element);
var node = result!.node as MethodDeclaration;
- expect(node.name2.lexeme, 'x');
+ expect(node.name.lexeme, 'x');
expect(node.isGetter, isTrue);
}
@@ -293,7 +293,7 @@
var element = findElement.topGet('x');
var result = await getElementDeclaration(element);
var node = result!.node as FunctionDeclaration;
- expect(node.name2.lexeme, 'x');
+ expect(node.name.lexeme, 'x');
expect(node.isGetter, isTrue);
}
@@ -316,7 +316,7 @@
var result = await getElementDeclaration(element);
var node = result!.node as VariableDeclaration;
- expect(node.name2.lexeme, 'foo');
+ expect(node.name.lexeme, 'foo');
}
test_method() async {
@@ -329,7 +329,7 @@
var result = await getElementDeclaration(element);
var node = result!.node as MethodDeclaration;
- expect(node.name2.lexeme, 'foo');
+ expect(node.name.lexeme, 'foo');
}
test_mixin() async {
@@ -339,7 +339,7 @@
var element = findElement.mixin('M');
var result = await getElementDeclaration(element);
var node = result!.node as MixinDeclaration;
- expect(node.name2.lexeme, 'M');
+ expect(node.name.lexeme, 'M');
}
test_parameter() async {
@@ -390,7 +390,7 @@
var element = findElement.setter('x');
var result = await getElementDeclaration(element);
var node = result!.node as MethodDeclaration;
- expect(node.name2.lexeme, 'x');
+ expect(node.name.lexeme, 'x');
expect(node.isSetter, isTrue);
}
@@ -401,7 +401,7 @@
var element = findElement.topSet('x');
var result = await getElementDeclaration(element);
var node = result!.node as FunctionDeclaration;
- expect(node.name2.lexeme, 'x');
+ expect(node.name.lexeme, 'x');
expect(node.isSetter, isTrue);
}
@@ -413,7 +413,7 @@
var result = await getElementDeclaration(element);
var node = result!.node as VariableDeclaration;
- expect(node.name2.lexeme, 'foo');
+ expect(node.name.lexeme, 'foo');
}
test_topLevelVariable_synthetic() async {
diff --git a/pkg/analyzer/test/src/dart/analysis/session_helper_test.dart b/pkg/analyzer/test/src/dart/analysis/session_helper_test.dart
index 75bf51f..1d71060 100644
--- a/pkg/analyzer/test/src/dart/analysis/session_helper_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/session_helper_test.dart
@@ -81,7 +81,7 @@
var element = findElement.class_('A');
var result = (await helper.getElementDeclaration(element))!;
var node = result.node as ClassDeclaration;
- expect(node.name2.lexeme, 'A');
+ expect(node.name.lexeme, 'A');
}
test_getResolvedUnitByElement() async {
diff --git a/pkg/analyzer/test/src/dart/analysis/session_test.dart b/pkg/analyzer/test/src/dart/analysis/session_test.dart
index 2a482d9..975a905 100644
--- a/pkg/analyzer/test/src/dart/analysis/session_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/session_test.dart
@@ -329,7 +329,7 @@
var element = libraryResult.element.getClass('A')!;
var declaration = parsedLibrary.getElementDeclaration(element)!;
var node = declaration.node as ClassDeclaration;
- expect(node.name2.lexeme, 'A');
+ expect(node.name.lexeme, 'A');
expect(node.offset, 0);
expect(node.length, 10);
}
@@ -365,7 +365,7 @@
// We can get the variable element declaration.
var fooDeclaration = parsedLibrary.getElementDeclaration(fooElement)!;
var fooNode = fooDeclaration.node as VariableDeclaration;
- expect(fooNode.name2.lexeme, 'foo');
+ expect(fooNode.name.lexeme, 'foo');
expect(fooNode.offset, 4);
expect(fooNode.length, 7);
@@ -592,14 +592,14 @@
var aDeclaration = resolvedLibrary.getElementDeclaration(aClass)!;
var aNode = aDeclaration.node as ClassDeclaration;
- expect(aNode.name2.lexeme, 'A');
+ expect(aNode.name.lexeme, 'A');
expect(aNode.offset, 16);
expect(aNode.length, 16);
expect(aNode.declaredElement2!.name, 'A');
var bDeclaration = resolvedLibrary.getElementDeclaration(bClass)!;
var bNode = bDeclaration.node as ClassDeclaration;
- expect(bNode.name2.lexeme, 'B');
+ expect(bNode.name.lexeme, 'B');
expect(bNode.offset, 19);
expect(bNode.length, 16);
expect(bNode.declaredElement2!.name, 'B');
@@ -632,7 +632,7 @@
// We can get the variable element declaration.
var fooDeclaration = resolvedLibrary.getElementDeclaration(fooElement)!;
var fooNode = fooDeclaration.node as VariableDeclaration;
- expect(fooNode.name2.lexeme, 'foo');
+ expect(fooNode.name.lexeme, 'foo');
expect(fooNode.offset, 4);
expect(fooNode.length, 7);
expect(fooNode.declaredElement2!.name, 'foo');
diff --git a/pkg/analyzer/test/src/fasta/message_coverage_test.dart b/pkg/analyzer/test/src/fasta/message_coverage_test.dart
index 3c3c34d..ca0f350a 100644
--- a/pkg/analyzer/test/src/fasta/message_coverage_test.dart
+++ b/pkg/analyzer/test/src/fasta/message_coverage_test.dart
@@ -66,7 +66,7 @@
var astBuilder = unit.declarations[0] as ClassDeclaration;
var method = astBuilder.members
.whereType<MethodDeclaration>()
- .firstWhere((x) => x.name2.lexeme == 'reportMessage');
+ .firstWhere((x) => x.name.lexeme == 'reportMessage');
SwitchStatement statement = (method.body as BlockFunctionBody)
.block
.statements
diff --git a/pkg/analyzer/test/util/id_testing_helper.dart b/pkg/analyzer/test/util/id_testing_helper.dart
index 27d9ac8..46bb47d 100644
--- a/pkg/analyzer/test/util/id_testing_helper.dart
+++ b/pkg/analyzer/test/util/id_testing_helper.dart
@@ -213,20 +213,20 @@
if (className != null) {
for (var declaration in unit.declarations) {
if (declaration is ClassDeclaration &&
- declaration.name2.lexeme == className) {
+ declaration.name.lexeme == className) {
for (var member in declaration.members) {
if (member is ConstructorDeclaration) {
- if (member.name2!.lexeme == name) {
+ if (member.name!.lexeme == name) {
return member.offset;
}
} else if (member is FieldDeclaration) {
for (var variable in member.fields.variables) {
- if (variable.name2.lexeme == name) {
+ if (variable.name.lexeme == name) {
return variable.offset;
}
}
} else if (member is MethodDeclaration) {
- if (member.name2.lexeme == name) {
+ if (member.name.lexeme == name) {
return member.offset;
}
}
@@ -239,12 +239,12 @@
}
for (var declaration in unit.declarations) {
if (declaration is FunctionDeclaration) {
- if (declaration.name2.lexeme == name) {
+ if (declaration.name.lexeme == name) {
return declaration.offset;
}
} else if (declaration is TopLevelVariableDeclaration) {
for (var variable in declaration.variables.variables) {
- if (variable.name2.lexeme == name) {
+ if (variable.name.lexeme == name) {
return variable.offset;
}
}
@@ -258,7 +258,7 @@
.unit;
for (var declaration in unit.declarations) {
if (declaration is ClassDeclaration &&
- declaration.name2.lexeme == className) {
+ declaration.name.lexeme == className) {
return declaration.offset;
}
}
diff --git a/pkg/analyzer/test/utils.dart b/pkg/analyzer/test/utils.dart
index 6939069..ab71efb 100644
--- a/pkg/analyzer/test/utils.dart
+++ b/pkg/analyzer/test/utils.dart
@@ -31,7 +31,7 @@
NodeList<CompilationUnitMember> unitMembers = unit.declarations;
for (CompilationUnitMember unitMember in unitMembers) {
if (unitMember is ClassDeclaration &&
- unitMember.name2.lexeme == className) {
+ unitMember.name.lexeme == className) {
return unitMember;
}
}
@@ -48,7 +48,7 @@
NodeList<ClassMember> classMembers = unitMember.members;
for (ClassMember classMember in classMembers) {
if (classMember is ConstructorDeclaration) {
- if (classMember.name2?.lexeme == constructorName) {
+ if (classMember.name?.lexeme == constructorName) {
return classMember;
}
}
@@ -66,7 +66,7 @@
if (classMember is FieldDeclaration) {
NodeList<VariableDeclaration> fields = classMember.fields.variables;
for (VariableDeclaration field in fields) {
- if (field.name2.lexeme == fieldName) {
+ if (field.name.lexeme == fieldName) {
return field;
}
}
@@ -91,7 +91,7 @@
NodeList<ClassMember> classMembers = unitMember.members;
for (ClassMember classMember in classMembers) {
if (classMember is MethodDeclaration) {
- if (classMember.name2.lexeme == methodName) {
+ if (classMember.name.lexeme == methodName) {
return classMember;
}
}
@@ -125,7 +125,7 @@
NodeList<CompilationUnitMember> unitMembers = unit.declarations;
for (CompilationUnitMember unitMember in unitMembers) {
if (unitMember is FunctionDeclaration) {
- if (unitMember.name2.lexeme == functionName) {
+ if (unitMember.name.lexeme == functionName) {
return unitMember;
}
}
@@ -143,7 +143,7 @@
NodeList<VariableDeclaration> variables =
unitMember.variables.variables;
for (VariableDeclaration variable in variables) {
- if (variable.name2.lexeme == variableName) {
+ if (variable.name.lexeme == variableName) {
return variable;
}
}
diff --git a/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart b/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart
index 7f1c6fb..4925e49 100644
--- a/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart
+++ b/pkg/analyzer/tool/messages/extract_errors_to_yaml.dart
@@ -173,11 +173,11 @@
.unit;
for (var declaration in unit.declarations) {
if (declaration is! ClassDeclaration) continue;
- var className = declaration.name2.lexeme;
+ var className = declaration.name.lexeme;
for (var member in declaration.members) {
if (member is! FieldDeclaration) continue;
for (var variable in member.fields.variables) {
- (result[className] ??= {})[variable.name2.lexeme] = variable;
+ (result[className] ??= {})[variable.name.lexeme] = variable;
}
}
}
diff --git a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
index 56b8754..4013e60 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
@@ -628,7 +628,7 @@
// class A { static late ^ }
if (node.staticKeyword != null &&
variables.length == 1 &&
- variables[0].name2.lexeme == 'late') {
+ variables[0].name.lexeme == 'late') {
optype.completionLocation = 'FieldDeclaration_static_late';
optype.includeTypeNameSuggestions = true;
return;
@@ -637,7 +637,7 @@
if (node.staticKeyword == null &&
offset <= node.semicolon.offset &&
variables.length == 1 &&
- variables[0].name2.lexeme == 'static') {
+ variables[0].name.lexeme == 'static') {
optype.completionLocation = 'FieldDeclaration_static';
optype.includeTypeNameSuggestions = true;
return;
@@ -806,7 +806,7 @@
@override
void visitFunctionDeclaration(FunctionDeclaration node) {
if (identical(entity, node.returnType) ||
- identical(entity, node.name2) && node.returnType == null) {
+ identical(entity, node.name) && node.returnType == null) {
optype.completionLocation = 'FunctionDeclaration_returnType';
optype.includeTypeNameSuggestions = true;
}
@@ -821,7 +821,7 @@
@override
void visitFunctionTypeAlias(FunctionTypeAlias node) {
if (identical(entity, node.returnType) ||
- identical(entity, node.name2) && node.returnType == null) {
+ identical(entity, node.name) && node.returnType == null) {
optype.includeTypeNameSuggestions = true;
}
}
@@ -948,7 +948,7 @@
@override
void visitMethodDeclaration(MethodDeclaration node) {
if (identical(entity, node.returnType) ||
- identical(entity, node.name2) && node.returnType == null) {
+ identical(entity, node.name) && node.returnType == null) {
optype.completionLocation = 'MethodDeclaration_returnType';
}
// TODO(brianwilkerson) In visitFunctionDeclaration, this is conditional. It
diff --git a/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart b/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart
index 7af1d92..e99259d 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart
@@ -132,7 +132,7 @@
} else if (forLoopParts is ForPartsWithDeclarations) {
var varList = forLoopParts.variables;
for (var varDecl in varList.variables) {
- declaredLocalVar(varDecl.name2, varList.type,
+ declaredLocalVar(varDecl.name, varList.type,
varDecl.declaredElement2 as LocalVariableElement);
}
}
@@ -149,7 +149,7 @@
} else if (forLoopParts is ForPartsWithDeclarations) {
var varList = forLoopParts.variables;
for (var varDecl in varList.variables) {
- declaredLocalVar(varDecl.name2, varList.type,
+ declaredLocalVar(varDecl.name, varList.type,
varDecl.declaredElement2 as LocalVariableElement);
}
}
@@ -322,14 +322,14 @@
var varList = stmt.variables;
for (var varDecl in varList.variables) {
if (varDecl.end < offset) {
- declaredLocalVar(varDecl.name2, varList.type,
+ declaredLocalVar(varDecl.name, varList.type,
varDecl.declaredElement2 as LocalVariableElement);
}
}
} else if (stmt is FunctionDeclarationStatement) {
var declaration = stmt.functionDeclaration;
if (declaration.offset < offset) {
- var name = declaration.name2.lexeme;
+ var name = declaration.name.lexeme;
if (name.isNotEmpty) {
declaredFunction(declaration);
_visitTypeParameters(
diff --git a/pkg/analyzer_plugin/lib/utilities/completion/type_member_contributor.dart b/pkg/analyzer_plugin/lib/utilities/completion/type_member_contributor.dart
index 151d387..577ad0e 100644
--- a/pkg/analyzer_plugin/lib/utilities/completion/type_member_contributor.dart
+++ b/pkg/analyzer_plugin/lib/utilities/completion/type_member_contributor.dart
@@ -106,7 +106,7 @@
// the most likely completion is a super expression with same name
var containingMethod =
expression.thisOrAncestorOfType<MethodDeclaration>();
- var id = containingMethod?.name2;
+ var id = containingMethod?.name;
if (id != null) {
containingMethodName = id.lexeme;
}
@@ -140,7 +140,7 @@
@override
void declaredClass(ClassDeclaration declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
// no type
finished();
}
@@ -148,7 +148,7 @@
@override
void declaredClassTypeAlias(ClassTypeAlias declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
// no type
finished();
}
@@ -159,7 +159,7 @@
@override
void declaredField(FieldDeclaration fieldDecl, VariableDeclaration varDecl) {
- if (varDecl.name2.lexeme == targetName) {
+ if (varDecl.name.lexeme == targetName) {
// Type provided by the element in computeFull above
finished();
}
@@ -167,7 +167,7 @@
@override
void declaredFunction(FunctionDeclaration declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
var typeName = declaration.returnType;
if (typeName != null) {
typeFound = typeName.type;
@@ -178,7 +178,7 @@
@override
void declaredFunctionTypeAlias(FunctionTypeAlias declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
var typeName = declaration.returnType;
if (typeName != null) {
typeFound = typeName.type;
@@ -189,7 +189,7 @@
@override
void declaredGenericTypeAlias(GenericTypeAlias declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
var typeName = declaration.functionType?.returnType;
if (typeName != null) {
typeFound = typeName.type;
@@ -220,7 +220,7 @@
@override
void declaredMethod(MethodDeclaration declaration) {
- if (declaration.name2.lexeme == targetName) {
+ if (declaration.name.lexeme == targetName) {
var typeName = declaration.returnType;
if (typeName != null) {
typeFound = typeName.type;
@@ -240,7 +240,7 @@
@override
void declaredTopLevelVar(
VariableDeclarationList varList, VariableDeclaration varDecl) {
- if (varDecl.name2.lexeme == targetName) {
+ if (varDecl.name.lexeme == targetName) {
// Type provided by the element in computeFull above
finished();
}
diff --git a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
index df63a67..78540c4 100644
--- a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
+++ b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
@@ -186,7 +186,7 @@
@override
void visitClassDeclaration(ClassDeclaration node) {
- computer._addRegionForToken(node.name2, node.declaredElement2);
+ computer._addRegionForToken(node.name, node.declaredElement2);
super.visitClassDeclaration(node);
}
@@ -279,7 +279,7 @@
void visitConstructorDeclaration(ConstructorDeclaration node) {
// For a default constructor, override the class name to be the declaration
// itself rather than linking to the class.
- var nameToken = node.name2;
+ var nameToken = node.name;
if (nameToken == null) {
computer._addRegionForNode(node.returnType, node.declaredElement2);
} else {
@@ -337,7 +337,7 @@
@override
void visitEnumConstantDeclaration(EnumConstantDeclaration node) {
- computer._addRegionForToken(node.name2, node.constructorElement);
+ computer._addRegionForToken(node.name, node.constructorElement);
var arguments = node.arguments;
if (arguments != null) {
@@ -375,7 +375,7 @@
@override
void visitFunctionDeclaration(FunctionDeclaration node) {
- computer._addRegionForToken(node.name2, node.declaredElement2);
+ computer._addRegionForToken(node.name, node.declaredElement2);
super.visitFunctionDeclaration(node);
}
@@ -404,7 +404,7 @@
@override
void visitMethodDeclaration(MethodDeclaration node) {
- computer._addRegionForToken(node.name2, node.declaredElement2);
+ computer._addRegionForToken(node.name, node.declaredElement2);
super.visitMethodDeclaration(node);
}
@@ -508,13 +508,13 @@
@override
void visitTypeParameter(TypeParameter node) {
- computer._addRegionForToken(node.name2, node.declaredElement2);
+ computer._addRegionForToken(node.name, node.declaredElement2);
super.visitTypeParameter(node);
}
@override
void visitVariableDeclaration(VariableDeclaration node) {
- computer._addRegionForToken(node.name2, node.declaredElement2);
+ computer._addRegionForToken(node.name, node.declaredElement2);
super.visitVariableDeclaration(node);
}
diff --git a/pkg/analyzer_plugin/test/utilities/range_factory_test.dart b/pkg/analyzer_plugin/test/utilities/range_factory_test.dart
index 7df042f..b7729fb 100644
--- a/pkg/analyzer_plugin/test/utilities/range_factory_test.dart
+++ b/pkg/analyzer_plugin/test/utilities/range_factory_test.dart
@@ -518,7 +518,7 @@
Future<void> test_endEnd() async {
await resolveTestCode('main() {}');
var mainFunction = testUnit.declarations[0] as FunctionDeclaration;
- var mainName = mainFunction.name2;
+ var mainName = mainFunction.name;
var mainBody = mainFunction.functionExpression.body;
expect(range.endEnd(mainName, mainBody), SourceRange(4, 5));
}
@@ -526,14 +526,14 @@
Future<void> test_endLength() async {
await resolveTestCode('main() {}');
var mainFunction = testUnit.declarations[0] as FunctionDeclaration;
- var mainName = mainFunction.name2;
+ var mainName = mainFunction.name;
expect(range.endLength(mainName, 3), SourceRange(4, 3));
}
Future<void> test_endStart() async {
await resolveTestCode('main() {}');
var mainFunction = testUnit.declarations[0] as FunctionDeclaration;
- var mainName = mainFunction.name2;
+ var mainName = mainFunction.name;
var mainBody = mainFunction.functionExpression.body;
expect(range.endStart(mainName, mainBody), SourceRange(4, 3));
}
@@ -574,7 +574,7 @@
Future<void> test_startEnd_nodeNode() async {
await resolveTestCode(' main() {}');
var mainFunction = testUnit.declarations[0] as FunctionDeclaration;
- var mainName = mainFunction.name2;
+ var mainName = mainFunction.name;
var mainBody = mainFunction.functionExpression.body;
expect(range.startEnd(mainName, mainBody), SourceRange(1, 9));
}
@@ -601,7 +601,7 @@
Future<void> test_token() async {
await resolveTestCode(' main() {}');
var mainFunction = testUnit.declarations[0] as FunctionDeclaration;
- var mainName = mainFunction.name2;
+ var mainName = mainFunction.name;
expect(range.token(mainName), SourceRange(1, 4));
}
diff --git a/pkg/nnbd_migration/lib/src/front_end/info_builder.dart b/pkg/nnbd_migration/lib/src/front_end/info_builder.dart
index 6e5e0e1..beb0e96 100644
--- a/pkg/nnbd_migration/lib/src/front_end/info_builder.dart
+++ b/pkg/nnbd_migration/lib/src/front_end/info_builder.dart
@@ -560,7 +560,7 @@
enclosingNode != null;
enclosingNode = enclosingNode.parent) {
if (enclosingNode is ConstructorDeclaration) {
- if (enclosingNode.name2 == null) {
+ if (enclosingNode.name == null) {
return _describeClassOrExtensionMember(
enclosingNode.parent as CompilationUnitMember?,
'the default constructor of',
@@ -569,10 +569,10 @@
return _describeClassOrExtensionMember(
enclosingNode.parent as CompilationUnitMember?,
'the constructor',
- enclosingNode.name2!.lexeme);
+ enclosingNode.name!.lexeme);
}
} else if (enclosingNode is MethodDeclaration) {
- var functionName = enclosingNode.name2.lexeme;
+ var functionName = enclosingNode.name.lexeme;
String baseDescription;
if (enclosingNode.isGetter) {
baseDescription = 'the getter';
@@ -590,7 +590,7 @@
functionName);
} else if (enclosingNode is FunctionDeclaration &&
enclosingNode.parent is CompilationUnit) {
- var functionName = enclosingNode.name2.lexeme;
+ var functionName = enclosingNode.name.lexeme;
String baseDescription;
if (enclosingNode.isGetter) {
baseDescription = 'the getter';
@@ -617,20 +617,20 @@
static String _describeClassOrExtensionMember(CompilationUnitMember? parent,
String baseDescription, String functionName) {
if (parent is NamedCompilationUnitMember) {
- var parentName = parent.name2.lexeme;
+ var parentName = parent.name.lexeme;
if (functionName.isEmpty) {
return "$baseDescription '$parentName'";
} else {
return "$baseDescription '$parentName.$functionName'";
}
} else if (parent is ExtensionDeclaration) {
- if (parent.name2 == null) {
+ if (parent.name == null) {
var extendedTypeString = parent.extendedType.type!.getDisplayString(
withNullability: false,
);
return "$baseDescription '$functionName' in unnamed extension on $extendedTypeString";
} else {
- return "$baseDescription '${parent.name2!.lexeme}.$functionName'";
+ return "$baseDescription '${parent.name!.lexeme}.$functionName'";
}
} else {
throw ArgumentError(
@@ -639,7 +639,7 @@
}
static String? _describeVariableDeclaration(VariableDeclaration node) {
- var variableName = node.name2.lexeme;
+ var variableName = node.name.lexeme;
var parent = node.parent!;
var grandParent = parent.parent;
if (grandParent is FieldDeclaration) {
diff --git a/pkg/nnbd_migration/tool/codegen/extract_resource.dart b/pkg/nnbd_migration/tool/codegen/extract_resource.dart
index bfc2490..486fbc4 100644
--- a/pkg/nnbd_migration/tool/codegen/extract_resource.dart
+++ b/pkg/nnbd_migration/tool/codegen/extract_resource.dart
@@ -38,7 +38,7 @@
if (declaration is TopLevelVariableDeclaration) {
for (var variable in declaration.variables.variables) {
if (variable.initializer == null) continue;
- var match = variableNameRegExp.matchAsPrefix(variable.name2.lexeme);
+ var match = variableNameRegExp.matchAsPrefix(variable.name.lexeme);
if (match == null) continue;
var shortName = match.group(1);
if (list) {
diff --git a/pkg/scrape/example/superclass_parameters.dart b/pkg/scrape/example/superclass_parameters.dart
index b242525..ab1461b 100644
--- a/pkg/scrape/example/superclass_parameters.dart
+++ b/pkg/scrape/example/superclass_parameters.dart
@@ -291,7 +291,7 @@
record('Insert super args', insert ? 'Yes' : 'No');
record('Do not merge super args', noMerge ? 'Yes' : 'No');
- var subName = _constructorName(node.name2);
+ var subName = _constructorName(node.name);
var superName = _constructorName(initializer.constructorName?.token);
record('No explicit super(), call same name',