Remove AstTestFactory.forStatement2
Change-Id: I8738ffbf1579e070c81c732f818c8ac6582debda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
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 93aac5c..80779ea 100644
--- a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
@@ -556,20 +556,6 @@
rightParenthesis: TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
body: body);
- static ForStatement forStatement2(VariableDeclarationList variableList,
- Expression condition, List<Expression> updaters, Statement body) =>
- astFactory.forStatement(
- forKeyword: TokenFactory.tokenFromKeyword(Keyword.FOR),
- leftParenthesis: TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
- forLoopParts: astFactory.forPartsWithDeclarations(
- variables: variableList,
- leftSeparator: TokenFactory.tokenFromType(TokenType.SEMICOLON),
- condition: condition,
- rightSeparator: TokenFactory.tokenFromType(TokenType.SEMICOLON),
- updaters: updaters),
- rightParenthesis: TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
- body: body);
-
static FunctionDeclaration functionDeclaration(
TypeAnnotation type,
Keyword keyword,
diff --git a/pkg/analyzer/test/dart/element/builder_test.dart b/pkg/analyzer/test/dart/element/builder_test.dart
index 4789eeb..25ba692 100644
--- a/pkg/analyzer/test/dart/element/builder_test.dart
+++ b/pkg/analyzer/test/dart/element/builder_test.dart
@@ -798,11 +798,12 @@
String variableName = "v";
VariableDeclaration variableIdentifier =
AstTestFactory.variableDeclaration('v');
- ForStatement statement = AstTestFactory.forStatement2(
- AstTestFactory.variableDeclarationList(
- null, AstTestFactory.typeName4('T'), [variableIdentifier]),
- null,
- null,
+ ForStatement statement = AstTestFactory.forStatement(
+ AstTestFactory.forPartsWithDeclarations(
+ AstTestFactory.variableDeclarationList(
+ null, AstTestFactory.typeName4('T'), [variableIdentifier]),
+ null,
+ null),
AstTestFactory.block());
_setNodeSourceRange(statement, 100, 110);
MethodDeclaration method = AstTestFactory.methodDeclaration2(
diff --git a/pkg/analyzer/test/generated/utilities_test.dart b/pkg/analyzer/test/generated/utilities_test.dart
index c0caf12..adb5de9 100644
--- a/pkg/analyzer/test/generated/utilities_test.dart
+++ b/pkg/analyzer/test/generated/utilities_test.dart
@@ -3116,11 +3116,12 @@
}
void test_forStatement_withVariables() {
- ForStatement node = AstTestFactory.forStatement2(
- AstTestFactory.variableDeclarationList2(
- null, [AstTestFactory.variableDeclaration("i")]),
- AstTestFactory.booleanLiteral(true),
- [AstTestFactory.integer(0)],
+ ForStatement node = AstTestFactory.forStatement(
+ AstTestFactory.forPartsWithDeclarations(
+ AstTestFactory.variableDeclarationList2(
+ null, [AstTestFactory.variableDeclaration("i")]),
+ AstTestFactory.booleanLiteral(true),
+ [AstTestFactory.integer(0)]),
AstTestFactory.block());
_assertReplace(
node, new Getter_NodeReplacerTest_test_forStatement_withVariables_2());
diff --git a/pkg/analyzer/test/src/dart/ast/utilities_test.dart b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
index 0b0908e..31e9a56 100644
--- a/pkg/analyzer/test/src/dart/ast/utilities_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
@@ -2123,44 +2123,48 @@
void test_visitForStatement_i() {
_assertSource(
"for (var i;;) {}",
- AstTestFactory.forStatement2(
- AstTestFactory.variableDeclarationList2(
- Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
- null,
- null,
+ AstTestFactory.forStatement(
+ AstTestFactory.forPartsWithDeclarations(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ null,
+ null),
AstTestFactory.block()));
}
void test_visitForStatement_ic() {
_assertSource(
"for (var i; c;) {}",
- AstTestFactory.forStatement2(
- AstTestFactory.variableDeclarationList2(
- Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
- AstTestFactory.identifier3("c"),
- null,
+ AstTestFactory.forStatement(
+ AstTestFactory.forPartsWithDeclarations(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ AstTestFactory.identifier3("c"),
+ null),
AstTestFactory.block()));
}
void test_visitForStatement_icu() {
_assertSource(
"for (var i; c; u) {}",
- AstTestFactory.forStatement2(
- AstTestFactory.variableDeclarationList2(
- Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
- AstTestFactory.identifier3("c"),
- [AstTestFactory.identifier3("u")],
+ AstTestFactory.forStatement(
+ AstTestFactory.forPartsWithDeclarations(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ AstTestFactory.identifier3("c"),
+ [AstTestFactory.identifier3("u")]),
AstTestFactory.block()));
}
void test_visitForStatement_iu() {
_assertSource(
"for (var i;; u) {}",
- AstTestFactory.forStatement2(
- AstTestFactory.variableDeclarationList2(
- Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
- null,
- [AstTestFactory.identifier3("u")],
+ AstTestFactory.forStatement(
+ AstTestFactory.forPartsWithDeclarations(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ null,
+ [AstTestFactory.identifier3("u")]),
AstTestFactory.block()));
}
@@ -4833,44 +4837,48 @@
void test_visitForStatement_i() {
_assertSource(
"for (var i;;) {}",
- AstTestFactory.forStatement2(
- AstTestFactory.variableDeclarationList2(
- Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
- null,
- null,
+ AstTestFactory.forStatement(
+ AstTestFactory.forPartsWithDeclarations(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ null,
+ null),
AstTestFactory.block()));
}
void test_visitForStatement_ic() {
_assertSource(
"for (var i; c;) {}",
- AstTestFactory.forStatement2(
- AstTestFactory.variableDeclarationList2(
- Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
- AstTestFactory.identifier3("c"),
- null,
+ AstTestFactory.forStatement(
+ AstTestFactory.forPartsWithDeclarations(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ AstTestFactory.identifier3("c"),
+ null),
AstTestFactory.block()));
}
void test_visitForStatement_icu() {
_assertSource(
"for (var i; c; u) {}",
- AstTestFactory.forStatement2(
- AstTestFactory.variableDeclarationList2(
- Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
- AstTestFactory.identifier3("c"),
- [AstTestFactory.identifier3("u")],
+ AstTestFactory.forStatement(
+ AstTestFactory.forPartsWithDeclarations(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ AstTestFactory.identifier3("c"),
+ [AstTestFactory.identifier3("u")]),
AstTestFactory.block()));
}
void test_visitForStatement_iu() {
_assertSource(
"for (var i;; u) {}",
- AstTestFactory.forStatement2(
- AstTestFactory.variableDeclarationList2(
- Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
- null,
- [AstTestFactory.identifier3("u")],
+ AstTestFactory.forStatement(
+ AstTestFactory.forPartsWithDeclarations(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ null,
+ [AstTestFactory.identifier3("u")]),
AstTestFactory.block()));
}