Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1876)

Unified Diff: pkg/analyzer/test/generated/ast_test.dart

Issue 712083003: Create fewer unnecessary lists (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest.dart ('k') | pkg/analyzer/test/generated/element_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/ast_test.dart
diff --git a/pkg/analyzer/test/generated/ast_test.dart b/pkg/analyzer/test/generated/ast_test.dart
index f1ccfbf3d8d8a40cd9b4868659760fe8cb95d88b..0cdbae7a6364508a61b0af26840b06230f4fb6c2 100644
--- a/pkg/analyzer/test/generated/ast_test.dart
+++ b/pkg/analyzer/test/generated/ast_test.dart
@@ -78,7 +78,7 @@ A f(var p) {
return null;
}
}''';
- CompilationUnit unit = ParserTestCase.parseCompilationUnit(source, []);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit(source);
List<AstNode> nodes = new List<AstNode>();
BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_BreadthFirstVisitorTest_testIt(nodes);
visitor.visitAllNodes(unit);
@@ -107,9 +107,9 @@ class BreadthFirstVisitor_BreadthFirstVisitorTest_testIt extends BreadthFirstVis
class ClassDeclarationTest extends ParserTestCase {
void test_getConstructor() {
List<ConstructorInitializer> initializers = new List<ConstructorInitializer>();
- ConstructorDeclaration defaultConstructor = AstFactory.constructorDeclaration(AstFactory.identifier3("Test"), null, AstFactory.formalParameterList([]), initializers);
- ConstructorDeclaration aConstructor = AstFactory.constructorDeclaration(AstFactory.identifier3("Test"), "a", AstFactory.formalParameterList([]), initializers);
- ConstructorDeclaration bConstructor = AstFactory.constructorDeclaration(AstFactory.identifier3("Test"), "b", AstFactory.formalParameterList([]), initializers);
+ ConstructorDeclaration defaultConstructor = AstFactory.constructorDeclaration(AstFactory.identifier3("Test"), null, AstFactory.formalParameterList(), initializers);
+ ConstructorDeclaration aConstructor = AstFactory.constructorDeclaration(AstFactory.identifier3("Test"), "a", AstFactory.formalParameterList(), initializers);
+ ConstructorDeclaration bConstructor = AstFactory.constructorDeclaration(AstFactory.identifier3("Test"), "b", AstFactory.formalParameterList(), initializers);
ClassDeclaration clazz = AstFactory.classDeclaration(null, "Test", null, null, null, null, [defaultConstructor, aConstructor, bConstructor]);
expect(clazz.getConstructor(null), same(defaultConstructor));
expect(clazz.getConstructor("a"), same(aConstructor));
@@ -131,8 +131,8 @@ class ClassDeclarationTest extends ParserTestCase {
}
void test_getMethod() {
- MethodDeclaration aMethod = AstFactory.methodDeclaration(null, null, null, null, AstFactory.identifier3("a"), AstFactory.formalParameterList([]));
- MethodDeclaration bMethod = AstFactory.methodDeclaration(null, null, null, null, AstFactory.identifier3("b"), AstFactory.formalParameterList([]));
+ MethodDeclaration aMethod = AstFactory.methodDeclaration(null, null, null, null, AstFactory.identifier3("a"), AstFactory.formalParameterList());
+ MethodDeclaration bMethod = AstFactory.methodDeclaration(null, null, null, null, AstFactory.identifier3("b"), AstFactory.formalParameterList());
ClassDeclaration clazz = AstFactory.classDeclaration(null, "Test", null, null, null, null, [aMethod, bMethod]);
expect(clazz.getMethod("a"), same(aMethod));
expect(clazz.getMethod("b"), same(bMethod));
@@ -140,8 +140,8 @@ class ClassDeclarationTest extends ParserTestCase {
}
void test_isAbstract() {
- expect(AstFactory.classDeclaration(null, "A", null, null, null, null, []).isAbstract, isFalse);
- expect(AstFactory.classDeclaration(Keyword.ABSTRACT, "B", null, null, null, null, []).isAbstract, isTrue);
+ expect(AstFactory.classDeclaration(null, "A", null, null, null, null).isAbstract, isFalse);
+ expect(AstFactory.classDeclaration(Keyword.ABSTRACT, "B", null, null, null, null).isAbstract, isTrue);
}
}
@@ -465,7 +465,7 @@ class ConstantEvaluatorTest extends ParserTestCase {
expect(value as int, -42);
}
- Object _getConstantValue(String source) => ParserTestCase.parseExpression(source, []).accept(new ConstantEvaluator());
+ Object _getConstantValue(String source) => ParserTestCase.parseExpression(source).accept(new ConstantEvaluator());
}
class IndexExpressionTest extends EngineTestCase {
@@ -556,7 +556,7 @@ class IndexExpressionTest extends EngineTestCase {
class NodeListTest extends EngineTestCase {
void test_add() {
- AstNode parent = AstFactory.argumentList([]);
+ AstNode parent = AstFactory.argumentList();
AstNode firstNode = AstFactory.booleanLiteral(true);
AstNode secondNode = AstFactory.booleanLiteral(false);
NodeList<AstNode> list = new NodeList<AstNode>(parent);
@@ -579,7 +579,7 @@ class NodeListTest extends EngineTestCase {
}
void test_add_negative() {
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
try {
list.insert(-1, AstFactory.booleanLiteral(true));
fail("Expected IndexOutOfBoundsException");
@@ -589,7 +589,7 @@ class NodeListTest extends EngineTestCase {
}
void test_add_tooBig() {
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
try {
list.insert(1, AstFactory.booleanLiteral(true));
fail("Expected IndexOutOfBoundsException");
@@ -599,7 +599,7 @@ class NodeListTest extends EngineTestCase {
}
void test_addAll() {
- AstNode parent = AstFactory.argumentList([]);
+ AstNode parent = AstFactory.argumentList();
List<AstNode> firstNodes = new List<AstNode>();
AstNode firstNode = AstFactory.booleanLiteral(true);
AstNode secondNode = AstFactory.booleanLiteral(false);
@@ -630,7 +630,7 @@ class NodeListTest extends EngineTestCase {
}
void test_create() {
- AstNode owner = AstFactory.argumentList([]);
+ AstNode owner = AstFactory.argumentList();
NodeList<AstNode> list = NodeList.create(owner);
expect(list, isNotNull);
expect(list, hasLength(0));
@@ -638,7 +638,7 @@ class NodeListTest extends EngineTestCase {
}
void test_creation() {
- AstNode owner = AstFactory.argumentList([]);
+ AstNode owner = AstFactory.argumentList();
NodeList<AstNode> list = new NodeList<AstNode>(owner);
expect(list, isNotNull);
expect(list, hasLength(0));
@@ -646,7 +646,7 @@ class NodeListTest extends EngineTestCase {
}
void test_get_negative() {
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
try {
list[-1];
fail("Expected IndexOutOfBoundsException");
@@ -656,7 +656,7 @@ class NodeListTest extends EngineTestCase {
}
void test_get_tooBig() {
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
try {
list[1];
fail("Expected IndexOutOfBoundsException");
@@ -666,24 +666,24 @@ class NodeListTest extends EngineTestCase {
}
void test_getBeginToken_empty() {
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
expect(list.beginToken, isNull);
}
void test_getBeginToken_nonEmpty() {
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
AstNode node = AstFactory.parenthesizedExpression(AstFactory.booleanLiteral(true));
list.add(node);
expect(list.beginToken, same(node.beginToken));
}
void test_getEndToken_empty() {
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
expect(list.endToken, isNull);
}
void test_getEndToken_nonEmpty() {
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
AstNode node = AstFactory.parenthesizedExpression(AstFactory.booleanLiteral(true));
list.add(node);
expect(list.endToken, same(node.endToken));
@@ -698,7 +698,7 @@ class NodeListTest extends EngineTestCase {
nodes.add(firstNode);
nodes.add(secondNode);
nodes.add(thirdNode);
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
list.addAll(nodes);
expect(list, hasLength(3));
expect(list.indexOf(firstNode), 0);
@@ -716,7 +716,7 @@ class NodeListTest extends EngineTestCase {
nodes.add(firstNode);
nodes.add(secondNode);
nodes.add(thirdNode);
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
list.addAll(nodes);
expect(list, hasLength(3));
expect(list.removeAt(1), same(secondNode));
@@ -726,7 +726,7 @@ class NodeListTest extends EngineTestCase {
}
void test_remove_negative() {
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
try {
list.removeAt(-1);
fail("Expected IndexOutOfBoundsException");
@@ -736,7 +736,7 @@ class NodeListTest extends EngineTestCase {
}
void test_remove_tooBig() {
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
try {
list.removeAt(1);
fail("Expected IndexOutOfBoundsException");
@@ -753,7 +753,7 @@ class NodeListTest extends EngineTestCase {
nodes.add(firstNode);
nodes.add(secondNode);
nodes.add(thirdNode);
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
list.addAll(nodes);
expect(list, hasLength(3));
AstNode fourthNode = AstFactory.integer(0);
@@ -766,7 +766,7 @@ class NodeListTest extends EngineTestCase {
void test_set_negative() {
AstNode node = AstFactory.booleanLiteral(true);
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
try {
javaListSet(list, -1, node);
fail("Expected IndexOutOfBoundsException");
@@ -777,7 +777,7 @@ class NodeListTest extends EngineTestCase {
void test_set_tooBig() {
AstNode node = AstFactory.booleanLiteral(true);
- NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList([]));
+ NodeList<AstNode> list = new NodeList<AstNode>(AstFactory.argumentList());
try {
javaListSet(list, 1, node);
fail("Expected IndexOutOfBoundsException");
@@ -789,7 +789,7 @@ class NodeListTest extends EngineTestCase {
class NodeLocatorTest extends ParserTestCase {
void test_range() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;", []);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;");
_assertLocate(unit, 4, 10, (node) => node is LibraryDirective, LibraryDirective);
}
@@ -799,14 +799,14 @@ class NodeLocatorTest extends ParserTestCase {
}
void test_searchWithin_offset() {
- CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;", []);
+ CompilationUnit unit = ParserTestCase.parseCompilationUnit("library myLib;");
_assertLocate(unit, 10, 10, (node) => node is SimpleIdentifier, SimpleIdentifier);
}
void test_searchWithin_offsetAfterNode() {
CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
class A {}
-class B {}''', []);
+class B {}''');
NodeLocator locator = new NodeLocator.con2(1024, 1024);
AstNode node = locator.searchWithin(unit.declarations[0]);
expect(node, isNull);
@@ -815,7 +815,7 @@ class B {}''', []);
void test_searchWithin_offsetBeforeNode() {
CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
class A {}
-class B {}''', []);
+class B {}''');
NodeLocator locator = new NodeLocator.con2(0, 0);
AstNode node = locator.searchWithin(unit.declarations[1]);
expect(node, isNull);
@@ -834,17 +834,17 @@ class B {}''', []);
class SimpleIdentifierTest extends ParserTestCase {
void test_inDeclarationContext_catch_exception() {
- SimpleIdentifier identifier = AstFactory.catchClause("e", []).exceptionParameter;
+ SimpleIdentifier identifier = AstFactory.catchClause("e").exceptionParameter;
expect(identifier.inDeclarationContext(), isTrue);
}
void test_inDeclarationContext_catch_stack() {
- SimpleIdentifier identifier = AstFactory.catchClause2("e", "s", []).stackTraceParameter;
+ SimpleIdentifier identifier = AstFactory.catchClause2("e", "s").stackTraceParameter;
expect(identifier.inDeclarationContext(), isTrue);
}
void test_inDeclarationContext_classDeclaration() {
- SimpleIdentifier identifier = AstFactory.classDeclaration(null, "C", null, null, null, null, []).name;
+ SimpleIdentifier identifier = AstFactory.classDeclaration(null, "C", null, null, null, null).name;
expect(identifier.inDeclarationContext(), isTrue);
}
@@ -899,7 +899,7 @@ class SimpleIdentifierTest extends ParserTestCase {
void test_inDeclarationContext_label_true() {
Label label = AstFactory.label2("l");
SimpleIdentifier identifier = label.label;
- AstFactory.labeledStatement(AstFactory.list([label]), AstFactory.emptyStatement());
+ AstFactory.labeledStatement([label], AstFactory.emptyStatement());
expect(identifier.inDeclarationContext(), isTrue);
}
@@ -910,7 +910,7 @@ class SimpleIdentifierTest extends ParserTestCase {
}
void test_inDeclarationContext_prefix() {
- SimpleIdentifier identifier = AstFactory.importDirective3("uri", "pref", []).prefix;
+ SimpleIdentifier identifier = AstFactory.importDirective3("uri", "pref").prefix;
expect(identifier.inDeclarationContext(), isTrue);
}
@@ -920,7 +920,7 @@ class SimpleIdentifierTest extends ParserTestCase {
}
void test_inDeclarationContext_typeParameter_bound() {
- TypeName bound = AstFactory.typeName4("A", []);
+ TypeName bound = AstFactory.typeName4("A");
SimpleIdentifier identifier = bound.name as SimpleIdentifier;
AstFactory.typeParameter2("E", bound);
expect(identifier.inDeclarationContext(), isFalse);
@@ -955,8 +955,8 @@ class SimpleIdentifierTest extends ParserTestCase {
void test_inGetterContext_forEachLoop() {
SimpleIdentifier identifier = AstFactory.identifier3("a");
- Expression iterator = AstFactory.listLiteral([]);
- Statement body = AstFactory.block([]);
+ Expression iterator = AstFactory.listLiteral();
+ Statement body = AstFactory.block();
AstFactory.forEachStatement2(identifier, iterator, body);
expect(identifier.inGetterContext(), isFalse);
}
@@ -987,8 +987,8 @@ class SimpleIdentifierTest extends ParserTestCase {
void test_inSetterContext_forEachLoop() {
SimpleIdentifier identifier = AstFactory.identifier3("a");
- Expression iterator = AstFactory.listLiteral([]);
- Statement body = AstFactory.block([]);
+ Expression iterator = AstFactory.listLiteral();
+ Statement body = AstFactory.block();
AstFactory.forEachStatement2(identifier, iterator, body);
expect(identifier.inSetterContext(), isTrue);
}
@@ -1327,7 +1327,7 @@ class StringInterpolationTest extends ParserTestCase {
}
void test_isRaw() {
- StringInterpolation node = AstFactory.string([]);
+ StringInterpolation node = AstFactory.string();
expect(node.isRaw, isFalse);
}
}
@@ -1342,7 +1342,7 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitAnnotation_constructor() {
- _assertSource("@A.c()", AstFactory.annotation2(AstFactory.identifier3("A"), AstFactory.identifier3("c"), AstFactory.argumentList([])));
+ _assertSource("@A.c()", AstFactory.annotation2(AstFactory.identifier3("A"), AstFactory.identifier3("c"), AstFactory.argumentList()));
}
void test_visitArgumentList() {
@@ -1350,7 +1350,7 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitAsExpression() {
- _assertSource("e as T", AstFactory.asExpression(AstFactory.identifier3("e"), AstFactory.typeName4("T", [])));
+ _assertSource("e as T", AstFactory.asExpression(AstFactory.identifier3("e"), AstFactory.typeName4("T")));
}
void test_visitAssertStatement() {
@@ -1370,7 +1370,7 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitBlock_empty() {
- _assertSource("{}", AstFactory.block([]));
+ _assertSource("{}", AstFactory.block());
}
void test_visitBlock_nonEmpty() {
@@ -1378,23 +1378,23 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitBlockFunctionBody_async() {
- _assertSource("async {}", AstFactory.asyncBlockFunctionBody([]));
+ _assertSource("async {}", AstFactory.asyncBlockFunctionBody());
}
void test_visitBlockFunctionBody_async_star() {
- _assertSource("async* {}", AstFactory.asyncGeneratorBlockFunctionBody([]));
+ _assertSource("async* {}", AstFactory.asyncGeneratorBlockFunctionBody());
}
void test_visitBlockFunctionBody_simple() {
- _assertSource("{}", AstFactory.blockFunctionBody2([]));
+ _assertSource("{}", AstFactory.blockFunctionBody2());
}
void test_visitBlockFunctionBody_sync() {
- _assertSource("sync {}", AstFactory.syncBlockFunctionBody([]));
+ _assertSource("sync {}", AstFactory.syncBlockFunctionBody());
}
void test_visitBlockFunctionBody_sync_star() {
- _assertSource("sync* {}", AstFactory.syncGeneratorBlockFunctionBody([]));
+ _assertSource("sync* {}", AstFactory.syncGeneratorBlockFunctionBody());
}
void test_visitBooleanLiteral_false() {
@@ -1427,52 +1427,52 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitCascadeExpression_method() {
_assertSource("a..b()..c()", AstFactory.cascadeExpression(AstFactory.identifier3("a"), [
- AstFactory.cascadedMethodInvocation("b", []),
- AstFactory.cascadedMethodInvocation("c", [])]));
+ AstFactory.cascadedMethodInvocation("b"),
+ AstFactory.cascadedMethodInvocation("c")]));
}
void test_visitCatchClause_catch_noStack() {
- _assertSource("catch (e) {}", AstFactory.catchClause("e", []));
+ _assertSource("catch (e) {}", AstFactory.catchClause("e"));
}
void test_visitCatchClause_catch_stack() {
- _assertSource("catch (e, s) {}", AstFactory.catchClause2("e", "s", []));
+ _assertSource("catch (e, s) {}", AstFactory.catchClause2("e", "s"));
}
void test_visitCatchClause_on() {
- _assertSource("on E {}", AstFactory.catchClause3(AstFactory.typeName4("E", []), []));
+ _assertSource("on E {}", AstFactory.catchClause3(AstFactory.typeName4("E")));
}
void test_visitCatchClause_on_catch() {
- _assertSource("on E catch (e) {}", AstFactory.catchClause4(AstFactory.typeName4("E", []), "e", []));
+ _assertSource("on E catch (e) {}", AstFactory.catchClause4(AstFactory.typeName4("E"), "e"));
}
void test_visitClassDeclaration_abstract() {
- _assertSource("abstract class C {}", AstFactory.classDeclaration(Keyword.ABSTRACT, "C", null, null, null, null, []));
+ _assertSource("abstract class C {}", AstFactory.classDeclaration(Keyword.ABSTRACT, "C", null, null, null, null));
}
void test_visitClassDeclaration_empty() {
- _assertSource("class C {}", AstFactory.classDeclaration(null, "C", null, null, null, null, []));
+ _assertSource("class C {}", AstFactory.classDeclaration(null, "C", null, null, null, null));
}
void test_visitClassDeclaration_extends() {
- _assertSource("class C extends A {}", AstFactory.classDeclaration(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A", [])), null, null, []));
+ _assertSource("class C extends A {}", AstFactory.classDeclaration(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A")), null, null));
}
void test_visitClassDeclaration_extends_implements() {
- _assertSource("class C extends A implements B {}", AstFactory.classDeclaration(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A", [])), null, AstFactory.implementsClause([AstFactory.typeName4("B", [])]), []));
+ _assertSource("class C extends A implements B {}", AstFactory.classDeclaration(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A")), null, AstFactory.implementsClause([AstFactory.typeName4("B")])));
}
void test_visitClassDeclaration_extends_with() {
- _assertSource("class C extends A with M {}", AstFactory.classDeclaration(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A", [])), AstFactory.withClause([AstFactory.typeName4("M", [])]), null, []));
+ _assertSource("class C extends A with M {}", AstFactory.classDeclaration(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A")), AstFactory.withClause([AstFactory.typeName4("M")]), null));
}
void test_visitClassDeclaration_extends_with_implements() {
- _assertSource("class C extends A with M implements B {}", AstFactory.classDeclaration(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A", [])), AstFactory.withClause([AstFactory.typeName4("M", [])]), AstFactory.implementsClause([AstFactory.typeName4("B", [])]), []));
+ _assertSource("class C extends A with M implements B {}", AstFactory.classDeclaration(null, "C", null, AstFactory.extendsClause(AstFactory.typeName4("A")), AstFactory.withClause([AstFactory.typeName4("M")]), AstFactory.implementsClause([AstFactory.typeName4("B")])));
}
void test_visitClassDeclaration_implements() {
- _assertSource("class C implements B {}", AstFactory.classDeclaration(null, "C", null, null, null, AstFactory.implementsClause([AstFactory.typeName4("B", [])]), []));
+ _assertSource("class C implements B {}", AstFactory.classDeclaration(null, "C", null, null, null, AstFactory.implementsClause([AstFactory.typeName4("B")])));
}
void test_visitClassDeclaration_multipleMember() {
@@ -1482,27 +1482,27 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitClassDeclaration_parameters() {
- _assertSource("class C<E> {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), null, null, null, []));
+ _assertSource("class C<E> {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), null, null, null));
}
void test_visitClassDeclaration_parameters_extends() {
- _assertSource("class C<E> extends A {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFactory.typeName4("A", [])), null, null, []));
+ _assertSource("class C<E> extends A {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFactory.typeName4("A")), null, null));
}
void test_visitClassDeclaration_parameters_extends_implements() {
- _assertSource("class C<E> extends A implements B {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFactory.typeName4("A", [])), null, AstFactory.implementsClause([AstFactory.typeName4("B", [])]), []));
+ _assertSource("class C<E> extends A implements B {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFactory.typeName4("A")), null, AstFactory.implementsClause([AstFactory.typeName4("B")])));
}
void test_visitClassDeclaration_parameters_extends_with() {
- _assertSource("class C<E> extends A with M {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFactory.typeName4("A", [])), AstFactory.withClause([AstFactory.typeName4("M", [])]), null, []));
+ _assertSource("class C<E> extends A with M {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFactory.typeName4("A")), AstFactory.withClause([AstFactory.typeName4("M")]), null));
}
void test_visitClassDeclaration_parameters_extends_with_implements() {
- _assertSource("class C<E> extends A with M implements B {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFactory.typeName4("A", [])), AstFactory.withClause([AstFactory.typeName4("M", [])]), AstFactory.implementsClause([AstFactory.typeName4("B", [])]), []));
+ _assertSource("class C<E> extends A with M implements B {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), AstFactory.extendsClause(AstFactory.typeName4("A")), AstFactory.withClause([AstFactory.typeName4("M")]), AstFactory.implementsClause([AstFactory.typeName4("B")])));
}
void test_visitClassDeclaration_parameters_implements() {
- _assertSource("class C<E> implements B {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), null, null, AstFactory.implementsClause([AstFactory.typeName4("B", [])]), []));
+ _assertSource("class C<E> implements B {}", AstFactory.classDeclaration(null, "C", AstFactory.typeParameterList(["E"]), null, null, AstFactory.implementsClause([AstFactory.typeName4("B")])));
}
void test_visitClassDeclaration_singleMember() {
@@ -1510,46 +1510,48 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitClassDeclaration_withMetadata() {
- ClassDeclaration declaration = AstFactory.classDeclaration(null, "C", null, null, null, null, []);
- declaration.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ ClassDeclaration declaration = AstFactory.classDeclaration(null, "C", null, null, null, null);
+ declaration.metadata = [
+ AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated class C {}", declaration);
}
void test_visitClassTypeAlias_abstract() {
- _assertSource("abstract class C = S with M1;", AstFactory.classTypeAlias("C", null, Keyword.ABSTRACT, AstFactory.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]), null));
+ _assertSource("abstract class C = S with M1;", AstFactory.classTypeAlias("C", null, Keyword.ABSTRACT, AstFactory.typeName4("S"), AstFactory.withClause([AstFactory.typeName4("M1")]), null));
}
void test_visitClassTypeAlias_abstract_implements() {
- _assertSource("abstract class C = S with M1 implements I;", AstFactory.classTypeAlias("C", null, Keyword.ABSTRACT, AstFactory.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]), AstFactory.implementsClause([AstFactory.typeName4("I", [])])));
+ _assertSource("abstract class C = S with M1 implements I;", AstFactory.classTypeAlias("C", null, Keyword.ABSTRACT, AstFactory.typeName4("S"), AstFactory.withClause([AstFactory.typeName4("M1")]), AstFactory.implementsClause([AstFactory.typeName4("I")])));
}
void test_visitClassTypeAlias_generic() {
- _assertSource("class C<E> = S<E> with M1<E>;", AstFactory.classTypeAlias("C", AstFactory.typeParameterList(["E"]), null, AstFactory.typeName4("S", [AstFactory.typeName4("E", [])]), AstFactory.withClause([AstFactory.typeName4("M1", [AstFactory.typeName4("E", [])])]), null));
+ _assertSource("class C<E> = S<E> with M1<E>;", AstFactory.classTypeAlias("C", AstFactory.typeParameterList(["E"]), null, AstFactory.typeName4("S", [AstFactory.typeName4("E")]), AstFactory.withClause([AstFactory.typeName4("M1", [AstFactory.typeName4("E")])]), null));
}
void test_visitClassTypeAlias_implements() {
- _assertSource("class C = S with M1 implements I;", AstFactory.classTypeAlias("C", null, null, AstFactory.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]), AstFactory.implementsClause([AstFactory.typeName4("I", [])])));
+ _assertSource("class C = S with M1 implements I;", AstFactory.classTypeAlias("C", null, null, AstFactory.typeName4("S"), AstFactory.withClause([AstFactory.typeName4("M1")]), AstFactory.implementsClause([AstFactory.typeName4("I")])));
}
void test_visitClassTypeAlias_minimal() {
- _assertSource("class C = S with M1;", AstFactory.classTypeAlias("C", null, null, AstFactory.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]), null));
+ _assertSource("class C = S with M1;", AstFactory.classTypeAlias("C", null, null, AstFactory.typeName4("S"), AstFactory.withClause([AstFactory.typeName4("M1")]), null));
}
void test_visitClassTypeAlias_parameters_abstract() {
- _assertSource("abstract class C<E> = S with M1;", AstFactory.classTypeAlias("C", AstFactory.typeParameterList(["E"]), Keyword.ABSTRACT, AstFactory.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]), null));
+ _assertSource("abstract class C<E> = S with M1;", AstFactory.classTypeAlias("C", AstFactory.typeParameterList(["E"]), Keyword.ABSTRACT, AstFactory.typeName4("S"), AstFactory.withClause([AstFactory.typeName4("M1")]), null));
}
void test_visitClassTypeAlias_parameters_abstract_implements() {
- _assertSource("abstract class C<E> = S with M1 implements I;", AstFactory.classTypeAlias("C", AstFactory.typeParameterList(["E"]), Keyword.ABSTRACT, AstFactory.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]), AstFactory.implementsClause([AstFactory.typeName4("I", [])])));
+ _assertSource("abstract class C<E> = S with M1 implements I;", AstFactory.classTypeAlias("C", AstFactory.typeParameterList(["E"]), Keyword.ABSTRACT, AstFactory.typeName4("S"), AstFactory.withClause([AstFactory.typeName4("M1")]), AstFactory.implementsClause([AstFactory.typeName4("I")])));
}
void test_visitClassTypeAlias_parameters_implements() {
- _assertSource("class C<E> = S with M1 implements I;", AstFactory.classTypeAlias("C", AstFactory.typeParameterList(["E"]), null, AstFactory.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]), AstFactory.implementsClause([AstFactory.typeName4("I", [])])));
+ _assertSource("class C<E> = S with M1 implements I;", AstFactory.classTypeAlias("C", AstFactory.typeParameterList(["E"]), null, AstFactory.typeName4("S"), AstFactory.withClause([AstFactory.typeName4("M1")]), AstFactory.implementsClause([AstFactory.typeName4("I")])));
}
void test_visitClassTypeAlias_withMetadata() {
- ClassTypeAlias declaration = AstFactory.classTypeAlias("C", null, null, AstFactory.typeName4("S", []), AstFactory.withClause([AstFactory.typeName4("M1", [])]), null);
- declaration.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ ClassTypeAlias declaration = AstFactory.classTypeAlias("C", null, null, AstFactory.typeName4("S"), AstFactory.withClause([AstFactory.typeName4("M1")]), null);
+ declaration.metadata = [
+ AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated class C = S with M1;", declaration);
}
@@ -1570,7 +1572,11 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitCompilationUnit_directive_declaration() {
- _assertSource("library l; var a;", AstFactory.compilationUnit4(AstFactory.list([AstFactory.libraryDirective2("l")]), AstFactory.list([AstFactory.topLevelVariableDeclaration2(Keyword.VAR, [AstFactory.variableDeclaration("a")])])));
+ _assertSource("library l; var a;", AstFactory.compilationUnit4(
+ [AstFactory.libraryDirective2("l")],
+ [AstFactory.topLevelVariableDeclaration2(
+ Keyword.VAR,
+ [AstFactory.variableDeclaration("a")])]));
}
void test_visitCompilationUnit_empty() {
@@ -1590,7 +1596,12 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitCompilationUnit_script_directives_declarations() {
- _assertSource("!#/bin/dartvm library l; var a;", AstFactory.compilationUnit8("!#/bin/dartvm", AstFactory.list([AstFactory.libraryDirective2("l")]), AstFactory.list([AstFactory.topLevelVariableDeclaration2(Keyword.VAR, [AstFactory.variableDeclaration("a")])])));
+ _assertSource("!#/bin/dartvm library l; var a;", AstFactory.compilationUnit8(
+ "!#/bin/dartvm",
+ [AstFactory.libraryDirective2("l")],
+ [AstFactory.topLevelVariableDeclaration2(
+ Keyword.VAR,
+ [AstFactory.variableDeclaration("a")])]));
}
void test_visitConditionalExpression() {
@@ -1598,40 +1609,54 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitConstructorDeclaration_const() {
- _assertSource("const C() {}", AstFactory.constructorDeclaration2(Keyword.CONST, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]), null, AstFactory.blockFunctionBody2([])));
+ _assertSource("const C() {}", AstFactory.constructorDeclaration2(Keyword.CONST, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList(), null, AstFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_external() {
- _assertSource("external C();", AstFactory.constructorDeclaration(AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]), null));
+ _assertSource("external C();", AstFactory.constructorDeclaration(AstFactory.identifier3("C"), null, AstFactory.formalParameterList(), null));
}
void test_visitConstructorDeclaration_minimal() {
- _assertSource("C() {}", AstFactory.constructorDeclaration2(null, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]), null, AstFactory.blockFunctionBody2([])));
+ _assertSource("C() {}", AstFactory.constructorDeclaration2(null, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList(), null, AstFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_multipleInitializers() {
- _assertSource("C() : a = b, c = d {}", AstFactory.constructorDeclaration2(null, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]), AstFactory.list([
- AstFactory.constructorFieldInitializer(false, "a", AstFactory.identifier3("b")),
- AstFactory.constructorFieldInitializer(false, "c", AstFactory.identifier3("d"))]), AstFactory.blockFunctionBody2([])));
+ _assertSource("C() : a = b, c = d {}", AstFactory.constructorDeclaration2(
+ null,
+ null,
+ AstFactory.identifier3("C"),
+ null,
+ AstFactory.formalParameterList(),
+ [
+ AstFactory.constructorFieldInitializer(false, "a", AstFactory.identifier3("b")),
+ AstFactory.constructorFieldInitializer(false, "c", AstFactory.identifier3("d"))],
+ AstFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_multipleParameters() {
_assertSource("C(var a, var b) {}", AstFactory.constructorDeclaration2(null, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([
AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
- AstFactory.simpleFormalParameter(Keyword.VAR, "b")]), null, AstFactory.blockFunctionBody2([])));
+ AstFactory.simpleFormalParameter(Keyword.VAR, "b")]), null, AstFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_named() {
- _assertSource("C.m() {}", AstFactory.constructorDeclaration2(null, null, AstFactory.identifier3("C"), "m", AstFactory.formalParameterList([]), null, AstFactory.blockFunctionBody2([])));
+ _assertSource("C.m() {}", AstFactory.constructorDeclaration2(null, null, AstFactory.identifier3("C"), "m", AstFactory.formalParameterList(), null, AstFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_singleInitializer() {
- _assertSource("C() : a = b {}", AstFactory.constructorDeclaration2(null, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]), AstFactory.list([AstFactory.constructorFieldInitializer(false, "a", AstFactory.identifier3("b"))]), AstFactory.blockFunctionBody2([])));
+ _assertSource("C() : a = b {}", AstFactory.constructorDeclaration2(
+ null,
+ null,
+ AstFactory.identifier3("C"),
+ null,
+ AstFactory.formalParameterList(),
+ [AstFactory.constructorFieldInitializer(false, "a", AstFactory.identifier3("b"))],
+ AstFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_withMetadata() {
- ConstructorDeclaration declaration = AstFactory.constructorDeclaration2(null, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList([]), null, AstFactory.blockFunctionBody2([]));
- declaration.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ ConstructorDeclaration declaration = AstFactory.constructorDeclaration2(null, null, AstFactory.identifier3("C"), null, AstFactory.formalParameterList(), null, AstFactory.blockFunctionBody2());
+ declaration.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated C() {}", declaration);
}
@@ -1644,15 +1669,15 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitConstructorName_named_prefix() {
- _assertSource("p.C.n", AstFactory.constructorName(AstFactory.typeName4("p.C.n", []), null));
+ _assertSource("p.C.n", AstFactory.constructorName(AstFactory.typeName4("p.C.n"), null));
}
void test_visitConstructorName_unnamed_noPrefix() {
- _assertSource("C", AstFactory.constructorName(AstFactory.typeName4("C", []), null));
+ _assertSource("C", AstFactory.constructorName(AstFactory.typeName4("C"), null));
}
void test_visitConstructorName_unnamed_prefix() {
- _assertSource("p.C", AstFactory.constructorName(AstFactory.typeName3(AstFactory.identifier5("p", "C"), []), null));
+ _assertSource("p.C", AstFactory.constructorName(AstFactory.typeName3(AstFactory.identifier5("p", "C")), null));
}
void test_visitContinueStatement_label() {
@@ -1680,7 +1705,7 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitDoStatement() {
- _assertSource("do {} while (c);", AstFactory.doStatement(AstFactory.block([]), AstFactory.identifier3("c")));
+ _assertSource("do {} while (c);", AstFactory.doStatement(AstFactory.block(), AstFactory.identifier3("c")));
}
void test_visitDoubleLiteral() {
@@ -1714,12 +1739,12 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitExportDirective_minimal() {
- _assertSource("export 'a.dart';", AstFactory.exportDirective2("a.dart", []));
+ _assertSource("export 'a.dart';", AstFactory.exportDirective2("a.dart"));
}
void test_visitExportDirective_withMetadata() {
- ExportDirective directive = AstFactory.exportDirective2("a.dart", []);
- directive.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ ExportDirective directive = AstFactory.exportDirective2("a.dart");
+ directive.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated export 'a.dart';", directive);
}
@@ -1736,7 +1761,7 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitExtendsClause() {
- _assertSource("extends C", AstFactory.extendsClause(AstFactory.typeName4("C", [])));
+ _assertSource("extends C", AstFactory.extendsClause(AstFactory.typeName4("C")));
}
void test_visitFieldDeclaration_instance() {
@@ -1749,12 +1774,12 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitFieldDeclaration_withMetadata() {
FieldDeclaration declaration = AstFactory.fieldDeclaration2(false, Keyword.VAR, [AstFactory.variableDeclaration("a")]);
- declaration.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ declaration.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated var a;", declaration);
}
void test_visitFieldFormalParameter_functionTyped() {
- _assertSource("A this.a(b)", AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A", []), "a", AstFactory.formalParameterList([AstFactory.simpleFormalParameter3("b")])));
+ _assertSource("A this.a(b)", AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A"), "a", AstFactory.formalParameterList([AstFactory.simpleFormalParameter3("b")])));
}
void test_visitFieldFormalParameter_keyword() {
@@ -1762,27 +1787,27 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitFieldFormalParameter_keywordAndType() {
- _assertSource("final A this.a", AstFactory.fieldFormalParameter(Keyword.FINAL, AstFactory.typeName4("A", []), "a"));
+ _assertSource("final A this.a", AstFactory.fieldFormalParameter(Keyword.FINAL, AstFactory.typeName4("A"), "a"));
}
void test_visitFieldFormalParameter_type() {
- _assertSource("A this.a", AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A", []), "a"));
+ _assertSource("A this.a", AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A"), "a"));
}
void test_visitForEachStatement_declared() {
- _assertSource("for (a in b) {}", AstFactory.forEachStatement(AstFactory.declaredIdentifier3("a"), AstFactory.identifier3("b"), AstFactory.block([])));
+ _assertSource("for (a in b) {}", AstFactory.forEachStatement(AstFactory.declaredIdentifier3("a"), AstFactory.identifier3("b"), AstFactory.block()));
}
void test_visitForEachStatement_variable() {
- _assertSource("for (a in b) {}", new ForEachStatement.con2(null, TokenFactory.tokenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.OPEN_PAREN), AstFactory.identifier3("a"), TokenFactory.tokenFromKeyword(Keyword.IN), AstFactory.identifier3("b"), TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), AstFactory.block([])));
+ _assertSource("for (a in b) {}", new ForEachStatement.con2(null, TokenFactory.tokenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.OPEN_PAREN), AstFactory.identifier3("a"), TokenFactory.tokenFromKeyword(Keyword.IN), AstFactory.identifier3("b"), TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), AstFactory.block()));
}
void test_visitForEachStatement_variable_await() {
- _assertSource("await for (a in b) {}", new ForEachStatement.con2(TokenFactory.tokenFromString("await"), TokenFactory.tokenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.OPEN_PAREN), AstFactory.identifier3("a"), TokenFactory.tokenFromKeyword(Keyword.IN), AstFactory.identifier3("b"), TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), AstFactory.block([])));
+ _assertSource("await for (a in b) {}", new ForEachStatement.con2(TokenFactory.tokenFromString("await"), TokenFactory.tokenFromKeyword(Keyword.FOR), TokenFactory.tokenFromType(TokenType.OPEN_PAREN), AstFactory.identifier3("a"), TokenFactory.tokenFromKeyword(Keyword.IN), AstFactory.identifier3("b"), TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), AstFactory.block()));
}
void test_visitFormalParameterList_empty() {
- _assertSource("()", AstFactory.formalParameterList([]));
+ _assertSource("()", AstFactory.formalParameterList());
}
void test_visitFormalParameterList_n() {
@@ -1872,47 +1897,47 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitForStatement_c() {
- _assertSource("for (; c;) {}", AstFactory.forStatement(null, AstFactory.identifier3("c"), null, AstFactory.block([])));
+ _assertSource("for (; c;) {}", AstFactory.forStatement(null, AstFactory.identifier3("c"), null, AstFactory.block()));
}
void test_visitForStatement_cu() {
- _assertSource("for (; c; u) {}", AstFactory.forStatement(null, AstFactory.identifier3("c"), AstFactory.list([AstFactory.identifier3("u")]), AstFactory.block([])));
+ _assertSource("for (; c; u) {}", AstFactory.forStatement(null, AstFactory.identifier3("c"), [AstFactory.identifier3("u")], AstFactory.block()));
}
void test_visitForStatement_e() {
- _assertSource("for (e;;) {}", AstFactory.forStatement(AstFactory.identifier3("e"), null, null, AstFactory.block([])));
+ _assertSource("for (e;;) {}", AstFactory.forStatement(AstFactory.identifier3("e"), null, null, AstFactory.block()));
}
void test_visitForStatement_ec() {
- _assertSource("for (e; c;) {}", AstFactory.forStatement(AstFactory.identifier3("e"), AstFactory.identifier3("c"), null, AstFactory.block([])));
+ _assertSource("for (e; c;) {}", AstFactory.forStatement(AstFactory.identifier3("e"), AstFactory.identifier3("c"), null, AstFactory.block()));
}
void test_visitForStatement_ecu() {
- _assertSource("for (e; c; u) {}", AstFactory.forStatement(AstFactory.identifier3("e"), AstFactory.identifier3("c"), AstFactory.list([AstFactory.identifier3("u")]), AstFactory.block([])));
+ _assertSource("for (e; c; u) {}", AstFactory.forStatement(AstFactory.identifier3("e"), AstFactory.identifier3("c"), [AstFactory.identifier3("u")], AstFactory.block()));
}
void test_visitForStatement_eu() {
- _assertSource("for (e;; u) {}", AstFactory.forStatement(AstFactory.identifier3("e"), null, AstFactory.list([AstFactory.identifier3("u")]), AstFactory.block([])));
+ _assertSource("for (e;; u) {}", AstFactory.forStatement(AstFactory.identifier3("e"), null, [AstFactory.identifier3("u")], AstFactory.block()));
}
void test_visitForStatement_i() {
- _assertSource("for (var i;;) {}", AstFactory.forStatement2(AstFactory.variableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), null, null, AstFactory.block([])));
+ _assertSource("for (var i;;) {}", AstFactory.forStatement2(AstFactory.variableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), null, null, AstFactory.block()));
}
void test_visitForStatement_ic() {
- _assertSource("for (var i; c;) {}", AstFactory.forStatement2(AstFactory.variableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), AstFactory.identifier3("c"), null, AstFactory.block([])));
+ _assertSource("for (var i; c;) {}", AstFactory.forStatement2(AstFactory.variableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), AstFactory.identifier3("c"), null, AstFactory.block()));
}
void test_visitForStatement_icu() {
- _assertSource("for (var i; c; u) {}", AstFactory.forStatement2(AstFactory.variableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), AstFactory.identifier3("c"), AstFactory.list([AstFactory.identifier3("u")]), AstFactory.block([])));
+ _assertSource("for (var i; c; u) {}", AstFactory.forStatement2(AstFactory.variableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), AstFactory.identifier3("c"), [AstFactory.identifier3("u")], AstFactory.block()));
}
void test_visitForStatement_iu() {
- _assertSource("for (var i;; u) {}", AstFactory.forStatement2(AstFactory.variableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), null, AstFactory.list([AstFactory.identifier3("u")]), AstFactory.block([])));
+ _assertSource("for (var i;; u) {}", AstFactory.forStatement2(AstFactory.variableDeclarationList2(Keyword.VAR, [AstFactory.variableDeclaration("i")]), null, [AstFactory.identifier3("u")], AstFactory.block()));
}
void test_visitForStatement_u() {
- _assertSource("for (;; u) {}", AstFactory.forStatement(null, null, AstFactory.list([AstFactory.identifier3("u")]), AstFactory.block([])));
+ _assertSource("for (;; u) {}", AstFactory.forStatement(null, null, [AstFactory.identifier3("u")], AstFactory.block()));
}
void test_visitFunctionDeclaration_getter() {
@@ -1922,15 +1947,15 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitFunctionDeclaration_local_blockBody() {
FunctionDeclaration f = AstFactory.functionDeclaration(null, null, "f", AstFactory.functionExpression());
FunctionDeclarationStatement fStatement = new FunctionDeclarationStatement(f);
- _assertSource("main() {f() {} 42;}", AstFactory.functionDeclaration(null, null, "main", AstFactory.functionExpression2(AstFactory.formalParameterList([]), AstFactory.blockFunctionBody2([
+ _assertSource("main() {f() {} 42;}", AstFactory.functionDeclaration(null, null, "main", AstFactory.functionExpression2(AstFactory.formalParameterList(), AstFactory.blockFunctionBody2([
fStatement,
AstFactory.expressionStatement(AstFactory.integer(42))]))));
}
void test_visitFunctionDeclaration_local_expressionBody() {
- FunctionDeclaration f = AstFactory.functionDeclaration(null, null, "f", AstFactory.functionExpression2(AstFactory.formalParameterList([]), AstFactory.expressionFunctionBody(AstFactory.integer(1))));
+ FunctionDeclaration f = AstFactory.functionDeclaration(null, null, "f", AstFactory.functionExpression2(AstFactory.formalParameterList(), AstFactory.expressionFunctionBody(AstFactory.integer(1))));
FunctionDeclarationStatement fStatement = new FunctionDeclarationStatement(f);
- _assertSource("main() {f() => 1; 2;}", AstFactory.functionDeclaration(null, null, "main", AstFactory.functionExpression2(AstFactory.formalParameterList([]), AstFactory.blockFunctionBody2([
+ _assertSource("main() {f() => 1; 2;}", AstFactory.functionDeclaration(null, null, "main", AstFactory.functionExpression2(AstFactory.formalParameterList(), AstFactory.blockFunctionBody2([
fStatement,
AstFactory.expressionStatement(AstFactory.integer(2))]))));
}
@@ -1945,7 +1970,7 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitFunctionDeclaration_withMetadata() {
FunctionDeclaration declaration = AstFactory.functionDeclaration(null, null, "f", AstFactory.functionExpression());
- declaration.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ declaration.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated f() {}", declaration);
}
@@ -1958,47 +1983,47 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitFunctionExpressionInvocation() {
- _assertSource("f()", AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"), []));
+ _assertSource("f()", AstFactory.functionExpressionInvocation(AstFactory.identifier3("f")));
}
void test_visitFunctionTypeAlias_generic() {
- _assertSource("typedef A F<B>();", AstFactory.typeAlias(AstFactory.typeName4("A", []), "F", AstFactory.typeParameterList(["B"]), AstFactory.formalParameterList([])));
+ _assertSource("typedef A F<B>();", AstFactory.typeAlias(AstFactory.typeName4("A"), "F", AstFactory.typeParameterList(["B"]), AstFactory.formalParameterList()));
}
void test_visitFunctionTypeAlias_nonGeneric() {
- _assertSource("typedef A F();", AstFactory.typeAlias(AstFactory.typeName4("A", []), "F", null, AstFactory.formalParameterList([])));
+ _assertSource("typedef A F();", AstFactory.typeAlias(AstFactory.typeName4("A"), "F", null, AstFactory.formalParameterList()));
}
void test_visitFunctionTypeAlias_withMetadata() {
- FunctionTypeAlias declaration = AstFactory.typeAlias(AstFactory.typeName4("A", []), "F", null, AstFactory.formalParameterList([]));
- declaration.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ FunctionTypeAlias declaration = AstFactory.typeAlias(AstFactory.typeName4("A"), "F", null, AstFactory.formalParameterList());
+ declaration.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated typedef A F();", declaration);
}
void test_visitFunctionTypedFormalParameter_noType() {
- _assertSource("f()", AstFactory.functionTypedFormalParameter(null, "f", []));
+ _assertSource("f()", AstFactory.functionTypedFormalParameter(null, "f"));
}
void test_visitFunctionTypedFormalParameter_type() {
- _assertSource("T f()", AstFactory.functionTypedFormalParameter(AstFactory.typeName4("T", []), "f", []));
+ _assertSource("T f()", AstFactory.functionTypedFormalParameter(AstFactory.typeName4("T"), "f"));
}
void test_visitIfStatement_withElse() {
- _assertSource("if (c) {} else {}", AstFactory.ifStatement2(AstFactory.identifier3("c"), AstFactory.block([]), AstFactory.block([])));
+ _assertSource("if (c) {} else {}", AstFactory.ifStatement2(AstFactory.identifier3("c"), AstFactory.block(), AstFactory.block()));
}
void test_visitIfStatement_withoutElse() {
- _assertSource("if (c) {}", AstFactory.ifStatement(AstFactory.identifier3("c"), AstFactory.block([])));
+ _assertSource("if (c) {}", AstFactory.ifStatement(AstFactory.identifier3("c"), AstFactory.block()));
}
void test_visitImplementsClause_multiple() {
_assertSource("implements A, B", AstFactory.implementsClause([
- AstFactory.typeName4("A", []),
- AstFactory.typeName4("B", [])]));
+ AstFactory.typeName4("A"),
+ AstFactory.typeName4("B")]));
}
void test_visitImplementsClause_single() {
- _assertSource("implements A", AstFactory.implementsClause([AstFactory.typeName4("A", [])]));
+ _assertSource("implements A", AstFactory.implementsClause([AstFactory.typeName4("A")]));
}
void test_visitImportDirective_combinator() {
@@ -2012,15 +2037,15 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitImportDirective_deferred() {
- _assertSource("import 'a.dart' deferred as p;", AstFactory.importDirective2("a.dart", true, "p", []));
+ _assertSource("import 'a.dart' deferred as p;", AstFactory.importDirective2("a.dart", true, "p"));
}
void test_visitImportDirective_minimal() {
- _assertSource("import 'a.dart';", AstFactory.importDirective3("a.dart", null, []));
+ _assertSource("import 'a.dart';", AstFactory.importDirective3("a.dart", null));
}
void test_visitImportDirective_prefix() {
- _assertSource("import 'a.dart' as p;", AstFactory.importDirective3("a.dart", "p", []));
+ _assertSource("import 'a.dart' as p;", AstFactory.importDirective3("a.dart", "p"));
}
void test_visitImportDirective_prefix_combinator() {
@@ -2034,8 +2059,8 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitImportDirective_withMetadata() {
- ImportDirective directive = AstFactory.importDirective3("a.dart", null, []);
- directive.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ ImportDirective directive = AstFactory.importDirective3("a.dart", null);
+ directive.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated import 'a.dart';", directive);
}
@@ -2060,15 +2085,15 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitInstanceCreationExpression_const() {
- _assertSource("const C()", AstFactory.instanceCreationExpression2(Keyword.CONST, AstFactory.typeName4("C", []), []));
+ _assertSource("const C()", AstFactory.instanceCreationExpression2(Keyword.CONST, AstFactory.typeName4("C")));
}
void test_visitInstanceCreationExpression_named() {
- _assertSource("new C.c()", AstFactory.instanceCreationExpression3(Keyword.NEW, AstFactory.typeName4("C", []), "c", []));
+ _assertSource("new C.c()", AstFactory.instanceCreationExpression3(Keyword.NEW, AstFactory.typeName4("C"), "c"));
}
void test_visitInstanceCreationExpression_unnamed() {
- _assertSource("new C()", AstFactory.instanceCreationExpression2(Keyword.NEW, AstFactory.typeName4("C", []), []));
+ _assertSource("new C()", AstFactory.instanceCreationExpression2(Keyword.NEW, AstFactory.typeName4("C")));
}
void test_visitIntegerLiteral() {
@@ -2088,11 +2113,11 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitIsExpression_negated() {
- _assertSource("a is! C", AstFactory.isExpression(AstFactory.identifier3("a"), true, AstFactory.typeName4("C", [])));
+ _assertSource("a is! C", AstFactory.isExpression(AstFactory.identifier3("a"), true, AstFactory.typeName4("C")));
}
void test_visitIsExpression_normal() {
- _assertSource("a is C", AstFactory.isExpression(AstFactory.identifier3("a"), false, AstFactory.typeName4("C", [])));
+ _assertSource("a is C", AstFactory.isExpression(AstFactory.identifier3("a"), false, AstFactory.typeName4("C")));
}
void test_visitLabel() {
@@ -2100,11 +2125,11 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitLabeledStatement_multiple() {
- _assertSource("a: b: return;", AstFactory.labeledStatement(AstFactory.list([AstFactory.label2("a"), AstFactory.label2("b")]), AstFactory.returnStatement()));
+ _assertSource("a: b: return;", AstFactory.labeledStatement([AstFactory.label2("a"), AstFactory.label2("b")], AstFactory.returnStatement()));
}
void test_visitLabeledStatement_single() {
- _assertSource("a: return;", AstFactory.labeledStatement(AstFactory.list([AstFactory.label2("a")]), AstFactory.returnStatement()));
+ _assertSource("a: return;", AstFactory.labeledStatement([AstFactory.label2("a")], AstFactory.returnStatement()));
}
void test_visitLibraryDirective() {
@@ -2113,7 +2138,7 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitLibraryDirective_withMetadata() {
LibraryDirective directive = AstFactory.libraryDirective2("l");
- directive.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ directive.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated library l;", directive);
}
@@ -2129,11 +2154,11 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitListLiteral_const() {
- _assertSource("const []", AstFactory.listLiteral2(Keyword.CONST, null, []));
+ _assertSource("const []", AstFactory.listLiteral2(Keyword.CONST, null));
}
void test_visitListLiteral_empty() {
- _assertSource("[]", AstFactory.listLiteral([]));
+ _assertSource("[]", AstFactory.listLiteral());
}
void test_visitListLiteral_nonEmpty() {
@@ -2144,11 +2169,11 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitMapLiteral_const() {
- _assertSource("const {}", AstFactory.mapLiteral(Keyword.CONST, null, []));
+ _assertSource("const {}", AstFactory.mapLiteral(Keyword.CONST, null));
}
void test_visitMapLiteral_empty() {
- _assertSource("{}", AstFactory.mapLiteral2([]));
+ _assertSource("{}", AstFactory.mapLiteral2());
}
void test_visitMapLiteral_nonEmpty() {
@@ -2163,71 +2188,71 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitMethodDeclaration_external() {
- _assertSource("external m();", AstFactory.methodDeclaration(null, null, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([])));
+ _assertSource("external m();", AstFactory.methodDeclaration(null, null, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList()));
}
void test_visitMethodDeclaration_external_returnType() {
- _assertSource("external T m();", AstFactory.methodDeclaration(null, AstFactory.typeName4("T", []), null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([])));
+ _assertSource("external T m();", AstFactory.methodDeclaration(null, AstFactory.typeName4("T"), null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList()));
}
void test_visitMethodDeclaration_getter() {
- _assertSource("get m {}", AstFactory.methodDeclaration2(null, null, Keyword.GET, null, AstFactory.identifier3("m"), null, AstFactory.blockFunctionBody2([])));
+ _assertSource("get m {}", AstFactory.methodDeclaration2(null, null, Keyword.GET, null, AstFactory.identifier3("m"), null, AstFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_getter_returnType() {
- _assertSource("T get m {}", AstFactory.methodDeclaration2(null, AstFactory.typeName4("T", []), Keyword.GET, null, AstFactory.identifier3("m"), null, AstFactory.blockFunctionBody2([])));
+ _assertSource("T get m {}", AstFactory.methodDeclaration2(null, AstFactory.typeName4("T"), Keyword.GET, null, AstFactory.identifier3("m"), null, AstFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_getter_seturnType() {
- _assertSource("T set m(var v) {}", AstFactory.methodDeclaration2(null, AstFactory.typeName4("T", []), Keyword.SET, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([AstFactory.simpleFormalParameter(Keyword.VAR, "v")]), AstFactory.blockFunctionBody2([])));
+ _assertSource("T set m(var v) {}", AstFactory.methodDeclaration2(null, AstFactory.typeName4("T"), Keyword.SET, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([AstFactory.simpleFormalParameter(Keyword.VAR, "v")]), AstFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_minimal() {
- _assertSource("m() {}", AstFactory.methodDeclaration2(null, null, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([]), AstFactory.blockFunctionBody2([])));
+ _assertSource("m() {}", AstFactory.methodDeclaration2(null, null, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_multipleParameters() {
_assertSource("m(var a, var b) {}", AstFactory.methodDeclaration2(null, null, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([
AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
- AstFactory.simpleFormalParameter(Keyword.VAR, "b")]), AstFactory.blockFunctionBody2([])));
+ AstFactory.simpleFormalParameter(Keyword.VAR, "b")]), AstFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_operator() {
- _assertSource("operator +() {}", AstFactory.methodDeclaration2(null, null, null, Keyword.OPERATOR, AstFactory.identifier3("+"), AstFactory.formalParameterList([]), AstFactory.blockFunctionBody2([])));
+ _assertSource("operator +() {}", AstFactory.methodDeclaration2(null, null, null, Keyword.OPERATOR, AstFactory.identifier3("+"), AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_operator_returnType() {
- _assertSource("T operator +() {}", AstFactory.methodDeclaration2(null, AstFactory.typeName4("T", []), null, Keyword.OPERATOR, AstFactory.identifier3("+"), AstFactory.formalParameterList([]), AstFactory.blockFunctionBody2([])));
+ _assertSource("T operator +() {}", AstFactory.methodDeclaration2(null, AstFactory.typeName4("T"), null, Keyword.OPERATOR, AstFactory.identifier3("+"), AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_returnType() {
- _assertSource("T m() {}", AstFactory.methodDeclaration2(null, AstFactory.typeName4("T", []), null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([]), AstFactory.blockFunctionBody2([])));
+ _assertSource("T m() {}", AstFactory.methodDeclaration2(null, AstFactory.typeName4("T"), null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_setter() {
- _assertSource("set m(var v) {}", AstFactory.methodDeclaration2(null, null, Keyword.SET, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([AstFactory.simpleFormalParameter(Keyword.VAR, "v")]), AstFactory.blockFunctionBody2([])));
+ _assertSource("set m(var v) {}", AstFactory.methodDeclaration2(null, null, Keyword.SET, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([AstFactory.simpleFormalParameter(Keyword.VAR, "v")]), AstFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_static() {
- _assertSource("static m() {}", AstFactory.methodDeclaration2(Keyword.STATIC, null, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([]), AstFactory.blockFunctionBody2([])));
+ _assertSource("static m() {}", AstFactory.methodDeclaration2(Keyword.STATIC, null, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_static_returnType() {
- _assertSource("static T m() {}", AstFactory.methodDeclaration2(Keyword.STATIC, AstFactory.typeName4("T", []), null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([]), AstFactory.blockFunctionBody2([])));
+ _assertSource("static T m() {}", AstFactory.methodDeclaration2(Keyword.STATIC, AstFactory.typeName4("T"), null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_withMetadata() {
- MethodDeclaration declaration = AstFactory.methodDeclaration2(null, null, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList([]), AstFactory.blockFunctionBody2([]));
- declaration.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ MethodDeclaration declaration = AstFactory.methodDeclaration2(null, null, null, null, AstFactory.identifier3("m"), AstFactory.formalParameterList(), AstFactory.blockFunctionBody2());
+ declaration.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated m() {}", declaration);
}
void test_visitMethodInvocation_noTarget() {
- _assertSource("m()", AstFactory.methodInvocation2("m", []));
+ _assertSource("m()", AstFactory.methodInvocation2("m"));
}
void test_visitMethodInvocation_target() {
- _assertSource("t.m()", AstFactory.methodInvocation(AstFactory.identifier3("t"), "m", []));
+ _assertSource("t.m()", AstFactory.methodInvocation(AstFactory.identifier3("t"), "m"));
}
void test_visitNamedExpression() {
@@ -2260,7 +2285,7 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitPartDirective_withMetadata() {
PartDirective directive = AstFactory.partDirective2("a.dart");
- directive.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ directive.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated part 'a.dart';", directive);
}
@@ -2270,7 +2295,7 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitPartOfDirective_withMetadata() {
PartOfDirective directive = AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["l"]));
- directive.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ directive.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated part of l;", directive);
}
@@ -2295,11 +2320,11 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitRedirectingConstructorInvocation_named() {
- _assertSource("this.c()", AstFactory.redirectingConstructorInvocation2("c", []));
+ _assertSource("this.c()", AstFactory.redirectingConstructorInvocation2("c"));
}
void test_visitRedirectingConstructorInvocation_unnamed() {
- _assertSource("this()", AstFactory.redirectingConstructorInvocation([]));
+ _assertSource("this()", AstFactory.redirectingConstructorInvocation());
}
void test_visitRethrowExpression() {
@@ -2324,11 +2349,11 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitSimpleFormalParameter_keyword_type() {
- _assertSource("final A a", AstFactory.simpleFormalParameter2(Keyword.FINAL, AstFactory.typeName4("A", []), "a"));
+ _assertSource("final A a", AstFactory.simpleFormalParameter2(Keyword.FINAL, AstFactory.typeName4("A"), "a"));
}
void test_visitSimpleFormalParameter_type() {
- _assertSource("A a", AstFactory.simpleFormalParameter4(AstFactory.typeName4("A", []), "a"));
+ _assertSource("A a", AstFactory.simpleFormalParameter4(AstFactory.typeName4("A"), "a"));
}
void test_visitSimpleIdentifier() {
@@ -2347,11 +2372,11 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitSuperConstructorInvocation() {
- _assertSource("super()", AstFactory.superConstructorInvocation([]));
+ _assertSource("super()", AstFactory.superConstructorInvocation());
}
void test_visitSuperConstructorInvocation_named() {
- _assertSource("super.c()", AstFactory.superConstructorInvocation2("c", []));
+ _assertSource("super.c()", AstFactory.superConstructorInvocation2("c"));
}
void test_visitSuperExpression() {
@@ -2359,41 +2384,41 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitSwitchCase_multipleLabels() {
- _assertSource("l1: l2: case a: {}", AstFactory.switchCase2(AstFactory.list([AstFactory.label2("l1"), AstFactory.label2("l2")]), AstFactory.identifier3("a"), [AstFactory.block([])]));
+ _assertSource("l1: l2: case a: {}", AstFactory.switchCase2([AstFactory.label2("l1"), AstFactory.label2("l2")], AstFactory.identifier3("a"), [AstFactory.block()]));
}
void test_visitSwitchCase_multipleStatements() {
- _assertSource("case a: {} {}", AstFactory.switchCase(AstFactory.identifier3("a"), [AstFactory.block([]), AstFactory.block([])]));
+ _assertSource("case a: {} {}", AstFactory.switchCase(AstFactory.identifier3("a"), [AstFactory.block(), AstFactory.block()]));
}
void test_visitSwitchCase_noLabels() {
- _assertSource("case a: {}", AstFactory.switchCase(AstFactory.identifier3("a"), [AstFactory.block([])]));
+ _assertSource("case a: {}", AstFactory.switchCase(AstFactory.identifier3("a"), [AstFactory.block()]));
}
void test_visitSwitchCase_singleLabel() {
- _assertSource("l1: case a: {}", AstFactory.switchCase2(AstFactory.list([AstFactory.label2("l1")]), AstFactory.identifier3("a"), [AstFactory.block([])]));
+ _assertSource("l1: case a: {}", AstFactory.switchCase2([AstFactory.label2("l1")], AstFactory.identifier3("a"), [AstFactory.block()]));
}
void test_visitSwitchDefault_multipleLabels() {
- _assertSource("l1: l2: default: {}", AstFactory.switchDefault(AstFactory.list([AstFactory.label2("l1"), AstFactory.label2("l2")]), [AstFactory.block([])]));
+ _assertSource("l1: l2: default: {}", AstFactory.switchDefault([AstFactory.label2("l1"), AstFactory.label2("l2")], [AstFactory.block()]));
}
void test_visitSwitchDefault_multipleStatements() {
- _assertSource("default: {} {}", AstFactory.switchDefault2([AstFactory.block([]), AstFactory.block([])]));
+ _assertSource("default: {} {}", AstFactory.switchDefault2([AstFactory.block(), AstFactory.block()]));
}
void test_visitSwitchDefault_noLabels() {
- _assertSource("default: {}", AstFactory.switchDefault2([AstFactory.block([])]));
+ _assertSource("default: {}", AstFactory.switchDefault2([AstFactory.block()]));
}
void test_visitSwitchDefault_singleLabel() {
- _assertSource("l1: default: {}", AstFactory.switchDefault(AstFactory.list([AstFactory.label2("l1")]), [AstFactory.block([])]));
+ _assertSource("l1: default: {}", AstFactory.switchDefault([AstFactory.label2("l1")], [AstFactory.block()]));
}
void test_visitSwitchStatement() {
_assertSource("switch (a) {case 'b': {} default: {}}", AstFactory.switchStatement(AstFactory.identifier3("a"), [
- AstFactory.switchCase(AstFactory.string2("b"), [AstFactory.block([])]),
- AstFactory.switchDefault2([AstFactory.block([])])]));
+ AstFactory.switchCase(AstFactory.string2("b"), [AstFactory.block()]),
+ AstFactory.switchDefault2([AstFactory.block()])]));
}
void test_visitSymbolLiteral_multiple() {
@@ -2423,58 +2448,58 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitTryStatement_catch() {
- _assertSource("try {} on E {}", AstFactory.tryStatement2(AstFactory.block([]), [AstFactory.catchClause3(AstFactory.typeName4("E", []), [])]));
+ _assertSource("try {} on E {}", AstFactory.tryStatement2(AstFactory.block(), [AstFactory.catchClause3(AstFactory.typeName4("E"))]));
}
void test_visitTryStatement_catches() {
- _assertSource("try {} on E {} on F {}", AstFactory.tryStatement2(AstFactory.block([]), [
- AstFactory.catchClause3(AstFactory.typeName4("E", []), []),
- AstFactory.catchClause3(AstFactory.typeName4("F", []), [])]));
+ _assertSource("try {} on E {} on F {}", AstFactory.tryStatement2(AstFactory.block(), [
+ AstFactory.catchClause3(AstFactory.typeName4("E")),
+ AstFactory.catchClause3(AstFactory.typeName4("F"))]));
}
void test_visitTryStatement_catchFinally() {
- _assertSource("try {} on E {} finally {}", AstFactory.tryStatement3(AstFactory.block([]), AstFactory.list([AstFactory.catchClause3(AstFactory.typeName4("E", []), [])]), AstFactory.block([])));
+ _assertSource("try {} on E {} finally {}", AstFactory.tryStatement3(AstFactory.block(), [AstFactory.catchClause3(AstFactory.typeName4("E"))], AstFactory.block()));
}
void test_visitTryStatement_finally() {
- _assertSource("try {} finally {}", AstFactory.tryStatement(AstFactory.block([]), AstFactory.block([])));
+ _assertSource("try {} finally {}", AstFactory.tryStatement(AstFactory.block(), AstFactory.block()));
}
void test_visitTypeArgumentList_multiple() {
_assertSource("<E, F>", AstFactory.typeArgumentList([
- AstFactory.typeName4("E", []),
- AstFactory.typeName4("F", [])]));
+ AstFactory.typeName4("E"),
+ AstFactory.typeName4("F")]));
}
void test_visitTypeArgumentList_single() {
- _assertSource("<E>", AstFactory.typeArgumentList([AstFactory.typeName4("E", [])]));
+ _assertSource("<E>", AstFactory.typeArgumentList([AstFactory.typeName4("E")]));
}
void test_visitTypeName_multipleArgs() {
_assertSource("C<D, E>", AstFactory.typeName4("C", [
- AstFactory.typeName4("D", []),
- AstFactory.typeName4("E", [])]));
+ AstFactory.typeName4("D"),
+ AstFactory.typeName4("E")]));
}
void test_visitTypeName_nestedArg() {
- _assertSource("C<D<E>>", AstFactory.typeName4("C", [AstFactory.typeName4("D", [AstFactory.typeName4("E", [])])]));
+ _assertSource("C<D<E>>", AstFactory.typeName4("C", [AstFactory.typeName4("D", [AstFactory.typeName4("E")])]));
}
void test_visitTypeName_noArgs() {
- _assertSource("C", AstFactory.typeName4("C", []));
+ _assertSource("C", AstFactory.typeName4("C"));
}
void test_visitTypeName_singleArg() {
- _assertSource("C<D>", AstFactory.typeName4("C", [AstFactory.typeName4("D", [])]));
+ _assertSource("C<D>", AstFactory.typeName4("C", [AstFactory.typeName4("D")]));
}
void test_visitTypeParameter_withExtends() {
- _assertSource("E extends C", AstFactory.typeParameter2("E", AstFactory.typeName4("C", [])));
+ _assertSource("E extends C", AstFactory.typeParameter2("E", AstFactory.typeName4("C")));
}
void test_visitTypeParameter_withMetadata() {
TypeParameter parameter = AstFactory.typeParameter("E");
- parameter.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ parameter.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated E", parameter);
}
@@ -2500,12 +2525,12 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitVariableDeclaration_withMetadata() {
VariableDeclaration declaration = AstFactory.variableDeclaration("a");
- declaration.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ declaration.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated a", declaration);
}
void test_visitVariableDeclarationList_const_type() {
- _assertSource("const C a, b", AstFactory.variableDeclarationList(Keyword.CONST, AstFactory.typeName4("C", []), [
+ _assertSource("const C a, b", AstFactory.variableDeclarationList(Keyword.CONST, AstFactory.typeName4("C"), [
AstFactory.variableDeclaration("a"),
AstFactory.variableDeclaration("b")]));
}
@@ -2520,12 +2545,12 @@ class ToSourceVisitorTest extends EngineTestCase {
VariableDeclarationList declarationList = AstFactory.variableDeclarationList2(Keyword.FINAL, [
AstFactory.variableDeclaration("a"),
AstFactory.variableDeclaration("b")]);
- declarationList.metadata = AstFactory.list([AstFactory.annotation(AstFactory.identifier3("deprecated"))]);
+ declarationList.metadata = [AstFactory.annotation(AstFactory.identifier3("deprecated"))];
_assertSource("@deprecated final a, b", declarationList);
}
void test_visitVariableDeclarationList_type() {
- _assertSource("C a, b", AstFactory.variableDeclarationList(null, AstFactory.typeName4("C", []), [
+ _assertSource("C a, b", AstFactory.variableDeclarationList(null, AstFactory.typeName4("C"), [
AstFactory.variableDeclaration("a"),
AstFactory.variableDeclaration("b")]));
}
@@ -2537,22 +2562,22 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitVariableDeclarationStatement() {
- _assertSource("C c;", AstFactory.variableDeclarationStatement(null, AstFactory.typeName4("C", []), [AstFactory.variableDeclaration("c")]));
+ _assertSource("C c;", AstFactory.variableDeclarationStatement(null, AstFactory.typeName4("C"), [AstFactory.variableDeclaration("c")]));
}
void test_visitWhileStatement() {
- _assertSource("while (c) {}", AstFactory.whileStatement(AstFactory.identifier3("c"), AstFactory.block([])));
+ _assertSource("while (c) {}", AstFactory.whileStatement(AstFactory.identifier3("c"), AstFactory.block()));
}
void test_visitWithClause_multiple() {
_assertSource("with A, B, C", AstFactory.withClause([
- AstFactory.typeName4("A", []),
- AstFactory.typeName4("B", []),
- AstFactory.typeName4("C", [])]));
+ AstFactory.typeName4("A"),
+ AstFactory.typeName4("B"),
+ AstFactory.typeName4("C")]));
}
void test_visitWithClause_single() {
- _assertSource("with A", AstFactory.withClause([AstFactory.typeName4("A", [])]));
+ _assertSource("with A", AstFactory.withClause([AstFactory.typeName4("A")]));
}
void test_visitYieldStatement() {
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest.dart ('k') | pkg/analyzer/test/generated/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698