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

Unified Diff: pkg/analyzer/test/src/dart/ast/utilities_test.dart

Issue 2524903002: Rename AstFactory -> AstTestFactory. (Closed)
Patch Set: Created 4 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
Index: pkg/analyzer/test/src/dart/ast/utilities_test.dart
diff --git a/pkg/analyzer/test/src/dart/ast/utilities_test.dart b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
index 3d4364f62e00a61c76d697835613f6ba7f18d18b..5a18e5f54577f496662803e8dfc66396b4dab28c 100644
--- a/pkg/analyzer/test/src/dart/ast/utilities_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
@@ -13,7 +13,7 @@ import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/generated/java_core.dart';
import 'package:analyzer/src/generated/java_engine.dart' show Predicate;
import 'package:analyzer/src/generated/java_engine.dart';
-import 'package:analyzer/src/generated/testing/ast_factory.dart';
+import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
import 'package:analyzer/src/generated/testing/element_factory.dart';
import 'package:analyzer/src/generated/testing/token_factory.dart';
import 'package:test/test.dart';
@@ -457,34 +457,34 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitAnnotation() {
String annotationName = "proxy";
Annotation fromNode =
- AstFactory.annotation(AstFactory.identifier3(annotationName));
+ AstTestFactory.annotation(AstTestFactory.identifier3(annotationName));
Element element = ElementFactory.topLevelVariableElement2(annotationName);
fromNode.element = element;
Annotation toNode =
- AstFactory.annotation(AstFactory.identifier3(annotationName));
+ AstTestFactory.annotation(AstTestFactory.identifier3(annotationName));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
}
void test_visitAsExpression() {
- AsExpression fromNode = AstFactory.asExpression(
- AstFactory.identifier3("x"), AstFactory.typeName4("A"));
+ AsExpression fromNode = AstTestFactory.asExpression(
+ AstTestFactory.identifier3("x"), AstTestFactory.typeName4("A"));
DartType propagatedType = ElementFactory.classElement2("A").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("B").type;
fromNode.staticType = staticType;
- AsExpression toNode = AstFactory.asExpression(
- AstFactory.identifier3("x"), AstFactory.typeName4("A"));
+ AsExpression toNode = AstTestFactory.asExpression(
+ AstTestFactory.identifier3("x"), AstTestFactory.typeName4("A"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitAssignmentExpression() {
- AssignmentExpression fromNode = AstFactory.assignmentExpression(
- AstFactory.identifier3("a"),
+ AssignmentExpression fromNode = AstTestFactory.assignmentExpression(
+ AstTestFactory.identifier3("a"),
TokenType.PLUS_EQ,
- AstFactory.identifier3("b"));
+ AstTestFactory.identifier3("b"));
DartType propagatedType = ElementFactory.classElement2("C").type;
MethodElement propagatedElement =
ElementFactory.methodElement("+", propagatedType);
@@ -494,10 +494,10 @@ class ResolutionCopierTest extends EngineTestCase {
MethodElement staticElement = ElementFactory.methodElement("+", staticType);
fromNode.staticElement = staticElement;
fromNode.staticType = staticType;
- AssignmentExpression toNode = AstFactory.assignmentExpression(
- AstFactory.identifier3("a"),
+ AssignmentExpression toNode = AstTestFactory.assignmentExpression(
+ AstTestFactory.identifier3("a"),
TokenType.PLUS_EQ,
- AstFactory.identifier3("b"));
+ AstTestFactory.identifier3("b"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedElement, same(propagatedElement));
expect(toNode.propagatedType, same(propagatedType));
@@ -506,10 +506,10 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitBinaryExpression() {
- BinaryExpression fromNode = AstFactory.binaryExpression(
- AstFactory.identifier3("a"),
+ BinaryExpression fromNode = AstTestFactory.binaryExpression(
+ AstTestFactory.identifier3("a"),
TokenType.PLUS,
- AstFactory.identifier3("b"));
+ AstTestFactory.identifier3("b"));
DartType propagatedType = ElementFactory.classElement2("C").type;
MethodElement propagatedElement =
ElementFactory.methodElement("+", propagatedType);
@@ -519,10 +519,10 @@ class ResolutionCopierTest extends EngineTestCase {
MethodElement staticElement = ElementFactory.methodElement("+", staticType);
fromNode.staticElement = staticElement;
fromNode.staticType = staticType;
- BinaryExpression toNode = AstFactory.binaryExpression(
- AstFactory.identifier3("a"),
+ BinaryExpression toNode = AstTestFactory.binaryExpression(
+ AstTestFactory.identifier3("a"),
TokenType.PLUS,
- AstFactory.identifier3("b"));
+ AstTestFactory.identifier3("b"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedElement, same(propagatedElement));
expect(toNode.propagatedType, same(propagatedType));
@@ -531,54 +531,54 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitBooleanLiteral() {
- BooleanLiteral fromNode = AstFactory.booleanLiteral(true);
+ BooleanLiteral fromNode = AstTestFactory.booleanLiteral(true);
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- BooleanLiteral toNode = AstFactory.booleanLiteral(true);
+ BooleanLiteral toNode = AstTestFactory.booleanLiteral(true);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitCascadeExpression() {
- CascadeExpression fromNode = AstFactory.cascadeExpression(
- AstFactory.identifier3("a"), [AstFactory.identifier3("b")]);
+ CascadeExpression fromNode = AstTestFactory.cascadeExpression(
+ AstTestFactory.identifier3("a"), [AstTestFactory.identifier3("b")]);
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- CascadeExpression toNode = AstFactory.cascadeExpression(
- AstFactory.identifier3("a"), [AstFactory.identifier3("b")]);
+ CascadeExpression toNode = AstTestFactory.cascadeExpression(
+ AstTestFactory.identifier3("a"), [AstTestFactory.identifier3("b")]);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitCompilationUnit() {
- CompilationUnit fromNode = AstFactory.compilationUnit();
+ CompilationUnit fromNode = AstTestFactory.compilationUnit();
CompilationUnitElement element =
new CompilationUnitElementImpl("test.dart");
fromNode.element = element;
- CompilationUnit toNode = AstFactory.compilationUnit();
+ CompilationUnit toNode = AstTestFactory.compilationUnit();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
}
void test_visitConditionalExpression() {
- ConditionalExpression fromNode = AstFactory.conditionalExpression(
- AstFactory.identifier3("c"),
- AstFactory.identifier3("a"),
- AstFactory.identifier3("b"));
+ ConditionalExpression fromNode = AstTestFactory.conditionalExpression(
+ AstTestFactory.identifier3("c"),
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b"));
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- ConditionalExpression toNode = AstFactory.conditionalExpression(
- AstFactory.identifier3("c"),
- AstFactory.identifier3("a"),
- AstFactory.identifier3("b"));
+ ConditionalExpression toNode = AstTestFactory.conditionalExpression(
+ AstTestFactory.identifier3("c"),
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
@@ -587,18 +587,18 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitConstructorDeclaration() {
String className = "A";
String constructorName = "c";
- ConstructorDeclaration fromNode = AstFactory.constructorDeclaration(
- AstFactory.identifier3(className),
+ ConstructorDeclaration fromNode = AstTestFactory.constructorDeclaration(
+ AstTestFactory.identifier3(className),
constructorName,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
null);
ConstructorElement element = ElementFactory.constructorElement2(
ElementFactory.classElement2(className), constructorName);
fromNode.element = element;
- ConstructorDeclaration toNode = AstFactory.constructorDeclaration(
- AstFactory.identifier3(className),
+ ConstructorDeclaration toNode = AstTestFactory.constructorDeclaration(
+ AstTestFactory.identifier3(className),
constructorName,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
null);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
@@ -606,40 +606,41 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitConstructorName() {
ConstructorName fromNode =
- AstFactory.constructorName(AstFactory.typeName4("A"), "c");
+ AstTestFactory.constructorName(AstTestFactory.typeName4("A"), "c");
ConstructorElement staticElement = ElementFactory.constructorElement2(
ElementFactory.classElement2("A"), "c");
fromNode.staticElement = staticElement;
ConstructorName toNode =
- AstFactory.constructorName(AstFactory.typeName4("A"), "c");
+ AstTestFactory.constructorName(AstTestFactory.typeName4("A"), "c");
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.staticElement, same(staticElement));
}
void test_visitDoubleLiteral() {
- DoubleLiteral fromNode = AstFactory.doubleLiteral(1.0);
+ DoubleLiteral fromNode = AstTestFactory.doubleLiteral(1.0);
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- DoubleLiteral toNode = AstFactory.doubleLiteral(1.0);
+ DoubleLiteral toNode = AstTestFactory.doubleLiteral(1.0);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitExportDirective() {
- ExportDirective fromNode = AstFactory.exportDirective2("dart:uri");
+ ExportDirective fromNode = AstTestFactory.exportDirective2("dart:uri");
ExportElement element = new ExportElementImpl(-1);
fromNode.element = element;
- ExportDirective toNode = AstFactory.exportDirective2("dart:uri");
+ ExportDirective toNode = AstTestFactory.exportDirective2("dart:uri");
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
}
void test_visitFunctionExpression() {
- FunctionExpression fromNode = AstFactory.functionExpression2(
- AstFactory.formalParameterList(), AstFactory.emptyFunctionBody());
+ FunctionExpression fromNode = AstTestFactory.functionExpression2(
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.emptyFunctionBody());
MethodElement element = ElementFactory.methodElement(
"m", ElementFactory.classElement2("C").type);
fromNode.element = element;
@@ -647,8 +648,9 @@ class ResolutionCopierTest extends EngineTestCase {
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- FunctionExpression toNode = AstFactory.functionExpression2(
- AstFactory.formalParameterList(), AstFactory.emptyFunctionBody());
+ FunctionExpression toNode = AstTestFactory.functionExpression2(
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.emptyFunctionBody());
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
expect(toNode.propagatedType, same(propagatedType));
@@ -656,21 +658,21 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitFunctionExpressionInvocation() {
- FunctionExpressionInvocation fromNode =
- AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"));
+ FunctionExpressionInvocation fromNode = AstTestFactory
+ .functionExpressionInvocation(AstTestFactory.identifier3("f"));
MethodElement propagatedElement = ElementFactory.methodElement(
"m", ElementFactory.classElement2("C").type);
fromNode.propagatedElement = propagatedElement;
MethodElement staticElement = ElementFactory.methodElement(
"m", ElementFactory.classElement2("C").type);
fromNode.staticElement = staticElement;
- FunctionExpressionInvocation toNode =
- AstFactory.functionExpressionInvocation(AstFactory.identifier3("f"));
+ FunctionExpressionInvocation toNode = AstTestFactory
+ .functionExpressionInvocation(AstTestFactory.identifier3("f"));
ClassElement elementT = ElementFactory.classElement2('T');
- fromNode.typeArguments =
- AstFactory.typeArgumentList(<TypeName>[AstFactory.typeName(elementT)]);
- toNode.typeArguments =
- AstFactory.typeArgumentList(<TypeName>[AstFactory.typeName4('T')]);
+ fromNode.typeArguments = AstTestFactory
+ .typeArgumentList(<TypeName>[AstTestFactory.typeName(elementT)]);
+ toNode.typeArguments = AstTestFactory
+ .typeArgumentList(<TypeName>[AstTestFactory.typeName4('T')]);
_copyAndVerifyInvocation(fromNode, toNode);
@@ -679,17 +681,18 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitImportDirective() {
- ImportDirective fromNode = AstFactory.importDirective3("dart:uri", null);
+ ImportDirective fromNode =
+ AstTestFactory.importDirective3("dart:uri", null);
ImportElement element = new ImportElementImpl(0);
fromNode.element = element;
- ImportDirective toNode = AstFactory.importDirective3("dart:uri", null);
+ ImportDirective toNode = AstTestFactory.importDirective3("dart:uri", null);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
}
void test_visitIndexExpression() {
- IndexExpression fromNode = AstFactory.indexExpression(
- AstFactory.identifier3("a"), AstFactory.integer(0));
+ IndexExpression fromNode = AstTestFactory.indexExpression(
+ AstTestFactory.identifier3("a"), AstTestFactory.integer(0));
MethodElement propagatedElement = ElementFactory.methodElement(
"m", ElementFactory.classElement2("C").type);
MethodElement staticElement = ElementFactory.methodElement(
@@ -703,8 +706,8 @@ class ResolutionCopierTest extends EngineTestCase {
fromNode.staticElement = staticElement;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- IndexExpression toNode = AstFactory.indexExpression(
- AstFactory.identifier3("a"), AstFactory.integer(0));
+ IndexExpression toNode = AstTestFactory.indexExpression(
+ AstTestFactory.identifier3("a"), AstTestFactory.integer(0));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.auxiliaryElements, same(auxiliaryElements));
expect(toNode.propagatedElement, same(propagatedElement));
@@ -714,8 +717,9 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitInstanceCreationExpression() {
- InstanceCreationExpression fromNode = AstFactory
- .instanceCreationExpression2(Keyword.NEW, AstFactory.typeName4("C"));
+ InstanceCreationExpression fromNode =
+ AstTestFactory.instanceCreationExpression2(
+ Keyword.NEW, AstTestFactory.typeName4("C"));
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
ConstructorElement staticElement = ElementFactory.constructorElement2(
@@ -723,8 +727,9 @@ class ResolutionCopierTest extends EngineTestCase {
fromNode.staticElement = staticElement;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- InstanceCreationExpression toNode = AstFactory.instanceCreationExpression2(
- Keyword.NEW, AstFactory.typeName4("C"));
+ InstanceCreationExpression toNode =
+ AstTestFactory.instanceCreationExpression2(
+ Keyword.NEW, AstTestFactory.typeName4("C"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticElement, same(staticElement));
@@ -732,26 +737,26 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitIntegerLiteral() {
- IntegerLiteral fromNode = AstFactory.integer(2);
+ IntegerLiteral fromNode = AstTestFactory.integer(2);
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- IntegerLiteral toNode = AstFactory.integer(2);
+ IntegerLiteral toNode = AstTestFactory.integer(2);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitIsExpression() {
- IsExpression fromNode = AstFactory.isExpression(
- AstFactory.identifier3("x"), false, AstFactory.typeName4("A"));
+ IsExpression fromNode = AstTestFactory.isExpression(
+ AstTestFactory.identifier3("x"), false, AstTestFactory.typeName4("A"));
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- IsExpression toNode = AstFactory.isExpression(
- AstFactory.identifier3("x"), false, AstFactory.typeName4("A"));
+ IsExpression toNode = AstTestFactory.isExpression(
+ AstTestFactory.identifier3("x"), false, AstTestFactory.typeName4("A"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
@@ -759,74 +764,74 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitLibraryIdentifier() {
LibraryIdentifier fromNode =
- AstFactory.libraryIdentifier([AstFactory.identifier3("lib")]);
+ AstTestFactory.libraryIdentifier([AstTestFactory.identifier3("lib")]);
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
LibraryIdentifier toNode =
- AstFactory.libraryIdentifier([AstFactory.identifier3("lib")]);
+ AstTestFactory.libraryIdentifier([AstTestFactory.identifier3("lib")]);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitListLiteral() {
- ListLiteral fromNode = AstFactory.listLiteral();
+ ListLiteral fromNode = AstTestFactory.listLiteral();
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- ListLiteral toNode = AstFactory.listLiteral();
+ ListLiteral toNode = AstTestFactory.listLiteral();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitMapLiteral() {
- MapLiteral fromNode = AstFactory.mapLiteral2();
+ MapLiteral fromNode = AstTestFactory.mapLiteral2();
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- MapLiteral toNode = AstFactory.mapLiteral2();
+ MapLiteral toNode = AstTestFactory.mapLiteral2();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitMethodInvocation() {
- MethodInvocation fromNode = AstFactory.methodInvocation2("m");
- MethodInvocation toNode = AstFactory.methodInvocation2("m");
+ MethodInvocation fromNode = AstTestFactory.methodInvocation2("m");
+ MethodInvocation toNode = AstTestFactory.methodInvocation2("m");
ClassElement elementT = ElementFactory.classElement2('T');
- fromNode.typeArguments =
- AstFactory.typeArgumentList(<TypeName>[AstFactory.typeName(elementT)]);
- toNode.typeArguments =
- AstFactory.typeArgumentList(<TypeName>[AstFactory.typeName4('T')]);
+ fromNode.typeArguments = AstTestFactory
+ .typeArgumentList(<TypeName>[AstTestFactory.typeName(elementT)]);
+ toNode.typeArguments = AstTestFactory
+ .typeArgumentList(<TypeName>[AstTestFactory.typeName4('T')]);
_copyAndVerifyInvocation(fromNode, toNode);
}
void test_visitNamedExpression() {
NamedExpression fromNode =
- AstFactory.namedExpression2("n", AstFactory.integer(0));
+ AstTestFactory.namedExpression2("n", AstTestFactory.integer(0));
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
NamedExpression toNode =
- AstFactory.namedExpression2("n", AstFactory.integer(0));
+ AstTestFactory.namedExpression2("n", AstTestFactory.integer(0));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitNullLiteral() {
- NullLiteral fromNode = AstFactory.nullLiteral();
+ NullLiteral fromNode = AstTestFactory.nullLiteral();
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- NullLiteral toNode = AstFactory.nullLiteral();
+ NullLiteral toNode = AstTestFactory.nullLiteral();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
@@ -834,44 +839,44 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitParenthesizedExpression() {
ParenthesizedExpression fromNode =
- AstFactory.parenthesizedExpression(AstFactory.integer(0));
+ AstTestFactory.parenthesizedExpression(AstTestFactory.integer(0));
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
ParenthesizedExpression toNode =
- AstFactory.parenthesizedExpression(AstFactory.integer(0));
+ AstTestFactory.parenthesizedExpression(AstTestFactory.integer(0));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitPartDirective() {
- PartDirective fromNode = AstFactory.partDirective2("part.dart");
+ PartDirective fromNode = AstTestFactory.partDirective2("part.dart");
LibraryElement element = new LibraryElementImpl.forNode(
- null, AstFactory.libraryIdentifier2(["lib"]));
+ null, AstTestFactory.libraryIdentifier2(["lib"]));
fromNode.element = element;
- PartDirective toNode = AstFactory.partDirective2("part.dart");
+ PartDirective toNode = AstTestFactory.partDirective2("part.dart");
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
}
void test_visitPartOfDirective() {
- PartOfDirective fromNode =
- AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["lib"]));
+ PartOfDirective fromNode = AstTestFactory
+ .partOfDirective(AstTestFactory.libraryIdentifier2(["lib"]));
LibraryElement element = new LibraryElementImpl.forNode(
- null, AstFactory.libraryIdentifier2(["lib"]));
+ null, AstTestFactory.libraryIdentifier2(["lib"]));
fromNode.element = element;
- PartOfDirective toNode =
- AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["lib"]));
+ PartOfDirective toNode = AstTestFactory
+ .partOfDirective(AstTestFactory.libraryIdentifier2(["lib"]));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.element, same(element));
}
void test_visitPostfixExpression() {
String variableName = "x";
- PostfixExpression fromNode = AstFactory.postfixExpression(
- AstFactory.identifier3(variableName), TokenType.PLUS_PLUS);
+ PostfixExpression fromNode = AstTestFactory.postfixExpression(
+ AstTestFactory.identifier3(variableName), TokenType.PLUS_PLUS);
MethodElement propagatedElement = ElementFactory.methodElement(
"+", ElementFactory.classElement2("C").type);
fromNode.propagatedElement = propagatedElement;
@@ -882,8 +887,8 @@ class ResolutionCopierTest extends EngineTestCase {
fromNode.staticElement = staticElement;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- PostfixExpression toNode = AstFactory.postfixExpression(
- AstFactory.identifier3(variableName), TokenType.PLUS_PLUS);
+ PostfixExpression toNode = AstTestFactory.postfixExpression(
+ AstTestFactory.identifier3(variableName), TokenType.PLUS_PLUS);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedElement, same(propagatedElement));
expect(toNode.propagatedType, same(propagatedType));
@@ -892,20 +897,20 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitPrefixedIdentifier() {
- PrefixedIdentifier fromNode = AstFactory.identifier5("p", "f");
+ PrefixedIdentifier fromNode = AstTestFactory.identifier5("p", "f");
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- PrefixedIdentifier toNode = AstFactory.identifier5("p", "f");
+ PrefixedIdentifier toNode = AstTestFactory.identifier5("p", "f");
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitPrefixExpression() {
- PrefixExpression fromNode = AstFactory.prefixExpression(
- TokenType.PLUS_PLUS, AstFactory.identifier3("x"));
+ PrefixExpression fromNode = AstTestFactory.prefixExpression(
+ TokenType.PLUS_PLUS, AstTestFactory.identifier3("x"));
MethodElement propagatedElement = ElementFactory.methodElement(
"+", ElementFactory.classElement2("C").type);
DartType propagatedType = ElementFactory.classElement2("C").type;
@@ -916,8 +921,8 @@ class ResolutionCopierTest extends EngineTestCase {
"+", ElementFactory.classElement2("C").type);
fromNode.staticElement = staticElement;
fromNode.staticType = staticType;
- PrefixExpression toNode = AstFactory.prefixExpression(
- TokenType.PLUS_PLUS, AstFactory.identifier3("x"));
+ PrefixExpression toNode = AstTestFactory.prefixExpression(
+ TokenType.PLUS_PLUS, AstTestFactory.identifier3("x"));
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedElement, same(propagatedElement));
expect(toNode.propagatedType, same(propagatedType));
@@ -927,13 +932,13 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitPropertyAccess() {
PropertyAccess fromNode =
- AstFactory.propertyAccess2(AstFactory.identifier3("x"), "y");
+ AstTestFactory.propertyAccess2(AstTestFactory.identifier3("x"), "y");
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
PropertyAccess toNode =
- AstFactory.propertyAccess2(AstFactory.identifier3("x"), "y");
+ AstTestFactory.propertyAccess2(AstTestFactory.identifier3("x"), "y");
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
@@ -941,30 +946,30 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitRedirectingConstructorInvocation() {
RedirectingConstructorInvocation fromNode =
- AstFactory.redirectingConstructorInvocation();
+ AstTestFactory.redirectingConstructorInvocation();
ConstructorElement staticElement = ElementFactory.constructorElement2(
ElementFactory.classElement2("C"), null);
fromNode.staticElement = staticElement;
RedirectingConstructorInvocation toNode =
- AstFactory.redirectingConstructorInvocation();
+ AstTestFactory.redirectingConstructorInvocation();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.staticElement, same(staticElement));
}
void test_visitRethrowExpression() {
- RethrowExpression fromNode = AstFactory.rethrowExpression();
+ RethrowExpression fromNode = AstTestFactory.rethrowExpression();
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- RethrowExpression toNode = AstFactory.rethrowExpression();
+ RethrowExpression toNode = AstTestFactory.rethrowExpression();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitSimpleIdentifier() {
- SimpleIdentifier fromNode = AstFactory.identifier3("x");
+ SimpleIdentifier fromNode = AstTestFactory.identifier3("x");
MethodElement propagatedElement = ElementFactory.methodElement(
"m", ElementFactory.classElement2("C").type);
MethodElement staticElement = ElementFactory.methodElement(
@@ -978,7 +983,7 @@ class ResolutionCopierTest extends EngineTestCase {
fromNode.staticElement = staticElement;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- SimpleIdentifier toNode = AstFactory.identifier3("x");
+ SimpleIdentifier toNode = AstTestFactory.identifier3("x");
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.auxiliaryElements, same(auxiliaryElements));
expect(toNode.propagatedElement, same(propagatedElement));
@@ -988,12 +993,12 @@ class ResolutionCopierTest extends EngineTestCase {
}
void test_visitSimpleStringLiteral() {
- SimpleStringLiteral fromNode = AstFactory.string2("abc");
+ SimpleStringLiteral fromNode = AstTestFactory.string2("abc");
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- SimpleStringLiteral toNode = AstFactory.string2("abc");
+ SimpleStringLiteral toNode = AstTestFactory.string2("abc");
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
@@ -1001,13 +1006,13 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitStringInterpolation() {
StringInterpolation fromNode =
- AstFactory.string([AstFactory.interpolationString("a", "'a'")]);
+ AstTestFactory.string([AstTestFactory.interpolationString("a", "'a'")]);
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
StringInterpolation toNode =
- AstFactory.string([AstFactory.interpolationString("a", "'a'")]);
+ AstTestFactory.string([AstTestFactory.interpolationString("a", "'a'")]);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
@@ -1015,68 +1020,69 @@ class ResolutionCopierTest extends EngineTestCase {
void test_visitSuperConstructorInvocation() {
SuperConstructorInvocation fromNode =
- AstFactory.superConstructorInvocation();
+ AstTestFactory.superConstructorInvocation();
ConstructorElement staticElement = ElementFactory.constructorElement2(
ElementFactory.classElement2("C"), null);
fromNode.staticElement = staticElement;
- SuperConstructorInvocation toNode = AstFactory.superConstructorInvocation();
+ SuperConstructorInvocation toNode =
+ AstTestFactory.superConstructorInvocation();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.staticElement, same(staticElement));
}
void test_visitSuperExpression() {
- SuperExpression fromNode = AstFactory.superExpression();
+ SuperExpression fromNode = AstTestFactory.superExpression();
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- SuperExpression toNode = AstFactory.superExpression();
+ SuperExpression toNode = AstTestFactory.superExpression();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitSymbolLiteral() {
- SymbolLiteral fromNode = AstFactory.symbolLiteral(["s"]);
+ SymbolLiteral fromNode = AstTestFactory.symbolLiteral(["s"]);
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- SymbolLiteral toNode = AstFactory.symbolLiteral(["s"]);
+ SymbolLiteral toNode = AstTestFactory.symbolLiteral(["s"]);
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitThisExpression() {
- ThisExpression fromNode = AstFactory.thisExpression();
+ ThisExpression fromNode = AstTestFactory.thisExpression();
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- ThisExpression toNode = AstFactory.thisExpression();
+ ThisExpression toNode = AstTestFactory.thisExpression();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitThrowExpression() {
- ThrowExpression fromNode = AstFactory.throwExpression();
+ ThrowExpression fromNode = AstTestFactory.throwExpression();
DartType propagatedType = ElementFactory.classElement2("C").type;
fromNode.propagatedType = propagatedType;
DartType staticType = ElementFactory.classElement2("C").type;
fromNode.staticType = staticType;
- ThrowExpression toNode = AstFactory.throwExpression();
+ ThrowExpression toNode = AstTestFactory.throwExpression();
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.propagatedType, same(propagatedType));
expect(toNode.staticType, same(staticType));
}
void test_visitTypeName() {
- TypeName fromNode = AstFactory.typeName4("C");
+ TypeName fromNode = AstTestFactory.typeName4("C");
DartType type = ElementFactory.classElement2("C").type;
fromNode.type = type;
- TypeName toNode = AstFactory.typeName4("C");
+ TypeName toNode = AstTestFactory.typeName4("C");
ResolutionCopier.copyResolutionData(fromNode, toNode);
expect(toNode.type, same(type));
}
@@ -1115,246 +1121,257 @@ class ToSourceVisitor2Test extends EngineTestCase {
void test_visitAdjacentStrings() {
_assertSource(
"'a' 'b'",
- AstFactory.adjacentStrings(
- [AstFactory.string2("a"), AstFactory.string2("b")]));
+ AstTestFactory.adjacentStrings(
+ [AstTestFactory.string2("a"), AstTestFactory.string2("b")]));
}
void test_visitAnnotation_constant() {
- _assertSource("@A", AstFactory.annotation(AstFactory.identifier3("A")));
+ _assertSource(
+ "@A", AstTestFactory.annotation(AstTestFactory.identifier3("A")));
}
void test_visitAnnotation_constructor() {
_assertSource(
"@A.c()",
- AstFactory.annotation2(AstFactory.identifier3("A"),
- AstFactory.identifier3("c"), AstFactory.argumentList()));
+ AstTestFactory.annotation2(AstTestFactory.identifier3("A"),
+ AstTestFactory.identifier3("c"), AstTestFactory.argumentList()));
}
void test_visitArgumentList() {
_assertSource(
"(a, b)",
- AstFactory.argumentList(
- [AstFactory.identifier3("a"), AstFactory.identifier3("b")]));
+ AstTestFactory.argumentList([
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b")
+ ]));
}
void test_visitAsExpression() {
_assertSource(
"e as T",
- AstFactory.asExpression(
- AstFactory.identifier3("e"), AstFactory.typeName4("T")));
+ AstTestFactory.asExpression(
+ AstTestFactory.identifier3("e"), AstTestFactory.typeName4("T")));
}
void test_visitAssertStatement() {
- _assertSource(
- "assert (a);", AstFactory.assertStatement(AstFactory.identifier3("a")));
+ _assertSource("assert (a);",
+ AstTestFactory.assertStatement(AstTestFactory.identifier3("a")));
}
void test_visitAssertStatement_withMessage() {
_assertSource(
"assert (a, b);",
- AstFactory.assertStatement(
- AstFactory.identifier3("a"), AstFactory.identifier3('b')));
+ AstTestFactory.assertStatement(
+ AstTestFactory.identifier3("a"), AstTestFactory.identifier3('b')));
}
void test_visitAssignmentExpression() {
_assertSource(
"a = b",
- AstFactory.assignmentExpression(AstFactory.identifier3("a"),
- TokenType.EQ, AstFactory.identifier3("b")));
+ AstTestFactory.assignmentExpression(AstTestFactory.identifier3("a"),
+ TokenType.EQ, AstTestFactory.identifier3("b")));
}
void test_visitAwaitExpression() {
- _assertSource(
- "await e", AstFactory.awaitExpression(AstFactory.identifier3("e")));
+ _assertSource("await e",
+ AstTestFactory.awaitExpression(AstTestFactory.identifier3("e")));
}
void test_visitBinaryExpression() {
_assertSource(
"a + b",
- AstFactory.binaryExpression(AstFactory.identifier3("a"), TokenType.PLUS,
- AstFactory.identifier3("b")));
+ AstTestFactory.binaryExpression(AstTestFactory.identifier3("a"),
+ TokenType.PLUS, AstTestFactory.identifier3("b")));
}
void test_visitBlock_empty() {
- _assertSource("{}", AstFactory.block());
+ _assertSource("{}", AstTestFactory.block());
}
void test_visitBlock_nonEmpty() {
_assertSource(
"{break; break;}",
- AstFactory
- .block([AstFactory.breakStatement(), AstFactory.breakStatement()]));
+ AstTestFactory.block([
+ AstTestFactory.breakStatement(),
+ AstTestFactory.breakStatement()
+ ]));
}
void test_visitBlockFunctionBody_async() {
- _assertSource("async {}", AstFactory.asyncBlockFunctionBody());
+ _assertSource("async {}", AstTestFactory.asyncBlockFunctionBody());
}
void test_visitBlockFunctionBody_async_star() {
- _assertSource("async* {}", AstFactory.asyncGeneratorBlockFunctionBody());
+ _assertSource(
+ "async* {}", AstTestFactory.asyncGeneratorBlockFunctionBody());
}
void test_visitBlockFunctionBody_simple() {
- _assertSource("{}", AstFactory.blockFunctionBody2());
+ _assertSource("{}", AstTestFactory.blockFunctionBody2());
}
void test_visitBlockFunctionBody_sync() {
- _assertSource("sync {}", AstFactory.syncBlockFunctionBody());
+ _assertSource("sync {}", AstTestFactory.syncBlockFunctionBody());
}
void test_visitBlockFunctionBody_sync_star() {
- _assertSource("sync* {}", AstFactory.syncGeneratorBlockFunctionBody());
+ _assertSource("sync* {}", AstTestFactory.syncGeneratorBlockFunctionBody());
}
void test_visitBooleanLiteral_false() {
- _assertSource("false", AstFactory.booleanLiteral(false));
+ _assertSource("false", AstTestFactory.booleanLiteral(false));
}
void test_visitBooleanLiteral_true() {
- _assertSource("true", AstFactory.booleanLiteral(true));
+ _assertSource("true", AstTestFactory.booleanLiteral(true));
}
void test_visitBreakStatement_label() {
- _assertSource("break l;", AstFactory.breakStatement2("l"));
+ _assertSource("break l;", AstTestFactory.breakStatement2("l"));
}
void test_visitBreakStatement_noLabel() {
- _assertSource("break;", AstFactory.breakStatement());
+ _assertSource("break;", AstTestFactory.breakStatement());
}
void test_visitCascadeExpression_field() {
_assertSource(
"a..b..c",
- AstFactory.cascadeExpression(AstFactory.identifier3("a"), [
- AstFactory.cascadedPropertyAccess("b"),
- AstFactory.cascadedPropertyAccess("c")
+ AstTestFactory.cascadeExpression(AstTestFactory.identifier3("a"), [
+ AstTestFactory.cascadedPropertyAccess("b"),
+ AstTestFactory.cascadedPropertyAccess("c")
]));
}
void test_visitCascadeExpression_index() {
_assertSource(
"a..[0]..[1]",
- AstFactory.cascadeExpression(AstFactory.identifier3("a"), [
- AstFactory.cascadedIndexExpression(AstFactory.integer(0)),
- AstFactory.cascadedIndexExpression(AstFactory.integer(1))
+ AstTestFactory.cascadeExpression(AstTestFactory.identifier3("a"), [
+ AstTestFactory.cascadedIndexExpression(AstTestFactory.integer(0)),
+ AstTestFactory.cascadedIndexExpression(AstTestFactory.integer(1))
]));
}
void test_visitCascadeExpression_method() {
_assertSource(
"a..b()..c()",
- AstFactory.cascadeExpression(AstFactory.identifier3("a"), [
- AstFactory.cascadedMethodInvocation("b"),
- AstFactory.cascadedMethodInvocation("c")
+ AstTestFactory.cascadeExpression(AstTestFactory.identifier3("a"), [
+ AstTestFactory.cascadedMethodInvocation("b"),
+ AstTestFactory.cascadedMethodInvocation("c")
]));
}
void test_visitCatchClause_catch_noStack() {
- _assertSource("catch (e) {}", AstFactory.catchClause("e"));
+ _assertSource("catch (e) {}", AstTestFactory.catchClause("e"));
}
void test_visitCatchClause_catch_stack() {
- _assertSource("catch (e, s) {}", AstFactory.catchClause2("e", "s"));
+ _assertSource("catch (e, s) {}", AstTestFactory.catchClause2("e", "s"));
}
void test_visitCatchClause_on() {
_assertSource(
- "on E {}", AstFactory.catchClause3(AstFactory.typeName4("E")));
+ "on E {}", AstTestFactory.catchClause3(AstTestFactory.typeName4("E")));
}
void test_visitCatchClause_on_catch() {
_assertSource("on E catch (e) {}",
- AstFactory.catchClause4(AstFactory.typeName4("E"), "e"));
+ AstTestFactory.catchClause4(AstTestFactory.typeName4("E"), "e"));
}
void test_visitClassDeclaration_abstract() {
_assertSource(
"abstract class C {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
Keyword.ABSTRACT, "C", null, null, null, null));
}
void test_visitClassDeclaration_empty() {
_assertSource("class C {}",
- AstFactory.classDeclaration(null, "C", null, null, null, null));
+ AstTestFactory.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));
+ AstTestFactory.classDeclaration(
+ null,
+ "C",
+ null,
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
+ null,
+ null));
}
void test_visitClassDeclaration_extends_implements() {
_assertSource(
"class C extends A implements B {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
null,
- AstFactory.extendsClause(AstFactory.typeName4("A")),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
null,
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_extends_with() {
_assertSource(
"class C extends A with M {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
null,
- AstFactory.extendsClause(AstFactory.typeName4("A")),
- AstFactory.withClause([AstFactory.typeName4("M")]),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M")]),
null));
}
void test_visitClassDeclaration_extends_with_implements() {
_assertSource(
"class C extends A with M implements B {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
null,
- AstFactory.extendsClause(AstFactory.typeName4("A")),
- AstFactory.withClause([AstFactory.typeName4("M")]),
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M")]),
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_implements() {
_assertSource(
"class C implements B {}",
- AstFactory.classDeclaration(null, "C", null, null, null,
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.classDeclaration(null, "C", null, null, null,
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_multipleMember() {
_assertSource(
"class C {var a; var b;}",
- AstFactory.classDeclaration(null, "C", null, null, null, null, [
- AstFactory.fieldDeclaration2(
- false, Keyword.VAR, [AstFactory.variableDeclaration("a")]),
- AstFactory.fieldDeclaration2(
- false, Keyword.VAR, [AstFactory.variableDeclaration("b")])
+ AstTestFactory.classDeclaration(null, "C", null, null, null, null, [
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration("a")]),
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration("b")])
]));
}
void test_visitClassDeclaration_parameters() {
_assertSource(
"class C<E> {}",
- AstFactory.classDeclaration(
- null, "C", AstFactory.typeParameterList(["E"]), null, null, null));
+ AstTestFactory.classDeclaration(null, "C",
+ AstTestFactory.typeParameterList(["E"]), null, null, null));
}
void test_visitClassDeclaration_parameters_extends() {
_assertSource(
"class C<E> extends A {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
- AstFactory.typeParameterList(["E"]),
- AstFactory.extendsClause(AstFactory.typeName4("A")),
+ AstTestFactory.typeParameterList(["E"]),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
null,
null));
}
@@ -1362,102 +1379,102 @@ class ToSourceVisitor2Test extends EngineTestCase {
void test_visitClassDeclaration_parameters_extends_implements() {
_assertSource(
"class C<E> extends A implements B {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
- AstFactory.typeParameterList(["E"]),
- AstFactory.extendsClause(AstFactory.typeName4("A")),
+ AstTestFactory.typeParameterList(["E"]),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
null,
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_parameters_extends_with() {
_assertSource(
"class C<E> extends A with M {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
- AstFactory.typeParameterList(["E"]),
- AstFactory.extendsClause(AstFactory.typeName4("A")),
- AstFactory.withClause([AstFactory.typeName4("M")]),
+ AstTestFactory.typeParameterList(["E"]),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M")]),
null));
}
void test_visitClassDeclaration_parameters_extends_with_implements() {
_assertSource(
"class C<E> extends A with M implements B {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
- AstFactory.typeParameterList(["E"]),
- AstFactory.extendsClause(AstFactory.typeName4("A")),
- AstFactory.withClause([AstFactory.typeName4("M")]),
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.typeParameterList(["E"]),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M")]),
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_parameters_implements() {
_assertSource(
"class C<E> implements B {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
- AstFactory.typeParameterList(["E"]),
+ AstTestFactory.typeParameterList(["E"]),
null,
null,
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_singleMember() {
_assertSource(
"class C {var a;}",
- AstFactory.classDeclaration(null, "C", null, null, null, null, [
- AstFactory.fieldDeclaration2(
- false, Keyword.VAR, [AstFactory.variableDeclaration("a")])
+ AstTestFactory.classDeclaration(null, "C", null, null, null, null, [
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration("a")])
]));
}
void test_visitClassDeclaration_withMetadata() {
ClassDeclaration declaration =
- AstFactory.classDeclaration(null, "C", null, null, null, null);
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ AstTestFactory.classDeclaration(null, "C", null, null, null, null);
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated class C {}", declaration);
}
void test_visitClassTypeAlias_abstract() {
_assertSource(
"abstract class C = S with M1;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
null,
Keyword.ABSTRACT,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
null));
}
void test_visitClassTypeAlias_abstract_implements() {
_assertSource(
"abstract class C = S with M1 implements I;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
null,
Keyword.ABSTRACT,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
- AstFactory.implementsClause([AstFactory.typeName4("I")])));
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("I")])));
}
void test_visitClassTypeAlias_generic() {
_assertSource(
"class C<E> = S<E> with M1<E>;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
- AstFactory.typeParameterList(["E"]),
+ AstTestFactory.typeParameterList(["E"]),
null,
- AstFactory.typeName4("S", [AstFactory.typeName4("E")]),
- AstFactory.withClause([
- AstFactory.typeName4("M1", [AstFactory.typeName4("E")])
+ AstTestFactory.typeName4("S", [AstTestFactory.typeName4("E")]),
+ AstTestFactory.withClause([
+ AstTestFactory.typeName4("M1", [AstTestFactory.typeName4("E")])
]),
null));
}
@@ -1465,68 +1482,73 @@ class ToSourceVisitor2Test extends EngineTestCase {
void test_visitClassTypeAlias_implements() {
_assertSource(
"class C = S with M1 implements I;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
null,
null,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
- AstFactory.implementsClause([AstFactory.typeName4("I")])));
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
+ AstTestFactory.implementsClause([AstTestFactory.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));
+ AstTestFactory.classTypeAlias(
+ "C",
+ null,
+ null,
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
+ null));
}
void test_visitClassTypeAlias_parameters_abstract() {
_assertSource(
"abstract class C<E> = S with M1;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
- AstFactory.typeParameterList(["E"]),
+ AstTestFactory.typeParameterList(["E"]),
Keyword.ABSTRACT,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
null));
}
void test_visitClassTypeAlias_parameters_abstract_implements() {
_assertSource(
"abstract class C<E> = S with M1 implements I;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
- AstFactory.typeParameterList(["E"]),
+ AstTestFactory.typeParameterList(["E"]),
Keyword.ABSTRACT,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
- AstFactory.implementsClause([AstFactory.typeName4("I")])));
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("I")])));
}
void test_visitClassTypeAlias_parameters_implements() {
_assertSource(
"class C<E> = S with M1 implements I;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
- AstFactory.typeParameterList(["E"]),
+ AstTestFactory.typeParameterList(["E"]),
null,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
- AstFactory.implementsClause([AstFactory.typeName4("I")])));
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("I")])));
}
void test_visitClassTypeAlias_withMetadata() {
- ClassTypeAlias declaration = AstFactory.classTypeAlias(
+ ClassTypeAlias declaration = AstTestFactory.classTypeAlias(
"C",
null,
null,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
null);
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated class C = S with M1;", declaration);
}
@@ -1538,374 +1560,388 @@ class ToSourceVisitor2Test extends EngineTestCase {
}
void test_visitCommentReference() {
- _assertSource("", new CommentReference(null, AstFactory.identifier3("a")));
+ _assertSource(
+ "", new CommentReference(null, AstTestFactory.identifier3("a")));
}
void test_visitCompilationUnit_declaration() {
_assertSource(
"var a;",
- AstFactory.compilationUnit2([
- AstFactory.topLevelVariableDeclaration2(
- Keyword.VAR, [AstFactory.variableDeclaration("a")])
+ AstTestFactory.compilationUnit2([
+ AstTestFactory.topLevelVariableDeclaration2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("a")])
]));
}
void test_visitCompilationUnit_directive() {
- _assertSource("library l;",
- AstFactory.compilationUnit3([AstFactory.libraryDirective2("l")]));
+ _assertSource(
+ "library l;",
+ AstTestFactory
+ .compilationUnit3([AstTestFactory.libraryDirective2("l")]));
}
void test_visitCompilationUnit_directive_declaration() {
_assertSource(
"library l; var a;",
- AstFactory.compilationUnit4([
- AstFactory.libraryDirective2("l")
+ AstTestFactory.compilationUnit4([
+ AstTestFactory.libraryDirective2("l")
], [
- AstFactory.topLevelVariableDeclaration2(
- Keyword.VAR, [AstFactory.variableDeclaration("a")])
+ AstTestFactory.topLevelVariableDeclaration2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("a")])
]));
}
void test_visitCompilationUnit_empty() {
- _assertSource("", AstFactory.compilationUnit());
+ _assertSource("", AstTestFactory.compilationUnit());
}
void test_visitCompilationUnit_script() {
_assertSource(
- "!#/bin/dartvm", AstFactory.compilationUnit5("!#/bin/dartvm"));
+ "!#/bin/dartvm", AstTestFactory.compilationUnit5("!#/bin/dartvm"));
}
void test_visitCompilationUnit_script_declaration() {
_assertSource(
"!#/bin/dartvm var a;",
- AstFactory.compilationUnit6("!#/bin/dartvm", [
- AstFactory.topLevelVariableDeclaration2(
- Keyword.VAR, [AstFactory.variableDeclaration("a")])
+ AstTestFactory.compilationUnit6("!#/bin/dartvm", [
+ AstTestFactory.topLevelVariableDeclaration2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("a")])
]));
}
void test_visitCompilationUnit_script_directive() {
_assertSource(
"!#/bin/dartvm library l;",
- AstFactory.compilationUnit7(
- "!#/bin/dartvm", [AstFactory.libraryDirective2("l")]));
+ AstTestFactory.compilationUnit7(
+ "!#/bin/dartvm", [AstTestFactory.libraryDirective2("l")]));
}
void test_visitCompilationUnit_script_directives_declarations() {
_assertSource(
"!#/bin/dartvm library l; var a;",
- AstFactory.compilationUnit8("!#/bin/dartvm", [
- AstFactory.libraryDirective2("l")
+ AstTestFactory.compilationUnit8("!#/bin/dartvm", [
+ AstTestFactory.libraryDirective2("l")
], [
- AstFactory.topLevelVariableDeclaration2(
- Keyword.VAR, [AstFactory.variableDeclaration("a")])
+ AstTestFactory.topLevelVariableDeclaration2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("a")])
]));
}
void test_visitConditionalExpression() {
_assertSource(
"a ? b : c",
- AstFactory.conditionalExpression(AstFactory.identifier3("a"),
- AstFactory.identifier3("b"), AstFactory.identifier3("c")));
+ AstTestFactory.conditionalExpression(AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b"), AstTestFactory.identifier3("c")));
}
void test_visitConstructorDeclaration_const() {
_assertSource(
"const C() {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
Keyword.CONST,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_external() {
_assertSource(
"external C();",
- AstFactory.constructorDeclaration(AstFactory.identifier3("C"), null,
- AstFactory.formalParameterList(), null));
+ AstTestFactory.constructorDeclaration(AstTestFactory.identifier3("C"),
+ null, AstTestFactory.formalParameterList(), null));
}
void test_visitConstructorDeclaration_minimal() {
_assertSource(
"C() {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_multipleInitializers() {
_assertSource(
"C() : a = b, c = d {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
[
- AstFactory.constructorFieldInitializer(
- false, "a", AstFactory.identifier3("b")),
- AstFactory.constructorFieldInitializer(
- false, "c", AstFactory.identifier3("d"))
+ AstTestFactory.constructorFieldInitializer(
+ false, "a", AstTestFactory.identifier3("b")),
+ AstTestFactory.constructorFieldInitializer(
+ false, "c", AstTestFactory.identifier3("d"))
],
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_multipleParameters() {
_assertSource(
"C(var a, var b) {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
- AstFactory.simpleFormalParameter(Keyword.VAR, "b")
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "a"),
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "b")
]),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_named() {
_assertSource(
"C.m() {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
"m",
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_singleInitializer() {
_assertSource(
"C() : a = b {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
[
- AstFactory.constructorFieldInitializer(
- false, "a", AstFactory.identifier3("b"))
+ AstTestFactory.constructorFieldInitializer(
+ false, "a", AstTestFactory.identifier3("b"))
],
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_withMetadata() {
- ConstructorDeclaration declaration = AstFactory.constructorDeclaration2(
+ ConstructorDeclaration declaration = AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
null,
- AstFactory.blockFunctionBody2());
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ AstTestFactory.blockFunctionBody2());
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated C() {}", declaration);
}
void test_visitConstructorFieldInitializer_withoutThis() {
_assertSource(
"a = b",
- AstFactory.constructorFieldInitializer(
- false, "a", AstFactory.identifier3("b")));
+ AstTestFactory.constructorFieldInitializer(
+ false, "a", AstTestFactory.identifier3("b")));
}
void test_visitConstructorFieldInitializer_withThis() {
_assertSource(
"this.a = b",
- AstFactory.constructorFieldInitializer(
- true, "a", AstFactory.identifier3("b")));
+ AstTestFactory.constructorFieldInitializer(
+ true, "a", AstTestFactory.identifier3("b")));
}
void test_visitConstructorName_named_prefix() {
- _assertSource("p.C.n",
- AstFactory.constructorName(AstFactory.typeName4("p.C.n"), null));
+ _assertSource(
+ "p.C.n",
+ AstTestFactory.constructorName(
+ AstTestFactory.typeName4("p.C.n"), null));
}
void test_visitConstructorName_unnamed_noPrefix() {
- _assertSource(
- "C", AstFactory.constructorName(AstFactory.typeName4("C"), null));
+ _assertSource("C",
+ AstTestFactory.constructorName(AstTestFactory.typeName4("C"), null));
}
void test_visitConstructorName_unnamed_prefix() {
_assertSource(
"p.C",
- AstFactory.constructorName(
- AstFactory.typeName3(AstFactory.identifier5("p", "C")), null));
+ AstTestFactory.constructorName(
+ AstTestFactory.typeName3(AstTestFactory.identifier5("p", "C")),
+ null));
}
void test_visitContinueStatement_label() {
- _assertSource("continue l;", AstFactory.continueStatement("l"));
+ _assertSource("continue l;", AstTestFactory.continueStatement("l"));
}
void test_visitContinueStatement_noLabel() {
- _assertSource("continue;", AstFactory.continueStatement());
+ _assertSource("continue;", AstTestFactory.continueStatement());
}
void test_visitDefaultFormalParameter_annotation() {
- DefaultFormalParameter parameter = AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0));
- parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ DefaultFormalParameter parameter = AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("p"), AstTestFactory.integer(0));
+ parameter.metadata
+ .add(AstTestFactory.annotation(AstTestFactory.identifier3("A")));
_assertSource('@A p = 0', parameter);
}
void test_visitDefaultFormalParameter_named_noValue() {
_assertSource(
"p",
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("p"), null));
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("p"), null));
}
void test_visitDefaultFormalParameter_named_value() {
_assertSource(
"p : 0",
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0)));
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("p"),
+ AstTestFactory.integer(0)));
}
void test_visitDefaultFormalParameter_positional_noValue() {
_assertSource(
"p",
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("p"), null));
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("p"), null));
}
void test_visitDefaultFormalParameter_positional_value() {
_assertSource(
"p = 0",
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0)));
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("p"),
+ AstTestFactory.integer(0)));
}
void test_visitDoStatement() {
_assertSource(
"do {} while (c);",
- AstFactory.doStatement(
- AstFactory.block(), AstFactory.identifier3("c")));
+ AstTestFactory.doStatement(
+ AstTestFactory.block(), AstTestFactory.identifier3("c")));
}
void test_visitDoubleLiteral() {
- _assertSource("4.2", AstFactory.doubleLiteral(4.2));
+ _assertSource("4.2", AstTestFactory.doubleLiteral(4.2));
}
void test_visitEmptyFunctionBody() {
- _assertSource(";", AstFactory.emptyFunctionBody());
+ _assertSource(";", AstTestFactory.emptyFunctionBody());
}
void test_visitEmptyStatement() {
- _assertSource(";", AstFactory.emptyStatement());
+ _assertSource(";", AstTestFactory.emptyStatement());
}
void test_visitEnumDeclaration_multiple() {
- _assertSource(
- "enum E {ONE, TWO}", AstFactory.enumDeclaration2("E", ["ONE", "TWO"]));
+ _assertSource("enum E {ONE, TWO}",
+ AstTestFactory.enumDeclaration2("E", ["ONE", "TWO"]));
}
void test_visitEnumDeclaration_single() {
- _assertSource("enum E {ONE}", AstFactory.enumDeclaration2("E", ["ONE"]));
+ _assertSource(
+ "enum E {ONE}", AstTestFactory.enumDeclaration2("E", ["ONE"]));
}
void test_visitExportDirective_combinator() {
_assertSource(
"export 'a.dart' show A;",
- AstFactory.exportDirective2("a.dart", [
- AstFactory.showCombinator([AstFactory.identifier3("A")])
+ AstTestFactory.exportDirective2("a.dart", [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")])
]));
}
void test_visitExportDirective_combinators() {
_assertSource(
"export 'a.dart' show A hide B;",
- AstFactory.exportDirective2("a.dart", [
- AstFactory.showCombinator([AstFactory.identifier3("A")]),
- AstFactory.hideCombinator([AstFactory.identifier3("B")])
+ AstTestFactory.exportDirective2("a.dart", [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")]),
+ AstTestFactory.hideCombinator([AstTestFactory.identifier3("B")])
]));
}
void test_visitExportDirective_minimal() {
- _assertSource("export 'a.dart';", AstFactory.exportDirective2("a.dart"));
+ _assertSource(
+ "export 'a.dart';", AstTestFactory.exportDirective2("a.dart"));
}
void test_visitExportDirective_withMetadata() {
- ExportDirective directive = AstFactory.exportDirective2("a.dart");
- directive.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ ExportDirective directive = AstTestFactory.exportDirective2("a.dart");
+ directive.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated export 'a.dart';", directive);
}
void test_visitExpressionFunctionBody_async() {
- _assertSource("async => a;",
- AstFactory.asyncExpressionFunctionBody(AstFactory.identifier3("a")));
+ _assertSource(
+ "async => a;",
+ AstTestFactory
+ .asyncExpressionFunctionBody(AstTestFactory.identifier3("a")));
}
void test_visitExpressionFunctionBody_simple() {
_assertSource("=> a;",
- AstFactory.expressionFunctionBody(AstFactory.identifier3("a")));
+ AstTestFactory.expressionFunctionBody(AstTestFactory.identifier3("a")));
}
void test_visitExpressionStatement() {
- _assertSource(
- "a;", AstFactory.expressionStatement(AstFactory.identifier3("a")));
+ _assertSource("a;",
+ AstTestFactory.expressionStatement(AstTestFactory.identifier3("a")));
}
void test_visitExtendsClause() {
- _assertSource(
- "extends C", AstFactory.extendsClause(AstFactory.typeName4("C")));
+ _assertSource("extends C",
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("C")));
}
void test_visitFieldDeclaration_instance() {
_assertSource(
"var a;",
- AstFactory.fieldDeclaration2(
- false, Keyword.VAR, [AstFactory.variableDeclaration("a")]));
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration("a")]));
}
void test_visitFieldDeclaration_static() {
_assertSource(
"static var a;",
- AstFactory.fieldDeclaration2(
- true, Keyword.VAR, [AstFactory.variableDeclaration("a")]));
+ AstTestFactory.fieldDeclaration2(
+ true, Keyword.VAR, [AstTestFactory.variableDeclaration("a")]));
}
void test_visitFieldDeclaration_withMetadata() {
- FieldDeclaration declaration = AstFactory.fieldDeclaration2(
- false, Keyword.VAR, [AstFactory.variableDeclaration("a")]);
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ FieldDeclaration declaration = AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration("a")]);
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated var a;", declaration);
}
void test_visitFieldFormalParameter_annotation() {
- FieldFormalParameter parameter = AstFactory.fieldFormalParameter2('f');
- parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ FieldFormalParameter parameter = AstTestFactory.fieldFormalParameter2('f');
+ parameter.metadata
+ .add(AstTestFactory.annotation(AstTestFactory.identifier3("A")));
_assertSource('@A this.f', parameter);
}
void test_visitFieldFormalParameter_functionTyped() {
_assertSource(
"A this.a(b)",
- AstFactory.fieldFormalParameter(
+ AstTestFactory.fieldFormalParameter(
null,
- AstFactory.typeName4("A"),
+ AstTestFactory.typeName4("A"),
"a",
- AstFactory.formalParameterList(
- [AstFactory.simpleFormalParameter3("b")])));
+ AstTestFactory.formalParameterList(
+ [AstTestFactory.simpleFormalParameter3("b")])));
}
void test_visitFieldFormalParameter_functionTyped_typeParameters() {
@@ -1915,37 +1951,39 @@ class ToSourceVisitor2Test extends EngineTestCase {
null,
null,
null,
- AstFactory.typeName4('A'),
+ AstTestFactory.typeName4('A'),
TokenFactory.tokenFromKeyword(Keyword.THIS),
TokenFactory.tokenFromType(TokenType.PERIOD),
- AstFactory.identifier3('a'),
- AstFactory.typeParameterList(['E', 'F']),
- AstFactory.formalParameterList(
- [AstFactory.simpleFormalParameter3("b")])));
+ AstTestFactory.identifier3('a'),
+ AstTestFactory.typeParameterList(['E', 'F']),
+ AstTestFactory.formalParameterList(
+ [AstTestFactory.simpleFormalParameter3("b")])));
}
void test_visitFieldFormalParameter_keyword() {
- _assertSource(
- "var this.a", AstFactory.fieldFormalParameter(Keyword.VAR, null, "a"));
+ _assertSource("var this.a",
+ AstTestFactory.fieldFormalParameter(Keyword.VAR, null, "a"));
}
void test_visitFieldFormalParameter_keywordAndType() {
_assertSource(
"final A this.a",
- AstFactory.fieldFormalParameter(
- Keyword.FINAL, AstFactory.typeName4("A"), "a"));
+ AstTestFactory.fieldFormalParameter(
+ Keyword.FINAL, AstTestFactory.typeName4("A"), "a"));
}
void test_visitFieldFormalParameter_type() {
- _assertSource("A this.a",
- AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A"), "a"));
+ _assertSource(
+ "A this.a",
+ AstTestFactory.fieldFormalParameter(
+ null, AstTestFactory.typeName4("A"), "a"));
}
void test_visitForEachStatement_declared() {
_assertSource(
"for (var a in b) {}",
- AstFactory.forEachStatement(AstFactory.declaredIdentifier3("a"),
- AstFactory.identifier3("b"), AstFactory.block()));
+ AstTestFactory.forEachStatement(AstTestFactory.declaredIdentifier3("a"),
+ AstTestFactory.identifier3("b"), AstTestFactory.block()));
}
void test_visitForEachStatement_variable() {
@@ -1955,11 +1993,11 @@ class ToSourceVisitor2Test extends EngineTestCase {
null,
TokenFactory.tokenFromKeyword(Keyword.FOR),
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
- AstFactory.identifier3("a"),
+ AstTestFactory.identifier3("a"),
TokenFactory.tokenFromKeyword(Keyword.IN),
- AstFactory.identifier3("b"),
+ AstTestFactory.identifier3("b"),
TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
- AstFactory.block()));
+ AstTestFactory.block()));
}
void test_visitForEachStatement_variable_await() {
@@ -1969,268 +2007,288 @@ class ToSourceVisitor2Test extends EngineTestCase {
TokenFactory.tokenFromString("await"),
TokenFactory.tokenFromKeyword(Keyword.FOR),
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
- AstFactory.identifier3("a"),
+ AstTestFactory.identifier3("a"),
TokenFactory.tokenFromKeyword(Keyword.IN),
- AstFactory.identifier3("b"),
+ AstTestFactory.identifier3("b"),
TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
- AstFactory.block()));
+ AstTestFactory.block()));
}
void test_visitFormalParameterList_empty() {
- _assertSource("()", AstFactory.formalParameterList());
+ _assertSource("()", AstTestFactory.formalParameterList());
}
void test_visitFormalParameterList_n() {
_assertSource(
"({a : 0})",
- AstFactory.formalParameterList([
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.integer(0))
]));
}
void test_visitFormalParameterList_nn() {
_assertSource(
"({a : 0, b : 1})",
- AstFactory.formalParameterList([
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0)),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.integer(0)),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1))
]));
}
void test_visitFormalParameterList_p() {
_assertSource(
"([a = 0])",
- AstFactory.formalParameterList([
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.integer(0))
]));
}
void test_visitFormalParameterList_pp() {
_assertSource(
"([a = 0, b = 1])",
- AstFactory.formalParameterList([
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0)),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.integer(0)),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1))
]));
}
void test_visitFormalParameterList_r() {
_assertSource(
"(a)",
- AstFactory
- .formalParameterList([AstFactory.simpleFormalParameter3("a")]));
+ AstTestFactory
+ .formalParameterList([AstTestFactory.simpleFormalParameter3("a")]));
}
void test_visitFormalParameterList_rn() {
_assertSource(
"(a, {b : 1})",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1))
]));
}
void test_visitFormalParameterList_rnn() {
_assertSource(
"(a, {b : 1, c : 2})",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(2))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1)),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(2))
]));
}
void test_visitFormalParameterList_rp() {
_assertSource(
"(a, [b = 1])",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1))
]));
}
void test_visitFormalParameterList_rpp() {
_assertSource(
"(a, [b = 1, c = 2])",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(2))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1)),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(2))
]));
}
void test_visitFormalParameterList_rr() {
_assertSource(
"(a, b)",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.simpleFormalParameter3("b")
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.simpleFormalParameter3("b")
]));
}
void test_visitFormalParameterList_rrn() {
_assertSource(
"(a, b, {c : 3})",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.simpleFormalParameter3("b"),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(3))
]));
}
void test_visitFormalParameterList_rrnn() {
_assertSource(
"(a, b, {c : 3, d : 4})",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.simpleFormalParameter3("b"),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3)),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("d"), AstFactory.integer(4))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(3)),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("d"),
+ AstTestFactory.integer(4))
]));
}
void test_visitFormalParameterList_rrp() {
_assertSource(
"(a, b, [c = 3])",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.simpleFormalParameter3("b"),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(3))
]));
}
void test_visitFormalParameterList_rrpp() {
_assertSource(
"(a, b, [c = 3, d = 4])",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.simpleFormalParameter3("b"),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3)),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("d"), AstFactory.integer(4))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(3)),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("d"),
+ AstTestFactory.integer(4))
]));
}
void test_visitForStatement_c() {
_assertSource(
"for (; c;) {}",
- AstFactory.forStatement(
- null, AstFactory.identifier3("c"), null, AstFactory.block()));
+ AstTestFactory.forStatement(null, AstTestFactory.identifier3("c"), null,
+ AstTestFactory.block()));
}
void test_visitForStatement_cu() {
_assertSource(
"for (; c; u) {}",
- AstFactory.forStatement(null, AstFactory.identifier3("c"),
- [AstFactory.identifier3("u")], AstFactory.block()));
+ AstTestFactory.forStatement(null, AstTestFactory.identifier3("c"),
+ [AstTestFactory.identifier3("u")], AstTestFactory.block()));
}
void test_visitForStatement_e() {
_assertSource(
"for (e;;) {}",
- AstFactory.forStatement(
- AstFactory.identifier3("e"), null, null, AstFactory.block()));
+ AstTestFactory.forStatement(AstTestFactory.identifier3("e"), null, null,
+ AstTestFactory.block()));
}
void test_visitForStatement_ec() {
_assertSource(
"for (e; c;) {}",
- AstFactory.forStatement(AstFactory.identifier3("e"),
- AstFactory.identifier3("c"), null, AstFactory.block()));
+ AstTestFactory.forStatement(AstTestFactory.identifier3("e"),
+ AstTestFactory.identifier3("c"), null, AstTestFactory.block()));
}
void test_visitForStatement_ecu() {
_assertSource(
"for (e; c; u) {}",
- AstFactory.forStatement(
- AstFactory.identifier3("e"),
- AstFactory.identifier3("c"),
- [AstFactory.identifier3("u")],
- AstFactory.block()));
+ AstTestFactory.forStatement(
+ AstTestFactory.identifier3("e"),
+ AstTestFactory.identifier3("c"),
+ [AstTestFactory.identifier3("u")],
+ AstTestFactory.block()));
}
void test_visitForStatement_eu() {
_assertSource(
"for (e;; u) {}",
- AstFactory.forStatement(AstFactory.identifier3("e"), null,
- [AstFactory.identifier3("u")], AstFactory.block()));
+ AstTestFactory.forStatement(AstTestFactory.identifier3("e"), null,
+ [AstTestFactory.identifier3("u")], AstTestFactory.block()));
}
void test_visitForStatement_i() {
_assertSource(
"for (var i;;) {}",
- AstFactory.forStatement2(
- AstFactory.variableDeclarationList2(
- Keyword.VAR, [AstFactory.variableDeclaration("i")]),
+ AstTestFactory.forStatement2(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
null,
null,
- AstFactory.block()));
+ AstTestFactory.block()));
}
void test_visitForStatement_ic() {
_assertSource(
"for (var i; c;) {}",
- AstFactory.forStatement2(
- AstFactory.variableDeclarationList2(
- Keyword.VAR, [AstFactory.variableDeclaration("i")]),
- AstFactory.identifier3("c"),
+ AstTestFactory.forStatement2(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ AstTestFactory.identifier3("c"),
null,
- AstFactory.block()));
+ AstTestFactory.block()));
}
void test_visitForStatement_icu() {
_assertSource(
"for (var i; c; u) {}",
- AstFactory.forStatement2(
- AstFactory.variableDeclarationList2(
- Keyword.VAR, [AstFactory.variableDeclaration("i")]),
- AstFactory.identifier3("c"),
- [AstFactory.identifier3("u")],
- AstFactory.block()));
+ AstTestFactory.forStatement2(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ AstTestFactory.identifier3("c"),
+ [AstTestFactory.identifier3("u")],
+ AstTestFactory.block()));
}
void test_visitForStatement_iu() {
_assertSource(
"for (var i;; u) {}",
- AstFactory.forStatement2(
- AstFactory.variableDeclarationList2(
- Keyword.VAR, [AstFactory.variableDeclaration("i")]),
+ AstTestFactory.forStatement2(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
null,
- [AstFactory.identifier3("u")],
- AstFactory.block()));
+ [AstTestFactory.identifier3("u")],
+ AstTestFactory.block()));
}
void test_visitForStatement_u() {
_assertSource(
"for (;; u) {}",
- AstFactory.forStatement(
- null, null, [AstFactory.identifier3("u")], AstFactory.block()));
+ AstTestFactory.forStatement(null, null,
+ [AstTestFactory.identifier3("u")], AstTestFactory.block()));
}
void test_visitFunctionDeclaration_external() {
- FunctionDeclaration functionDeclaration = AstFactory.functionDeclaration(
- null,
- null,
- "f",
- AstFactory.functionExpression2(
- AstFactory.formalParameterList(), AstFactory.emptyFunctionBody()));
+ FunctionDeclaration functionDeclaration =
+ AstTestFactory.functionDeclaration(
+ null,
+ null,
+ "f",
+ AstTestFactory.functionExpression2(
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.emptyFunctionBody()));
functionDeclaration.externalKeyword =
TokenFactory.tokenFromKeyword(Keyword.EXTERNAL);
_assertSource("external f();", functionDeclaration);
@@ -2239,158 +2297,168 @@ class ToSourceVisitor2Test extends EngineTestCase {
void test_visitFunctionDeclaration_getter() {
_assertSource(
"get f() {}",
- AstFactory.functionDeclaration(
- null, Keyword.GET, "f", AstFactory.functionExpression()));
+ AstTestFactory.functionDeclaration(
+ null, Keyword.GET, "f", AstTestFactory.functionExpression()));
}
void test_visitFunctionDeclaration_local_blockBody() {
- FunctionDeclaration f = AstFactory.functionDeclaration(
- null, null, "f", AstFactory.functionExpression());
+ FunctionDeclaration f = AstTestFactory.functionDeclaration(
+ null, null, "f", AstTestFactory.functionExpression());
FunctionDeclarationStatement fStatement =
new FunctionDeclarationStatement(f);
_assertSource(
"main() {f() {} 42;}",
- AstFactory.functionDeclaration(
+ AstTestFactory.functionDeclaration(
null,
null,
"main",
- AstFactory.functionExpression2(
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2([
+ AstTestFactory.functionExpression2(
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2([
fStatement,
- AstFactory.expressionStatement(AstFactory.integer(42))
+ AstTestFactory.expressionStatement(AstTestFactory.integer(42))
]))));
}
void test_visitFunctionDeclaration_local_expressionBody() {
- FunctionDeclaration f = AstFactory.functionDeclaration(
+ FunctionDeclaration f = AstTestFactory.functionDeclaration(
null,
null,
"f",
- AstFactory.functionExpression2(AstFactory.formalParameterList(),
- AstFactory.expressionFunctionBody(AstFactory.integer(1))));
+ AstTestFactory.functionExpression2(AstTestFactory.formalParameterList(),
+ AstTestFactory.expressionFunctionBody(AstTestFactory.integer(1))));
FunctionDeclarationStatement fStatement =
new FunctionDeclarationStatement(f);
_assertSource(
"main() {f() => 1; 2;}",
- AstFactory.functionDeclaration(
+ AstTestFactory.functionDeclaration(
null,
null,
"main",
- AstFactory.functionExpression2(
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2([
+ AstTestFactory.functionExpression2(
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2([
fStatement,
- AstFactory.expressionStatement(AstFactory.integer(2))
+ AstTestFactory.expressionStatement(AstTestFactory.integer(2))
]))));
}
void test_visitFunctionDeclaration_normal() {
_assertSource(
"f() {}",
- AstFactory.functionDeclaration(
- null, null, "f", AstFactory.functionExpression()));
+ AstTestFactory.functionDeclaration(
+ null, null, "f", AstTestFactory.functionExpression()));
}
void test_visitFunctionDeclaration_setter() {
_assertSource(
"set f() {}",
- AstFactory.functionDeclaration(
- null, Keyword.SET, "f", AstFactory.functionExpression()));
+ AstTestFactory.functionDeclaration(
+ null, Keyword.SET, "f", AstTestFactory.functionExpression()));
}
void test_visitFunctionDeclaration_typeParameters() {
_assertSource(
"f<E>() {}",
- AstFactory.functionDeclaration(
+ AstTestFactory.functionDeclaration(
null,
null,
"f",
- AstFactory.functionExpression3(
- AstFactory.typeParameterList(['E']),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2())));
+ AstTestFactory.functionExpression3(
+ AstTestFactory.typeParameterList(['E']),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2())));
}
void test_visitFunctionDeclaration_withMetadata() {
- FunctionDeclaration declaration = AstFactory.functionDeclaration(
- null, null, "f", AstFactory.functionExpression());
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ FunctionDeclaration declaration = AstTestFactory.functionDeclaration(
+ null, null, "f", AstTestFactory.functionExpression());
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated f() {}", declaration);
}
void test_visitFunctionDeclarationStatement() {
_assertSource(
"f() {}",
- AstFactory.functionDeclarationStatement(
- null, null, "f", AstFactory.functionExpression()));
+ AstTestFactory.functionDeclarationStatement(
+ null, null, "f", AstTestFactory.functionExpression()));
}
void test_visitFunctionExpression() {
- _assertSource("() {}", AstFactory.functionExpression());
+ _assertSource("() {}", AstTestFactory.functionExpression());
}
void test_visitFunctionExpression_typeParameters() {
_assertSource(
"<E>() {}",
- AstFactory.functionExpression3(AstFactory.typeParameterList(['E']),
- AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()));
+ AstTestFactory.functionExpression3(
+ AstTestFactory.typeParameterList(['E']),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitFunctionExpressionInvocation_minimal() {
- _assertSource("f()",
- AstFactory.functionExpressionInvocation(AstFactory.identifier3("f")));
+ _assertSource(
+ "f()",
+ AstTestFactory
+ .functionExpressionInvocation(AstTestFactory.identifier3("f")));
}
void test_visitFunctionExpressionInvocation_typeArguments() {
_assertSource(
"f<A>()",
- AstFactory.functionExpressionInvocation2(AstFactory.identifier3("f"),
- AstFactory.typeArgumentList([AstFactory.typeName4('A')])));
+ AstTestFactory.functionExpressionInvocation2(
+ AstTestFactory.identifier3("f"),
+ AstTestFactory.typeArgumentList([AstTestFactory.typeName4('A')])));
}
void test_visitFunctionTypeAlias_generic() {
_assertSource(
"typedef A F<B>();",
- AstFactory.typeAlias(
- AstFactory.typeName4("A"),
+ AstTestFactory.typeAlias(
+ AstTestFactory.typeName4("A"),
"F",
- AstFactory.typeParameterList(["B"]),
- AstFactory.formalParameterList()));
+ AstTestFactory.typeParameterList(["B"]),
+ AstTestFactory.formalParameterList()));
}
void test_visitFunctionTypeAlias_nonGeneric() {
_assertSource(
"typedef A F();",
- AstFactory.typeAlias(AstFactory.typeName4("A"), "F", null,
- AstFactory.formalParameterList()));
+ AstTestFactory.typeAlias(AstTestFactory.typeName4("A"), "F", null,
+ AstTestFactory.formalParameterList()));
}
void test_visitFunctionTypeAlias_withMetadata() {
- FunctionTypeAlias declaration = AstFactory.typeAlias(
- AstFactory.typeName4("A"), "F", null, AstFactory.formalParameterList());
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ FunctionTypeAlias declaration = AstTestFactory.typeAlias(
+ AstTestFactory.typeName4("A"),
+ "F",
+ null,
+ AstTestFactory.formalParameterList());
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated typedef A F();", declaration);
}
void test_visitFunctionTypedFormalParameter_annotation() {
FunctionTypedFormalParameter parameter =
- AstFactory.functionTypedFormalParameter(null, "f");
- parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ AstTestFactory.functionTypedFormalParameter(null, "f");
+ parameter.metadata
+ .add(AstTestFactory.annotation(AstTestFactory.identifier3("A")));
_assertSource('@A f()', parameter);
}
void test_visitFunctionTypedFormalParameter_noType() {
- _assertSource("f()", AstFactory.functionTypedFormalParameter(null, "f"));
+ _assertSource(
+ "f()", AstTestFactory.functionTypedFormalParameter(null, "f"));
}
void test_visitFunctionTypedFormalParameter_type() {
_assertSource(
"T f()",
- AstFactory.functionTypedFormalParameter(
- AstFactory.typeName4("T"), "f"));
+ AstTestFactory.functionTypedFormalParameter(
+ AstTestFactory.typeName4("T"), "f"));
}
void test_visitFunctionTypedFormalParameter_typeParameters() {
@@ -2399,939 +2467,971 @@ class ToSourceVisitor2Test extends EngineTestCase {
new FunctionTypedFormalParameter(
null,
null,
- AstFactory.typeName4("T"),
- AstFactory.identifier3('f'),
- AstFactory.typeParameterList(['E']),
- AstFactory.formalParameterList([])));
+ AstTestFactory.typeName4("T"),
+ AstTestFactory.identifier3('f'),
+ AstTestFactory.typeParameterList(['E']),
+ AstTestFactory.formalParameterList([])));
}
void test_visitIfStatement_withElse() {
_assertSource(
"if (c) {} else {}",
- AstFactory.ifStatement2(AstFactory.identifier3("c"), AstFactory.block(),
- AstFactory.block()));
+ AstTestFactory.ifStatement2(AstTestFactory.identifier3("c"),
+ AstTestFactory.block(), AstTestFactory.block()));
}
void test_visitIfStatement_withoutElse() {
_assertSource(
"if (c) {}",
- AstFactory.ifStatement(
- AstFactory.identifier3("c"), AstFactory.block()));
+ AstTestFactory.ifStatement(
+ AstTestFactory.identifier3("c"), AstTestFactory.block()));
}
void test_visitImplementsClause_multiple() {
_assertSource(
"implements A, B",
- AstFactory.implementsClause(
- [AstFactory.typeName4("A"), AstFactory.typeName4("B")]));
+ AstTestFactory.implementsClause(
+ [AstTestFactory.typeName4("A"), AstTestFactory.typeName4("B")]));
}
void test_visitImplementsClause_single() {
_assertSource("implements A",
- AstFactory.implementsClause([AstFactory.typeName4("A")]));
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("A")]));
}
void test_visitImportDirective_combinator() {
_assertSource(
"import 'a.dart' show A;",
- AstFactory.importDirective3("a.dart", null, [
- AstFactory.showCombinator([AstFactory.identifier3("A")])
+ AstTestFactory.importDirective3("a.dart", null, [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")])
]));
}
void test_visitImportDirective_combinators() {
_assertSource(
"import 'a.dart' show A hide B;",
- AstFactory.importDirective3("a.dart", null, [
- AstFactory.showCombinator([AstFactory.identifier3("A")]),
- AstFactory.hideCombinator([AstFactory.identifier3("B")])
+ AstTestFactory.importDirective3("a.dart", null, [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")]),
+ AstTestFactory.hideCombinator([AstTestFactory.identifier3("B")])
]));
}
void test_visitImportDirective_deferred() {
_assertSource("import 'a.dart' deferred as p;",
- AstFactory.importDirective2("a.dart", true, "p"));
+ AstTestFactory.importDirective2("a.dart", true, "p"));
}
void test_visitImportDirective_minimal() {
_assertSource(
- "import 'a.dart';", AstFactory.importDirective3("a.dart", null));
+ "import 'a.dart';", AstTestFactory.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;",
+ AstTestFactory.importDirective3("a.dart", "p"));
}
void test_visitImportDirective_prefix_combinator() {
_assertSource(
"import 'a.dart' as p show A;",
- AstFactory.importDirective3("a.dart", "p", [
- AstFactory.showCombinator([AstFactory.identifier3("A")])
+ AstTestFactory.importDirective3("a.dart", "p", [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")])
]));
}
void test_visitImportDirective_prefix_combinators() {
_assertSource(
"import 'a.dart' as p show A hide B;",
- AstFactory.importDirective3("a.dart", "p", [
- AstFactory.showCombinator([AstFactory.identifier3("A")]),
- AstFactory.hideCombinator([AstFactory.identifier3("B")])
+ AstTestFactory.importDirective3("a.dart", "p", [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")]),
+ AstTestFactory.hideCombinator([AstTestFactory.identifier3("B")])
]));
}
void test_visitImportDirective_withMetadata() {
- ImportDirective directive = AstFactory.importDirective3("a.dart", null);
- directive.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ ImportDirective directive = AstTestFactory.importDirective3("a.dart", null);
+ directive.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated import 'a.dart';", directive);
}
void test_visitImportHideCombinator_multiple() {
_assertSource(
"hide a, b",
- AstFactory.hideCombinator(
- [AstFactory.identifier3("a"), AstFactory.identifier3("b")]));
+ AstTestFactory.hideCombinator([
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b")
+ ]));
}
void test_visitImportHideCombinator_single() {
- _assertSource(
- "hide a", AstFactory.hideCombinator([AstFactory.identifier3("a")]));
+ _assertSource("hide a",
+ AstTestFactory.hideCombinator([AstTestFactory.identifier3("a")]));
}
void test_visitImportShowCombinator_multiple() {
_assertSource(
"show a, b",
- AstFactory.showCombinator(
- [AstFactory.identifier3("a"), AstFactory.identifier3("b")]));
+ AstTestFactory.showCombinator([
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b")
+ ]));
}
void test_visitImportShowCombinator_single() {
- _assertSource(
- "show a", AstFactory.showCombinator([AstFactory.identifier3("a")]));
+ _assertSource("show a",
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("a")]));
}
void test_visitIndexExpression() {
_assertSource(
"a[i]",
- AstFactory.indexExpression(
- AstFactory.identifier3("a"), AstFactory.identifier3("i")));
+ AstTestFactory.indexExpression(
+ AstTestFactory.identifier3("a"), AstTestFactory.identifier3("i")));
}
void test_visitInstanceCreationExpression_const() {
_assertSource(
"const C()",
- AstFactory.instanceCreationExpression2(
- Keyword.CONST, AstFactory.typeName4("C")));
+ AstTestFactory.instanceCreationExpression2(
+ Keyword.CONST, AstTestFactory.typeName4("C")));
}
void test_visitInstanceCreationExpression_named() {
_assertSource(
"new C.c()",
- AstFactory.instanceCreationExpression3(
- Keyword.NEW, AstFactory.typeName4("C"), "c"));
+ AstTestFactory.instanceCreationExpression3(
+ Keyword.NEW, AstTestFactory.typeName4("C"), "c"));
}
void test_visitInstanceCreationExpression_unnamed() {
_assertSource(
"new C()",
- AstFactory.instanceCreationExpression2(
- Keyword.NEW, AstFactory.typeName4("C")));
+ AstTestFactory.instanceCreationExpression2(
+ Keyword.NEW, AstTestFactory.typeName4("C")));
}
void test_visitIntegerLiteral() {
- _assertSource("42", AstFactory.integer(42));
+ _assertSource("42", AstTestFactory.integer(42));
}
void test_visitInterpolationExpression_expression() {
- _assertSource("\${a}",
- AstFactory.interpolationExpression(AstFactory.identifier3("a")));
+ _assertSource(
+ "\${a}",
+ AstTestFactory
+ .interpolationExpression(AstTestFactory.identifier3("a")));
}
void test_visitInterpolationExpression_identifier() {
- _assertSource("\$a", AstFactory.interpolationExpression2("a"));
+ _assertSource("\$a", AstTestFactory.interpolationExpression2("a"));
}
void test_visitInterpolationString() {
- _assertSource("'x", AstFactory.interpolationString("'x", "x"));
+ _assertSource("'x", AstTestFactory.interpolationString("'x", "x"));
}
void test_visitIsExpression_negated() {
_assertSource(
"a is! C",
- AstFactory.isExpression(
- AstFactory.identifier3("a"), true, AstFactory.typeName4("C")));
+ AstTestFactory.isExpression(AstTestFactory.identifier3("a"), true,
+ AstTestFactory.typeName4("C")));
}
void test_visitIsExpression_normal() {
_assertSource(
"a is C",
- AstFactory.isExpression(
- AstFactory.identifier3("a"), false, AstFactory.typeName4("C")));
+ AstTestFactory.isExpression(AstTestFactory.identifier3("a"), false,
+ AstTestFactory.typeName4("C")));
}
void test_visitLabel() {
- _assertSource("a:", AstFactory.label2("a"));
+ _assertSource("a:", AstTestFactory.label2("a"));
}
void test_visitLabeledStatement_multiple() {
_assertSource(
"a: b: return;",
- AstFactory.labeledStatement(
- [AstFactory.label2("a"), AstFactory.label2("b")],
- AstFactory.returnStatement()));
+ AstTestFactory.labeledStatement(
+ [AstTestFactory.label2("a"), AstTestFactory.label2("b")],
+ AstTestFactory.returnStatement()));
}
void test_visitLabeledStatement_single() {
_assertSource(
"a: return;",
- AstFactory.labeledStatement(
- [AstFactory.label2("a")], AstFactory.returnStatement()));
+ AstTestFactory.labeledStatement(
+ [AstTestFactory.label2("a")], AstTestFactory.returnStatement()));
}
void test_visitLibraryDirective() {
- _assertSource("library l;", AstFactory.libraryDirective2("l"));
+ _assertSource("library l;", AstTestFactory.libraryDirective2("l"));
}
void test_visitLibraryDirective_withMetadata() {
- LibraryDirective directive = AstFactory.libraryDirective2("l");
- directive.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ LibraryDirective directive = AstTestFactory.libraryDirective2("l");
+ directive.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated library l;", directive);
}
void test_visitLibraryIdentifier_multiple() {
_assertSource(
"a.b.c",
- AstFactory.libraryIdentifier([
- AstFactory.identifier3("a"),
- AstFactory.identifier3("b"),
- AstFactory.identifier3("c")
+ AstTestFactory.libraryIdentifier([
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b"),
+ AstTestFactory.identifier3("c")
]));
}
void test_visitLibraryIdentifier_single() {
- _assertSource(
- "a", AstFactory.libraryIdentifier([AstFactory.identifier3("a")]));
+ _assertSource("a",
+ AstTestFactory.libraryIdentifier([AstTestFactory.identifier3("a")]));
}
void test_visitListLiteral_const() {
- _assertSource("const []", AstFactory.listLiteral2(Keyword.CONST, null));
+ _assertSource("const []", AstTestFactory.listLiteral2(Keyword.CONST, null));
}
void test_visitListLiteral_empty() {
- _assertSource("[]", AstFactory.listLiteral());
+ _assertSource("[]", AstTestFactory.listLiteral());
}
void test_visitListLiteral_nonEmpty() {
_assertSource(
"[a, b, c]",
- AstFactory.listLiteral([
- AstFactory.identifier3("a"),
- AstFactory.identifier3("b"),
- AstFactory.identifier3("c")
+ AstTestFactory.listLiteral([
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b"),
+ AstTestFactory.identifier3("c")
]));
}
void test_visitMapLiteral_const() {
- _assertSource("const {}", AstFactory.mapLiteral(Keyword.CONST, null));
+ _assertSource("const {}", AstTestFactory.mapLiteral(Keyword.CONST, null));
}
void test_visitMapLiteral_empty() {
- _assertSource("{}", AstFactory.mapLiteral2());
+ _assertSource("{}", AstTestFactory.mapLiteral2());
}
void test_visitMapLiteral_nonEmpty() {
_assertSource(
"{'a' : a, 'b' : b, 'c' : c}",
- AstFactory.mapLiteral2([
- AstFactory.mapLiteralEntry("a", AstFactory.identifier3("a")),
- AstFactory.mapLiteralEntry("b", AstFactory.identifier3("b")),
- AstFactory.mapLiteralEntry("c", AstFactory.identifier3("c"))
+ AstTestFactory.mapLiteral2([
+ AstTestFactory.mapLiteralEntry("a", AstTestFactory.identifier3("a")),
+ AstTestFactory.mapLiteralEntry("b", AstTestFactory.identifier3("b")),
+ AstTestFactory.mapLiteralEntry("c", AstTestFactory.identifier3("c"))
]));
}
void test_visitMapLiteralEntry() {
_assertSource("'a' : b",
- AstFactory.mapLiteralEntry("a", AstFactory.identifier3("b")));
+ AstTestFactory.mapLiteralEntry("a", AstTestFactory.identifier3("b")));
}
void test_visitMethodDeclaration_external() {
_assertSource(
"external m();",
- AstFactory.methodDeclaration(null, null, null, null,
- AstFactory.identifier3("m"), AstFactory.formalParameterList()));
+ AstTestFactory.methodDeclaration(
+ null,
+ null,
+ null,
+ null,
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList()));
}
void test_visitMethodDeclaration_external_returnType() {
_assertSource(
"external T m();",
- AstFactory.methodDeclaration(
+ AstTestFactory.methodDeclaration(
null,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList()));
}
void test_visitMethodDeclaration_getter() {
_assertSource(
"get m {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
null,
Keyword.GET,
null,
- AstFactory.identifier3("m"),
+ AstTestFactory.identifier3("m"),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_getter_returnType() {
_assertSource(
"T get m {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
Keyword.GET,
null,
- AstFactory.identifier3("m"),
+ AstTestFactory.identifier3("m"),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_getter_seturnType() {
_assertSource(
"T set m(var v) {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
Keyword.SET,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(
- [AstFactory.simpleFormalParameter(Keyword.VAR, "v")]),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(
+ [AstTestFactory.simpleFormalParameter(Keyword.VAR, "v")]),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_minimal() {
_assertSource(
"m() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
null,
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_multipleParameters() {
_assertSource(
"m(var a, var b) {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
null,
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
- AstFactory.simpleFormalParameter(Keyword.VAR, "b")
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "a"),
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "b")
]),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_operator() {
_assertSource(
"operator +() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
null,
null,
Keyword.OPERATOR,
- AstFactory.identifier3("+"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("+"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_operator_returnType() {
_assertSource(
"T operator +() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
null,
Keyword.OPERATOR,
- AstFactory.identifier3("+"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("+"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_returnType() {
_assertSource(
"T m() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_setter() {
_assertSource(
"set m(var v) {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
null,
Keyword.SET,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(
- [AstFactory.simpleFormalParameter(Keyword.VAR, "v")]),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(
+ [AstTestFactory.simpleFormalParameter(Keyword.VAR, "v")]),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_static() {
_assertSource(
"static m() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
Keyword.STATIC,
null,
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_static_returnType() {
_assertSource(
"static T m() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
Keyword.STATIC,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_typeParameters() {
_assertSource(
"m<E>() {}",
- AstFactory.methodDeclaration3(
+ AstTestFactory.methodDeclaration3(
null,
null,
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.typeParameterList(['E']),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.typeParameterList(['E']),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_withMetadata() {
- MethodDeclaration declaration = AstFactory.methodDeclaration2(
+ MethodDeclaration declaration = AstTestFactory.methodDeclaration2(
null,
null,
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2());
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2());
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated m() {}", declaration);
}
void test_visitMethodInvocation_conditional() {
_assertSource(
"t?.m()",
- AstFactory.methodInvocation(
- AstFactory.identifier3("t"), "m", null, TokenType.QUESTION_PERIOD));
+ AstTestFactory.methodInvocation(AstTestFactory.identifier3("t"), "m",
+ null, TokenType.QUESTION_PERIOD));
}
void test_visitMethodInvocation_noTarget() {
- _assertSource("m()", AstFactory.methodInvocation2("m"));
+ _assertSource("m()", AstTestFactory.methodInvocation2("m"));
}
void test_visitMethodInvocation_target() {
- _assertSource(
- "t.m()", AstFactory.methodInvocation(AstFactory.identifier3("t"), "m"));
+ _assertSource("t.m()",
+ AstTestFactory.methodInvocation(AstTestFactory.identifier3("t"), "m"));
}
void test_visitMethodInvocation_typeArguments() {
_assertSource(
"m<A>()",
- AstFactory.methodInvocation3(null, "m",
- AstFactory.typeArgumentList([AstFactory.typeName4('A')])));
+ AstTestFactory.methodInvocation3(null, "m",
+ AstTestFactory.typeArgumentList([AstTestFactory.typeName4('A')])));
}
void test_visitNamedExpression() {
- _assertSource(
- "a: b", AstFactory.namedExpression2("a", AstFactory.identifier3("b")));
+ _assertSource("a: b",
+ AstTestFactory.namedExpression2("a", AstTestFactory.identifier3("b")));
}
void test_visitNamedFormalParameter() {
_assertSource(
"var a : 0",
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
- AstFactory.integer(0)));
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "a"),
+ AstTestFactory.integer(0)));
}
void test_visitNativeClause() {
- _assertSource("native 'code'", AstFactory.nativeClause("code"));
+ _assertSource("native 'code'", AstTestFactory.nativeClause("code"));
}
void test_visitNativeFunctionBody() {
- _assertSource("native 'str';", AstFactory.nativeFunctionBody("str"));
+ _assertSource("native 'str';", AstTestFactory.nativeFunctionBody("str"));
}
void test_visitNullLiteral() {
- _assertSource("null", AstFactory.nullLiteral());
+ _assertSource("null", AstTestFactory.nullLiteral());
}
void test_visitParenthesizedExpression() {
_assertSource(
- "(a)", AstFactory.parenthesizedExpression(AstFactory.identifier3("a")));
+ "(a)",
+ AstTestFactory
+ .parenthesizedExpression(AstTestFactory.identifier3("a")));
}
void test_visitPartDirective() {
- _assertSource("part 'a.dart';", AstFactory.partDirective2("a.dart"));
+ _assertSource("part 'a.dart';", AstTestFactory.partDirective2("a.dart"));
}
void test_visitPartDirective_withMetadata() {
- PartDirective directive = AstFactory.partDirective2("a.dart");
- directive.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ PartDirective directive = AstTestFactory.partDirective2("a.dart");
+ directive.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated part 'a.dart';", directive);
}
void test_visitPartOfDirective() {
- _assertSource("part of l;",
- AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["l"])));
+ _assertSource(
+ "part of l;",
+ AstTestFactory
+ .partOfDirective(AstTestFactory.libraryIdentifier2(["l"])));
}
void test_visitPartOfDirective_withMetadata() {
- PartOfDirective directive =
- AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["l"]));
- directive.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ PartOfDirective directive = AstTestFactory
+ .partOfDirective(AstTestFactory.libraryIdentifier2(["l"]));
+ directive.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated part of l;", directive);
}
void test_visitPositionalFormalParameter() {
_assertSource(
"var a = 0",
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
- AstFactory.integer(0)));
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "a"),
+ AstTestFactory.integer(0)));
}
void test_visitPostfixExpression() {
_assertSource(
"a++",
- AstFactory.postfixExpression(
- AstFactory.identifier3("a"), TokenType.PLUS_PLUS));
+ AstTestFactory.postfixExpression(
+ AstTestFactory.identifier3("a"), TokenType.PLUS_PLUS));
}
void test_visitPrefixedIdentifier() {
- _assertSource("a.b", AstFactory.identifier5("a", "b"));
+ _assertSource("a.b", AstTestFactory.identifier5("a", "b"));
}
void test_visitPrefixExpression() {
_assertSource(
"-a",
- AstFactory.prefixExpression(
- TokenType.MINUS, AstFactory.identifier3("a")));
+ AstTestFactory.prefixExpression(
+ TokenType.MINUS, AstTestFactory.identifier3("a")));
}
void test_visitPropertyAccess() {
- _assertSource(
- "a.b", AstFactory.propertyAccess2(AstFactory.identifier3("a"), "b"));
+ _assertSource("a.b",
+ AstTestFactory.propertyAccess2(AstTestFactory.identifier3("a"), "b"));
}
void test_visitPropertyAccess_conditional() {
_assertSource(
"a?.b",
- AstFactory.propertyAccess2(
- AstFactory.identifier3("a"), "b", TokenType.QUESTION_PERIOD));
+ AstTestFactory.propertyAccess2(
+ AstTestFactory.identifier3("a"), "b", TokenType.QUESTION_PERIOD));
}
void test_visitRedirectingConstructorInvocation_named() {
_assertSource(
- "this.c()", AstFactory.redirectingConstructorInvocation2("c"));
+ "this.c()", AstTestFactory.redirectingConstructorInvocation2("c"));
}
void test_visitRedirectingConstructorInvocation_unnamed() {
- _assertSource("this()", AstFactory.redirectingConstructorInvocation());
+ _assertSource("this()", AstTestFactory.redirectingConstructorInvocation());
}
void test_visitRethrowExpression() {
- _assertSource("rethrow", AstFactory.rethrowExpression());
+ _assertSource("rethrow", AstTestFactory.rethrowExpression());
}
void test_visitReturnStatement_expression() {
- _assertSource(
- "return a;", AstFactory.returnStatement2(AstFactory.identifier3("a")));
+ _assertSource("return a;",
+ AstTestFactory.returnStatement2(AstTestFactory.identifier3("a")));
}
void test_visitReturnStatement_noExpression() {
- _assertSource("return;", AstFactory.returnStatement());
+ _assertSource("return;", AstTestFactory.returnStatement());
}
void test_visitScriptTag() {
String scriptTag = "!#/bin/dart.exe";
- _assertSource(scriptTag, AstFactory.scriptTag(scriptTag));
+ _assertSource(scriptTag, AstTestFactory.scriptTag(scriptTag));
}
void test_visitSimpleFormalParameter_annotation() {
- SimpleFormalParameter parameter = AstFactory.simpleFormalParameter3('x');
- parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ SimpleFormalParameter parameter =
+ AstTestFactory.simpleFormalParameter3('x');
+ parameter.metadata
+ .add(AstTestFactory.annotation(AstTestFactory.identifier3("A")));
_assertSource('@A x', parameter);
}
void test_visitSimpleFormalParameter_keyword() {
- _assertSource("var a", AstFactory.simpleFormalParameter(Keyword.VAR, "a"));
+ _assertSource(
+ "var a", AstTestFactory.simpleFormalParameter(Keyword.VAR, "a"));
}
void test_visitSimpleFormalParameter_keyword_type() {
_assertSource(
"final A a",
- AstFactory.simpleFormalParameter2(
- Keyword.FINAL, AstFactory.typeName4("A"), "a"));
+ AstTestFactory.simpleFormalParameter2(
+ Keyword.FINAL, AstTestFactory.typeName4("A"), "a"));
}
void test_visitSimpleFormalParameter_type() {
- _assertSource("A a",
- AstFactory.simpleFormalParameter4(AstFactory.typeName4("A"), "a"));
+ _assertSource(
+ "A a",
+ AstTestFactory.simpleFormalParameter4(
+ AstTestFactory.typeName4("A"), "a"));
}
void test_visitSimpleIdentifier() {
- _assertSource("a", AstFactory.identifier3("a"));
+ _assertSource("a", AstTestFactory.identifier3("a"));
}
void test_visitSimpleStringLiteral() {
- _assertSource("'a'", AstFactory.string2("a"));
+ _assertSource("'a'", AstTestFactory.string2("a"));
}
void test_visitStringInterpolation() {
_assertSource(
"'a\${e}b'",
- AstFactory.string([
- AstFactory.interpolationString("'a", "a"),
- AstFactory.interpolationExpression(AstFactory.identifier3("e")),
- AstFactory.interpolationString("b'", "b")
+ AstTestFactory.string([
+ AstTestFactory.interpolationString("'a", "a"),
+ AstTestFactory
+ .interpolationExpression(AstTestFactory.identifier3("e")),
+ AstTestFactory.interpolationString("b'", "b")
]));
}
void test_visitSuperConstructorInvocation() {
- _assertSource("super()", AstFactory.superConstructorInvocation());
+ _assertSource("super()", AstTestFactory.superConstructorInvocation());
}
void test_visitSuperConstructorInvocation_named() {
- _assertSource("super.c()", AstFactory.superConstructorInvocation2("c"));
+ _assertSource("super.c()", AstTestFactory.superConstructorInvocation2("c"));
}
void test_visitSuperExpression() {
- _assertSource("super", AstFactory.superExpression());
+ _assertSource("super", AstTestFactory.superExpression());
}
void test_visitSwitchCase_multipleLabels() {
_assertSource(
"l1: l2: case a: {}",
- AstFactory.switchCase2(
- [AstFactory.label2("l1"), AstFactory.label2("l2")],
- AstFactory.identifier3("a"),
- [AstFactory.block()]));
+ AstTestFactory.switchCase2(
+ [AstTestFactory.label2("l1"), AstTestFactory.label2("l2")],
+ AstTestFactory.identifier3("a"),
+ [AstTestFactory.block()]));
}
void test_visitSwitchCase_multipleStatements() {
_assertSource(
"case a: {} {}",
- AstFactory.switchCase(AstFactory.identifier3("a"),
- [AstFactory.block(), AstFactory.block()]));
+ AstTestFactory.switchCase(AstTestFactory.identifier3("a"),
+ [AstTestFactory.block(), AstTestFactory.block()]));
}
void test_visitSwitchCase_noLabels() {
_assertSource(
"case a: {}",
- AstFactory
- .switchCase(AstFactory.identifier3("a"), [AstFactory.block()]));
+ AstTestFactory.switchCase(
+ AstTestFactory.identifier3("a"), [AstTestFactory.block()]));
}
void test_visitSwitchCase_singleLabel() {
_assertSource(
"l1: case a: {}",
- AstFactory.switchCase2([AstFactory.label2("l1")],
- AstFactory.identifier3("a"), [AstFactory.block()]));
+ AstTestFactory.switchCase2([AstTestFactory.label2("l1")],
+ AstTestFactory.identifier3("a"), [AstTestFactory.block()]));
}
void test_visitSwitchDefault_multipleLabels() {
_assertSource(
"l1: l2: default: {}",
- AstFactory.switchDefault(
- [AstFactory.label2("l1"), AstFactory.label2("l2")],
- [AstFactory.block()]));
+ AstTestFactory.switchDefault(
+ [AstTestFactory.label2("l1"), AstTestFactory.label2("l2")],
+ [AstTestFactory.block()]));
}
void test_visitSwitchDefault_multipleStatements() {
- _assertSource("default: {} {}",
- AstFactory.switchDefault2([AstFactory.block(), AstFactory.block()]));
+ _assertSource(
+ "default: {} {}",
+ AstTestFactory
+ .switchDefault2([AstTestFactory.block(), AstTestFactory.block()]));
}
void test_visitSwitchDefault_noLabels() {
_assertSource(
- "default: {}", AstFactory.switchDefault2([AstFactory.block()]));
+ "default: {}", AstTestFactory.switchDefault2([AstTestFactory.block()]));
}
void test_visitSwitchDefault_singleLabel() {
_assertSource(
"l1: default: {}",
- AstFactory
- .switchDefault([AstFactory.label2("l1")], [AstFactory.block()]));
+ AstTestFactory.switchDefault(
+ [AstTestFactory.label2("l1")], [AstTestFactory.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()])
+ AstTestFactory.switchStatement(AstTestFactory.identifier3("a"), [
+ AstTestFactory.switchCase(
+ AstTestFactory.string2("b"), [AstTestFactory.block()]),
+ AstTestFactory.switchDefault2([AstTestFactory.block()])
]));
}
void test_visitSymbolLiteral_multiple() {
- _assertSource("#a.b.c", AstFactory.symbolLiteral(["a", "b", "c"]));
+ _assertSource("#a.b.c", AstTestFactory.symbolLiteral(["a", "b", "c"]));
}
void test_visitSymbolLiteral_single() {
- _assertSource("#a", AstFactory.symbolLiteral(["a"]));
+ _assertSource("#a", AstTestFactory.symbolLiteral(["a"]));
}
void test_visitThisExpression() {
- _assertSource("this", AstFactory.thisExpression());
+ _assertSource("this", AstTestFactory.thisExpression());
}
void test_visitThrowStatement() {
- _assertSource(
- "throw e", AstFactory.throwExpression2(AstFactory.identifier3("e")));
+ _assertSource("throw e",
+ AstTestFactory.throwExpression2(AstTestFactory.identifier3("e")));
}
void test_visitTopLevelVariableDeclaration_multiple() {
_assertSource(
"var a;",
- AstFactory.topLevelVariableDeclaration2(
- Keyword.VAR, [AstFactory.variableDeclaration("a")]));
+ AstTestFactory.topLevelVariableDeclaration2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("a")]));
}
void test_visitTopLevelVariableDeclaration_single() {
_assertSource(
"var a, b;",
- AstFactory.topLevelVariableDeclaration2(Keyword.VAR, [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.topLevelVariableDeclaration2(Keyword.VAR, [
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]));
}
void test_visitTryStatement_catch() {
_assertSource(
"try {} on E {}",
- AstFactory.tryStatement2(AstFactory.block(),
- [AstFactory.catchClause3(AstFactory.typeName4("E"))]));
+ AstTestFactory.tryStatement2(AstTestFactory.block(),
+ [AstTestFactory.catchClause3(AstTestFactory.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"))
+ AstTestFactory.tryStatement2(AstTestFactory.block(), [
+ AstTestFactory.catchClause3(AstTestFactory.typeName4("E")),
+ AstTestFactory.catchClause3(AstTestFactory.typeName4("F"))
]));
}
void test_visitTryStatement_catchFinally() {
_assertSource(
"try {} on E {} finally {}",
- AstFactory.tryStatement3(
- AstFactory.block(),
- [AstFactory.catchClause3(AstFactory.typeName4("E"))],
- AstFactory.block()));
+ AstTestFactory.tryStatement3(
+ AstTestFactory.block(),
+ [AstTestFactory.catchClause3(AstTestFactory.typeName4("E"))],
+ AstTestFactory.block()));
}
void test_visitTryStatement_finally() {
- _assertSource("try {} finally {}",
- AstFactory.tryStatement(AstFactory.block(), AstFactory.block()));
+ _assertSource(
+ "try {} finally {}",
+ AstTestFactory.tryStatement(
+ AstTestFactory.block(), AstTestFactory.block()));
}
void test_visitTypeArgumentList_multiple() {
_assertSource(
"<E, F>",
- AstFactory.typeArgumentList(
- [AstFactory.typeName4("E"), AstFactory.typeName4("F")]));
+ AstTestFactory.typeArgumentList(
+ [AstTestFactory.typeName4("E"), AstTestFactory.typeName4("F")]));
}
void test_visitTypeArgumentList_single() {
- _assertSource(
- "<E>", AstFactory.typeArgumentList([AstFactory.typeName4("E")]));
+ _assertSource("<E>",
+ AstTestFactory.typeArgumentList([AstTestFactory.typeName4("E")]));
}
void test_visitTypeName_multipleArgs() {
_assertSource(
"C<D, E>",
- AstFactory.typeName4(
- "C", [AstFactory.typeName4("D"), AstFactory.typeName4("E")]));
+ AstTestFactory.typeName4("C",
+ [AstTestFactory.typeName4("D"), AstTestFactory.typeName4("E")]));
}
void test_visitTypeName_nestedArg() {
_assertSource(
"C<D<E>>",
- AstFactory.typeName4("C", [
- AstFactory.typeName4("D", [AstFactory.typeName4("E")])
+ AstTestFactory.typeName4("C", [
+ AstTestFactory.typeName4("D", [AstTestFactory.typeName4("E")])
]));
}
void test_visitTypeName_noArgs() {
- _assertSource("C", AstFactory.typeName4("C"));
+ _assertSource("C", AstTestFactory.typeName4("C"));
}
void test_visitTypeName_singleArg() {
_assertSource(
- "C<D>", AstFactory.typeName4("C", [AstFactory.typeName4("D")]));
+ "C<D>", AstTestFactory.typeName4("C", [AstTestFactory.typeName4("D")]));
}
void test_visitTypeParameter_withExtends() {
_assertSource("E extends C",
- AstFactory.typeParameter2("E", AstFactory.typeName4("C")));
+ AstTestFactory.typeParameter2("E", AstTestFactory.typeName4("C")));
}
void test_visitTypeParameter_withMetadata() {
- TypeParameter parameter = AstFactory.typeParameter("E");
- parameter.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ TypeParameter parameter = AstTestFactory.typeParameter("E");
+ parameter.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated E", parameter);
}
void test_visitTypeParameter_withoutExtends() {
- _assertSource("E", AstFactory.typeParameter("E"));
+ _assertSource("E", AstTestFactory.typeParameter("E"));
}
void test_visitTypeParameterList_multiple() {
- _assertSource("<E, F>", AstFactory.typeParameterList(["E", "F"]));
+ _assertSource("<E, F>", AstTestFactory.typeParameterList(["E", "F"]));
}
void test_visitTypeParameterList_single() {
- _assertSource("<E>", AstFactory.typeParameterList(["E"]));
+ _assertSource("<E>", AstTestFactory.typeParameterList(["E"]));
}
void test_visitVariableDeclaration_initialized() {
- _assertSource("a = b",
- AstFactory.variableDeclaration2("a", AstFactory.identifier3("b")));
+ _assertSource(
+ "a = b",
+ AstTestFactory.variableDeclaration2(
+ "a", AstTestFactory.identifier3("b")));
}
void test_visitVariableDeclaration_uninitialized() {
- _assertSource("a", AstFactory.variableDeclaration("a"));
+ _assertSource("a", AstTestFactory.variableDeclaration("a"));
}
void test_visitVariableDeclaration_withMetadata() {
- VariableDeclaration declaration = AstFactory.variableDeclaration("a");
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ VariableDeclaration declaration = AstTestFactory.variableDeclaration("a");
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated a", declaration);
}
void test_visitVariableDeclarationList_const_type() {
_assertSource(
"const C a, b",
- AstFactory.variableDeclarationList(
- Keyword.CONST, AstFactory.typeName4("C"), [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.variableDeclarationList(
+ Keyword.CONST, AstTestFactory.typeName4("C"), [
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]));
}
void test_visitVariableDeclarationList_final_noType() {
_assertSource(
"final a, b",
- AstFactory.variableDeclarationList2(Keyword.FINAL, [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.variableDeclarationList2(Keyword.FINAL, [
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]));
}
void test_visitVariableDeclarationList_final_withMetadata() {
- VariableDeclarationList declarationList = AstFactory
+ VariableDeclarationList declarationList = AstTestFactory
.variableDeclarationList2(Keyword.FINAL, [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]);
- declarationList.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ declarationList.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated final a, b", declarationList);
}
void test_visitVariableDeclarationList_type() {
_assertSource(
"C a, b",
- AstFactory.variableDeclarationList(null, AstFactory.typeName4("C"), [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.variableDeclarationList(
+ null, AstTestFactory.typeName4("C"), [
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]));
}
void test_visitVariableDeclarationList_var() {
_assertSource(
"var a, b",
- AstFactory.variableDeclarationList2(Keyword.VAR, [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.variableDeclarationList2(Keyword.VAR, [
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]));
}
void test_visitVariableDeclarationStatement() {
_assertSource(
"C c;",
- AstFactory.variableDeclarationStatement(null, AstFactory.typeName4("C"),
- [AstFactory.variableDeclaration("c")]));
+ AstTestFactory.variableDeclarationStatement(
+ null,
+ AstTestFactory.typeName4("C"),
+ [AstTestFactory.variableDeclaration("c")]));
}
void test_visitWhileStatement() {
_assertSource(
"while (c) {}",
- AstFactory.whileStatement(
- AstFactory.identifier3("c"), AstFactory.block()));
+ AstTestFactory.whileStatement(
+ AstTestFactory.identifier3("c"), AstTestFactory.block()));
}
void test_visitWithClause_multiple() {
_assertSource(
"with A, B, C",
- AstFactory.withClause([
- AstFactory.typeName4("A"),
- AstFactory.typeName4("B"),
- AstFactory.typeName4("C")
+ AstTestFactory.withClause([
+ AstTestFactory.typeName4("A"),
+ AstTestFactory.typeName4("B"),
+ AstTestFactory.typeName4("C")
]));
}
void test_visitWithClause_single() {
- _assertSource("with A", AstFactory.withClause([AstFactory.typeName4("A")]));
+ _assertSource(
+ "with A", AstTestFactory.withClause([AstTestFactory.typeName4("A")]));
}
void test_visitYieldStatement() {
- _assertSource(
- "yield e;", AstFactory.yieldStatement(AstFactory.identifier3("e")));
+ _assertSource("yield e;",
+ AstTestFactory.yieldStatement(AstTestFactory.identifier3("e")));
}
void test_visitYieldStatement_each() {
_assertSource("yield* e;",
- AstFactory.yieldEachStatement(AstFactory.identifier3("e")));
+ AstTestFactory.yieldEachStatement(AstTestFactory.identifier3("e")));
}
/**
@@ -3351,246 +3451,257 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitAdjacentStrings() {
_assertSource(
"'a' 'b'",
- AstFactory.adjacentStrings(
- [AstFactory.string2("a"), AstFactory.string2("b")]));
+ AstTestFactory.adjacentStrings(
+ [AstTestFactory.string2("a"), AstTestFactory.string2("b")]));
}
void test_visitAnnotation_constant() {
- _assertSource("@A", AstFactory.annotation(AstFactory.identifier3("A")));
+ _assertSource(
+ "@A", AstTestFactory.annotation(AstTestFactory.identifier3("A")));
}
void test_visitAnnotation_constructor() {
_assertSource(
"@A.c()",
- AstFactory.annotation2(AstFactory.identifier3("A"),
- AstFactory.identifier3("c"), AstFactory.argumentList()));
+ AstTestFactory.annotation2(AstTestFactory.identifier3("A"),
+ AstTestFactory.identifier3("c"), AstTestFactory.argumentList()));
}
void test_visitArgumentList() {
_assertSource(
"(a, b)",
- AstFactory.argumentList(
- [AstFactory.identifier3("a"), AstFactory.identifier3("b")]));
+ AstTestFactory.argumentList([
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b")
+ ]));
}
void test_visitAsExpression() {
_assertSource(
"e as T",
- AstFactory.asExpression(
- AstFactory.identifier3("e"), AstFactory.typeName4("T")));
+ AstTestFactory.asExpression(
+ AstTestFactory.identifier3("e"), AstTestFactory.typeName4("T")));
}
void test_visitAssertStatement() {
- _assertSource(
- "assert (a);", AstFactory.assertStatement(AstFactory.identifier3("a")));
+ _assertSource("assert (a);",
+ AstTestFactory.assertStatement(AstTestFactory.identifier3("a")));
}
void test_visitAssertStatement_withMessage() {
_assertSource(
"assert (a, b);",
- AstFactory.assertStatement(
- AstFactory.identifier3("a"), AstFactory.identifier3('b')));
+ AstTestFactory.assertStatement(
+ AstTestFactory.identifier3("a"), AstTestFactory.identifier3('b')));
}
void test_visitAssignmentExpression() {
_assertSource(
"a = b",
- AstFactory.assignmentExpression(AstFactory.identifier3("a"),
- TokenType.EQ, AstFactory.identifier3("b")));
+ AstTestFactory.assignmentExpression(AstTestFactory.identifier3("a"),
+ TokenType.EQ, AstTestFactory.identifier3("b")));
}
void test_visitAwaitExpression() {
- _assertSource(
- "await e", AstFactory.awaitExpression(AstFactory.identifier3("e")));
+ _assertSource("await e",
+ AstTestFactory.awaitExpression(AstTestFactory.identifier3("e")));
}
void test_visitBinaryExpression() {
_assertSource(
"a + b",
- AstFactory.binaryExpression(AstFactory.identifier3("a"), TokenType.PLUS,
- AstFactory.identifier3("b")));
+ AstTestFactory.binaryExpression(AstTestFactory.identifier3("a"),
+ TokenType.PLUS, AstTestFactory.identifier3("b")));
}
void test_visitBlock_empty() {
- _assertSource("{}", AstFactory.block());
+ _assertSource("{}", AstTestFactory.block());
}
void test_visitBlock_nonEmpty() {
_assertSource(
"{break; break;}",
- AstFactory
- .block([AstFactory.breakStatement(), AstFactory.breakStatement()]));
+ AstTestFactory.block([
+ AstTestFactory.breakStatement(),
+ AstTestFactory.breakStatement()
+ ]));
}
void test_visitBlockFunctionBody_async() {
- _assertSource("async {}", AstFactory.asyncBlockFunctionBody());
+ _assertSource("async {}", AstTestFactory.asyncBlockFunctionBody());
}
void test_visitBlockFunctionBody_async_star() {
- _assertSource("async* {}", AstFactory.asyncGeneratorBlockFunctionBody());
+ _assertSource(
+ "async* {}", AstTestFactory.asyncGeneratorBlockFunctionBody());
}
void test_visitBlockFunctionBody_simple() {
- _assertSource("{}", AstFactory.blockFunctionBody2());
+ _assertSource("{}", AstTestFactory.blockFunctionBody2());
}
void test_visitBlockFunctionBody_sync() {
- _assertSource("sync {}", AstFactory.syncBlockFunctionBody());
+ _assertSource("sync {}", AstTestFactory.syncBlockFunctionBody());
}
void test_visitBlockFunctionBody_sync_star() {
- _assertSource("sync* {}", AstFactory.syncGeneratorBlockFunctionBody());
+ _assertSource("sync* {}", AstTestFactory.syncGeneratorBlockFunctionBody());
}
void test_visitBooleanLiteral_false() {
- _assertSource("false", AstFactory.booleanLiteral(false));
+ _assertSource("false", AstTestFactory.booleanLiteral(false));
}
void test_visitBooleanLiteral_true() {
- _assertSource("true", AstFactory.booleanLiteral(true));
+ _assertSource("true", AstTestFactory.booleanLiteral(true));
}
void test_visitBreakStatement_label() {
- _assertSource("break l;", AstFactory.breakStatement2("l"));
+ _assertSource("break l;", AstTestFactory.breakStatement2("l"));
}
void test_visitBreakStatement_noLabel() {
- _assertSource("break;", AstFactory.breakStatement());
+ _assertSource("break;", AstTestFactory.breakStatement());
}
void test_visitCascadeExpression_field() {
_assertSource(
"a..b..c",
- AstFactory.cascadeExpression(AstFactory.identifier3("a"), [
- AstFactory.cascadedPropertyAccess("b"),
- AstFactory.cascadedPropertyAccess("c")
+ AstTestFactory.cascadeExpression(AstTestFactory.identifier3("a"), [
+ AstTestFactory.cascadedPropertyAccess("b"),
+ AstTestFactory.cascadedPropertyAccess("c")
]));
}
void test_visitCascadeExpression_index() {
_assertSource(
"a..[0]..[1]",
- AstFactory.cascadeExpression(AstFactory.identifier3("a"), [
- AstFactory.cascadedIndexExpression(AstFactory.integer(0)),
- AstFactory.cascadedIndexExpression(AstFactory.integer(1))
+ AstTestFactory.cascadeExpression(AstTestFactory.identifier3("a"), [
+ AstTestFactory.cascadedIndexExpression(AstTestFactory.integer(0)),
+ AstTestFactory.cascadedIndexExpression(AstTestFactory.integer(1))
]));
}
void test_visitCascadeExpression_method() {
_assertSource(
"a..b()..c()",
- AstFactory.cascadeExpression(AstFactory.identifier3("a"), [
- AstFactory.cascadedMethodInvocation("b"),
- AstFactory.cascadedMethodInvocation("c")
+ AstTestFactory.cascadeExpression(AstTestFactory.identifier3("a"), [
+ AstTestFactory.cascadedMethodInvocation("b"),
+ AstTestFactory.cascadedMethodInvocation("c")
]));
}
void test_visitCatchClause_catch_noStack() {
- _assertSource("catch (e) {}", AstFactory.catchClause("e"));
+ _assertSource("catch (e) {}", AstTestFactory.catchClause("e"));
}
void test_visitCatchClause_catch_stack() {
- _assertSource("catch (e, s) {}", AstFactory.catchClause2("e", "s"));
+ _assertSource("catch (e, s) {}", AstTestFactory.catchClause2("e", "s"));
}
void test_visitCatchClause_on() {
_assertSource(
- "on E {}", AstFactory.catchClause3(AstFactory.typeName4("E")));
+ "on E {}", AstTestFactory.catchClause3(AstTestFactory.typeName4("E")));
}
void test_visitCatchClause_on_catch() {
_assertSource("on E catch (e) {}",
- AstFactory.catchClause4(AstFactory.typeName4("E"), "e"));
+ AstTestFactory.catchClause4(AstTestFactory.typeName4("E"), "e"));
}
void test_visitClassDeclaration_abstract() {
_assertSource(
"abstract class C {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
Keyword.ABSTRACT, "C", null, null, null, null));
}
void test_visitClassDeclaration_empty() {
_assertSource("class C {}",
- AstFactory.classDeclaration(null, "C", null, null, null, null));
+ AstTestFactory.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));
+ AstTestFactory.classDeclaration(
+ null,
+ "C",
+ null,
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
+ null,
+ null));
}
void test_visitClassDeclaration_extends_implements() {
_assertSource(
"class C extends A implements B {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
null,
- AstFactory.extendsClause(AstFactory.typeName4("A")),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
null,
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_extends_with() {
_assertSource(
"class C extends A with M {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
null,
- AstFactory.extendsClause(AstFactory.typeName4("A")),
- AstFactory.withClause([AstFactory.typeName4("M")]),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M")]),
null));
}
void test_visitClassDeclaration_extends_with_implements() {
_assertSource(
"class C extends A with M implements B {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
null,
- AstFactory.extendsClause(AstFactory.typeName4("A")),
- AstFactory.withClause([AstFactory.typeName4("M")]),
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M")]),
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_implements() {
_assertSource(
"class C implements B {}",
- AstFactory.classDeclaration(null, "C", null, null, null,
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.classDeclaration(null, "C", null, null, null,
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_multipleMember() {
_assertSource(
"class C {var a; var b;}",
- AstFactory.classDeclaration(null, "C", null, null, null, null, [
- AstFactory.fieldDeclaration2(
- false, Keyword.VAR, [AstFactory.variableDeclaration("a")]),
- AstFactory.fieldDeclaration2(
- false, Keyword.VAR, [AstFactory.variableDeclaration("b")])
+ AstTestFactory.classDeclaration(null, "C", null, null, null, null, [
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration("a")]),
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration("b")])
]));
}
void test_visitClassDeclaration_parameters() {
_assertSource(
"class C<E> {}",
- AstFactory.classDeclaration(
- null, "C", AstFactory.typeParameterList(["E"]), null, null, null));
+ AstTestFactory.classDeclaration(null, "C",
+ AstTestFactory.typeParameterList(["E"]), null, null, null));
}
void test_visitClassDeclaration_parameters_extends() {
_assertSource(
"class C<E> extends A {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
- AstFactory.typeParameterList(["E"]),
- AstFactory.extendsClause(AstFactory.typeName4("A")),
+ AstTestFactory.typeParameterList(["E"]),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
null,
null));
}
@@ -3598,102 +3709,102 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitClassDeclaration_parameters_extends_implements() {
_assertSource(
"class C<E> extends A implements B {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
- AstFactory.typeParameterList(["E"]),
- AstFactory.extendsClause(AstFactory.typeName4("A")),
+ AstTestFactory.typeParameterList(["E"]),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
null,
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_parameters_extends_with() {
_assertSource(
"class C<E> extends A with M {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
- AstFactory.typeParameterList(["E"]),
- AstFactory.extendsClause(AstFactory.typeName4("A")),
- AstFactory.withClause([AstFactory.typeName4("M")]),
+ AstTestFactory.typeParameterList(["E"]),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M")]),
null));
}
void test_visitClassDeclaration_parameters_extends_with_implements() {
_assertSource(
"class C<E> extends A with M implements B {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
- AstFactory.typeParameterList(["E"]),
- AstFactory.extendsClause(AstFactory.typeName4("A")),
- AstFactory.withClause([AstFactory.typeName4("M")]),
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.typeParameterList(["E"]),
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("A")),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M")]),
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_parameters_implements() {
_assertSource(
"class C<E> implements B {}",
- AstFactory.classDeclaration(
+ AstTestFactory.classDeclaration(
null,
"C",
- AstFactory.typeParameterList(["E"]),
+ AstTestFactory.typeParameterList(["E"]),
null,
null,
- AstFactory.implementsClause([AstFactory.typeName4("B")])));
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("B")])));
}
void test_visitClassDeclaration_singleMember() {
_assertSource(
"class C {var a;}",
- AstFactory.classDeclaration(null, "C", null, null, null, null, [
- AstFactory.fieldDeclaration2(
- false, Keyword.VAR, [AstFactory.variableDeclaration("a")])
+ AstTestFactory.classDeclaration(null, "C", null, null, null, null, [
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration("a")])
]));
}
void test_visitClassDeclaration_withMetadata() {
ClassDeclaration declaration =
- AstFactory.classDeclaration(null, "C", null, null, null, null);
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ AstTestFactory.classDeclaration(null, "C", null, null, null, null);
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated class C {}", declaration);
}
void test_visitClassTypeAlias_abstract() {
_assertSource(
"abstract class C = S with M1;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
null,
Keyword.ABSTRACT,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
null));
}
void test_visitClassTypeAlias_abstract_implements() {
_assertSource(
"abstract class C = S with M1 implements I;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
null,
Keyword.ABSTRACT,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
- AstFactory.implementsClause([AstFactory.typeName4("I")])));
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("I")])));
}
void test_visitClassTypeAlias_generic() {
_assertSource(
"class C<E> = S<E> with M1<E>;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
- AstFactory.typeParameterList(["E"]),
+ AstTestFactory.typeParameterList(["E"]),
null,
- AstFactory.typeName4("S", [AstFactory.typeName4("E")]),
- AstFactory.withClause([
- AstFactory.typeName4("M1", [AstFactory.typeName4("E")])
+ AstTestFactory.typeName4("S", [AstTestFactory.typeName4("E")]),
+ AstTestFactory.withClause([
+ AstTestFactory.typeName4("M1", [AstTestFactory.typeName4("E")])
]),
null));
}
@@ -3701,68 +3812,73 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitClassTypeAlias_implements() {
_assertSource(
"class C = S with M1 implements I;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
null,
null,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
- AstFactory.implementsClause([AstFactory.typeName4("I")])));
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
+ AstTestFactory.implementsClause([AstTestFactory.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));
+ AstTestFactory.classTypeAlias(
+ "C",
+ null,
+ null,
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
+ null));
}
void test_visitClassTypeAlias_parameters_abstract() {
_assertSource(
"abstract class C<E> = S with M1;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
- AstFactory.typeParameterList(["E"]),
+ AstTestFactory.typeParameterList(["E"]),
Keyword.ABSTRACT,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
null));
}
void test_visitClassTypeAlias_parameters_abstract_implements() {
_assertSource(
"abstract class C<E> = S with M1 implements I;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
- AstFactory.typeParameterList(["E"]),
+ AstTestFactory.typeParameterList(["E"]),
Keyword.ABSTRACT,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
- AstFactory.implementsClause([AstFactory.typeName4("I")])));
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("I")])));
}
void test_visitClassTypeAlias_parameters_implements() {
_assertSource(
"class C<E> = S with M1 implements I;",
- AstFactory.classTypeAlias(
+ AstTestFactory.classTypeAlias(
"C",
- AstFactory.typeParameterList(["E"]),
+ AstTestFactory.typeParameterList(["E"]),
null,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
- AstFactory.implementsClause([AstFactory.typeName4("I")])));
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("I")])));
}
void test_visitClassTypeAlias_withMetadata() {
- ClassTypeAlias declaration = AstFactory.classTypeAlias(
+ ClassTypeAlias declaration = AstTestFactory.classTypeAlias(
"C",
null,
null,
- AstFactory.typeName4("S"),
- AstFactory.withClause([AstFactory.typeName4("M1")]),
+ AstTestFactory.typeName4("S"),
+ AstTestFactory.withClause([AstTestFactory.typeName4("M1")]),
null);
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated class C = S with M1;", declaration);
}
@@ -3774,374 +3890,388 @@ class ToSourceVisitorTest extends EngineTestCase {
}
void test_visitCommentReference() {
- _assertSource("", new CommentReference(null, AstFactory.identifier3("a")));
+ _assertSource(
+ "", new CommentReference(null, AstTestFactory.identifier3("a")));
}
void test_visitCompilationUnit_declaration() {
_assertSource(
"var a;",
- AstFactory.compilationUnit2([
- AstFactory.topLevelVariableDeclaration2(
- Keyword.VAR, [AstFactory.variableDeclaration("a")])
+ AstTestFactory.compilationUnit2([
+ AstTestFactory.topLevelVariableDeclaration2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("a")])
]));
}
void test_visitCompilationUnit_directive() {
- _assertSource("library l;",
- AstFactory.compilationUnit3([AstFactory.libraryDirective2("l")]));
+ _assertSource(
+ "library l;",
+ AstTestFactory
+ .compilationUnit3([AstTestFactory.libraryDirective2("l")]));
}
void test_visitCompilationUnit_directive_declaration() {
_assertSource(
"library l; var a;",
- AstFactory.compilationUnit4([
- AstFactory.libraryDirective2("l")
+ AstTestFactory.compilationUnit4([
+ AstTestFactory.libraryDirective2("l")
], [
- AstFactory.topLevelVariableDeclaration2(
- Keyword.VAR, [AstFactory.variableDeclaration("a")])
+ AstTestFactory.topLevelVariableDeclaration2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("a")])
]));
}
void test_visitCompilationUnit_empty() {
- _assertSource("", AstFactory.compilationUnit());
+ _assertSource("", AstTestFactory.compilationUnit());
}
void test_visitCompilationUnit_script() {
_assertSource(
- "!#/bin/dartvm", AstFactory.compilationUnit5("!#/bin/dartvm"));
+ "!#/bin/dartvm", AstTestFactory.compilationUnit5("!#/bin/dartvm"));
}
void test_visitCompilationUnit_script_declaration() {
_assertSource(
"!#/bin/dartvm var a;",
- AstFactory.compilationUnit6("!#/bin/dartvm", [
- AstFactory.topLevelVariableDeclaration2(
- Keyword.VAR, [AstFactory.variableDeclaration("a")])
+ AstTestFactory.compilationUnit6("!#/bin/dartvm", [
+ AstTestFactory.topLevelVariableDeclaration2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("a")])
]));
}
void test_visitCompilationUnit_script_directive() {
_assertSource(
"!#/bin/dartvm library l;",
- AstFactory.compilationUnit7(
- "!#/bin/dartvm", [AstFactory.libraryDirective2("l")]));
+ AstTestFactory.compilationUnit7(
+ "!#/bin/dartvm", [AstTestFactory.libraryDirective2("l")]));
}
void test_visitCompilationUnit_script_directives_declarations() {
_assertSource(
"!#/bin/dartvm library l; var a;",
- AstFactory.compilationUnit8("!#/bin/dartvm", [
- AstFactory.libraryDirective2("l")
+ AstTestFactory.compilationUnit8("!#/bin/dartvm", [
+ AstTestFactory.libraryDirective2("l")
], [
- AstFactory.topLevelVariableDeclaration2(
- Keyword.VAR, [AstFactory.variableDeclaration("a")])
+ AstTestFactory.topLevelVariableDeclaration2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("a")])
]));
}
void test_visitConditionalExpression() {
_assertSource(
"a ? b : c",
- AstFactory.conditionalExpression(AstFactory.identifier3("a"),
- AstFactory.identifier3("b"), AstFactory.identifier3("c")));
+ AstTestFactory.conditionalExpression(AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b"), AstTestFactory.identifier3("c")));
}
void test_visitConstructorDeclaration_const() {
_assertSource(
"const C() {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
Keyword.CONST,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_external() {
_assertSource(
"external C();",
- AstFactory.constructorDeclaration(AstFactory.identifier3("C"), null,
- AstFactory.formalParameterList(), null));
+ AstTestFactory.constructorDeclaration(AstTestFactory.identifier3("C"),
+ null, AstTestFactory.formalParameterList(), null));
}
void test_visitConstructorDeclaration_minimal() {
_assertSource(
"C() {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_multipleInitializers() {
_assertSource(
"C() : a = b, c = d {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
[
- AstFactory.constructorFieldInitializer(
- false, "a", AstFactory.identifier3("b")),
- AstFactory.constructorFieldInitializer(
- false, "c", AstFactory.identifier3("d"))
+ AstTestFactory.constructorFieldInitializer(
+ false, "a", AstTestFactory.identifier3("b")),
+ AstTestFactory.constructorFieldInitializer(
+ false, "c", AstTestFactory.identifier3("d"))
],
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_multipleParameters() {
_assertSource(
"C(var a, var b) {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
- AstFactory.simpleFormalParameter(Keyword.VAR, "b")
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "a"),
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "b")
]),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_named() {
_assertSource(
"C.m() {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
"m",
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_singleInitializer() {
_assertSource(
"C() : a = b {}",
- AstFactory.constructorDeclaration2(
+ AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
[
- AstFactory.constructorFieldInitializer(
- false, "a", AstFactory.identifier3("b"))
+ AstTestFactory.constructorFieldInitializer(
+ false, "a", AstTestFactory.identifier3("b"))
],
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitConstructorDeclaration_withMetadata() {
- ConstructorDeclaration declaration = AstFactory.constructorDeclaration2(
+ ConstructorDeclaration declaration = AstTestFactory.constructorDeclaration2(
null,
null,
- AstFactory.identifier3("C"),
+ AstTestFactory.identifier3("C"),
null,
- AstFactory.formalParameterList(),
+ AstTestFactory.formalParameterList(),
null,
- AstFactory.blockFunctionBody2());
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ AstTestFactory.blockFunctionBody2());
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated C() {}", declaration);
}
void test_visitConstructorFieldInitializer_withoutThis() {
_assertSource(
"a = b",
- AstFactory.constructorFieldInitializer(
- false, "a", AstFactory.identifier3("b")));
+ AstTestFactory.constructorFieldInitializer(
+ false, "a", AstTestFactory.identifier3("b")));
}
void test_visitConstructorFieldInitializer_withThis() {
_assertSource(
"this.a = b",
- AstFactory.constructorFieldInitializer(
- true, "a", AstFactory.identifier3("b")));
+ AstTestFactory.constructorFieldInitializer(
+ true, "a", AstTestFactory.identifier3("b")));
}
void test_visitConstructorName_named_prefix() {
- _assertSource("p.C.n",
- AstFactory.constructorName(AstFactory.typeName4("p.C.n"), null));
+ _assertSource(
+ "p.C.n",
+ AstTestFactory.constructorName(
+ AstTestFactory.typeName4("p.C.n"), null));
}
void test_visitConstructorName_unnamed_noPrefix() {
- _assertSource(
- "C", AstFactory.constructorName(AstFactory.typeName4("C"), null));
+ _assertSource("C",
+ AstTestFactory.constructorName(AstTestFactory.typeName4("C"), null));
}
void test_visitConstructorName_unnamed_prefix() {
_assertSource(
"p.C",
- AstFactory.constructorName(
- AstFactory.typeName3(AstFactory.identifier5("p", "C")), null));
+ AstTestFactory.constructorName(
+ AstTestFactory.typeName3(AstTestFactory.identifier5("p", "C")),
+ null));
}
void test_visitContinueStatement_label() {
- _assertSource("continue l;", AstFactory.continueStatement("l"));
+ _assertSource("continue l;", AstTestFactory.continueStatement("l"));
}
void test_visitContinueStatement_noLabel() {
- _assertSource("continue;", AstFactory.continueStatement());
+ _assertSource("continue;", AstTestFactory.continueStatement());
}
void test_visitDefaultFormalParameter_annotation() {
- DefaultFormalParameter parameter = AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0));
- parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ DefaultFormalParameter parameter = AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("p"), AstTestFactory.integer(0));
+ parameter.metadata
+ .add(AstTestFactory.annotation(AstTestFactory.identifier3("A")));
_assertSource('@A p = 0', parameter);
}
void test_visitDefaultFormalParameter_named_noValue() {
_assertSource(
"p",
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("p"), null));
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("p"), null));
}
void test_visitDefaultFormalParameter_named_value() {
_assertSource(
"p : 0",
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0)));
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("p"),
+ AstTestFactory.integer(0)));
}
void test_visitDefaultFormalParameter_positional_noValue() {
_assertSource(
"p",
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("p"), null));
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("p"), null));
}
void test_visitDefaultFormalParameter_positional_value() {
_assertSource(
"p = 0",
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0)));
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("p"),
+ AstTestFactory.integer(0)));
}
void test_visitDoStatement() {
_assertSource(
"do {} while (c);",
- AstFactory.doStatement(
- AstFactory.block(), AstFactory.identifier3("c")));
+ AstTestFactory.doStatement(
+ AstTestFactory.block(), AstTestFactory.identifier3("c")));
}
void test_visitDoubleLiteral() {
- _assertSource("4.2", AstFactory.doubleLiteral(4.2));
+ _assertSource("4.2", AstTestFactory.doubleLiteral(4.2));
}
void test_visitEmptyFunctionBody() {
- _assertSource(";", AstFactory.emptyFunctionBody());
+ _assertSource(";", AstTestFactory.emptyFunctionBody());
}
void test_visitEmptyStatement() {
- _assertSource(";", AstFactory.emptyStatement());
+ _assertSource(";", AstTestFactory.emptyStatement());
}
void test_visitEnumDeclaration_multiple() {
- _assertSource(
- "enum E {ONE, TWO}", AstFactory.enumDeclaration2("E", ["ONE", "TWO"]));
+ _assertSource("enum E {ONE, TWO}",
+ AstTestFactory.enumDeclaration2("E", ["ONE", "TWO"]));
}
void test_visitEnumDeclaration_single() {
- _assertSource("enum E {ONE}", AstFactory.enumDeclaration2("E", ["ONE"]));
+ _assertSource(
+ "enum E {ONE}", AstTestFactory.enumDeclaration2("E", ["ONE"]));
}
void test_visitExportDirective_combinator() {
_assertSource(
"export 'a.dart' show A;",
- AstFactory.exportDirective2("a.dart", [
- AstFactory.showCombinator([AstFactory.identifier3("A")])
+ AstTestFactory.exportDirective2("a.dart", [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")])
]));
}
void test_visitExportDirective_combinators() {
_assertSource(
"export 'a.dart' show A hide B;",
- AstFactory.exportDirective2("a.dart", [
- AstFactory.showCombinator([AstFactory.identifier3("A")]),
- AstFactory.hideCombinator([AstFactory.identifier3("B")])
+ AstTestFactory.exportDirective2("a.dart", [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")]),
+ AstTestFactory.hideCombinator([AstTestFactory.identifier3("B")])
]));
}
void test_visitExportDirective_minimal() {
- _assertSource("export 'a.dart';", AstFactory.exportDirective2("a.dart"));
+ _assertSource(
+ "export 'a.dart';", AstTestFactory.exportDirective2("a.dart"));
}
void test_visitExportDirective_withMetadata() {
- ExportDirective directive = AstFactory.exportDirective2("a.dart");
- directive.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ ExportDirective directive = AstTestFactory.exportDirective2("a.dart");
+ directive.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated export 'a.dart';", directive);
}
void test_visitExpressionFunctionBody_async() {
- _assertSource("async => a;",
- AstFactory.asyncExpressionFunctionBody(AstFactory.identifier3("a")));
+ _assertSource(
+ "async => a;",
+ AstTestFactory
+ .asyncExpressionFunctionBody(AstTestFactory.identifier3("a")));
}
void test_visitExpressionFunctionBody_simple() {
_assertSource("=> a;",
- AstFactory.expressionFunctionBody(AstFactory.identifier3("a")));
+ AstTestFactory.expressionFunctionBody(AstTestFactory.identifier3("a")));
}
void test_visitExpressionStatement() {
- _assertSource(
- "a;", AstFactory.expressionStatement(AstFactory.identifier3("a")));
+ _assertSource("a;",
+ AstTestFactory.expressionStatement(AstTestFactory.identifier3("a")));
}
void test_visitExtendsClause() {
- _assertSource(
- "extends C", AstFactory.extendsClause(AstFactory.typeName4("C")));
+ _assertSource("extends C",
+ AstTestFactory.extendsClause(AstTestFactory.typeName4("C")));
}
void test_visitFieldDeclaration_instance() {
_assertSource(
"var a;",
- AstFactory.fieldDeclaration2(
- false, Keyword.VAR, [AstFactory.variableDeclaration("a")]));
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration("a")]));
}
void test_visitFieldDeclaration_static() {
_assertSource(
"static var a;",
- AstFactory.fieldDeclaration2(
- true, Keyword.VAR, [AstFactory.variableDeclaration("a")]));
+ AstTestFactory.fieldDeclaration2(
+ true, Keyword.VAR, [AstTestFactory.variableDeclaration("a")]));
}
void test_visitFieldDeclaration_withMetadata() {
- FieldDeclaration declaration = AstFactory.fieldDeclaration2(
- false, Keyword.VAR, [AstFactory.variableDeclaration("a")]);
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ FieldDeclaration declaration = AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration("a")]);
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated var a;", declaration);
}
void test_visitFieldFormalParameter_annotation() {
- FieldFormalParameter parameter = AstFactory.fieldFormalParameter2('f');
- parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ FieldFormalParameter parameter = AstTestFactory.fieldFormalParameter2('f');
+ parameter.metadata
+ .add(AstTestFactory.annotation(AstTestFactory.identifier3("A")));
_assertSource('@A this.f', parameter);
}
void test_visitFieldFormalParameter_functionTyped() {
_assertSource(
"A this.a(b)",
- AstFactory.fieldFormalParameter(
+ AstTestFactory.fieldFormalParameter(
null,
- AstFactory.typeName4("A"),
+ AstTestFactory.typeName4("A"),
"a",
- AstFactory.formalParameterList(
- [AstFactory.simpleFormalParameter3("b")])));
+ AstTestFactory.formalParameterList(
+ [AstTestFactory.simpleFormalParameter3("b")])));
}
void test_visitFieldFormalParameter_functionTyped_typeParameters() {
@@ -4151,37 +4281,39 @@ class ToSourceVisitorTest extends EngineTestCase {
null,
null,
null,
- AstFactory.typeName4('A'),
+ AstTestFactory.typeName4('A'),
TokenFactory.tokenFromKeyword(Keyword.THIS),
TokenFactory.tokenFromType(TokenType.PERIOD),
- AstFactory.identifier3('a'),
- AstFactory.typeParameterList(['E', 'F']),
- AstFactory.formalParameterList(
- [AstFactory.simpleFormalParameter3("b")])));
+ AstTestFactory.identifier3('a'),
+ AstTestFactory.typeParameterList(['E', 'F']),
+ AstTestFactory.formalParameterList(
+ [AstTestFactory.simpleFormalParameter3("b")])));
}
void test_visitFieldFormalParameter_keyword() {
- _assertSource(
- "var this.a", AstFactory.fieldFormalParameter(Keyword.VAR, null, "a"));
+ _assertSource("var this.a",
+ AstTestFactory.fieldFormalParameter(Keyword.VAR, null, "a"));
}
void test_visitFieldFormalParameter_keywordAndType() {
_assertSource(
"final A this.a",
- AstFactory.fieldFormalParameter(
- Keyword.FINAL, AstFactory.typeName4("A"), "a"));
+ AstTestFactory.fieldFormalParameter(
+ Keyword.FINAL, AstTestFactory.typeName4("A"), "a"));
}
void test_visitFieldFormalParameter_type() {
- _assertSource("A this.a",
- AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A"), "a"));
+ _assertSource(
+ "A this.a",
+ AstTestFactory.fieldFormalParameter(
+ null, AstTestFactory.typeName4("A"), "a"));
}
void test_visitForEachStatement_declared() {
_assertSource(
"for (var a in b) {}",
- AstFactory.forEachStatement(AstFactory.declaredIdentifier3("a"),
- AstFactory.identifier3("b"), AstFactory.block()));
+ AstTestFactory.forEachStatement(AstTestFactory.declaredIdentifier3("a"),
+ AstTestFactory.identifier3("b"), AstTestFactory.block()));
}
void test_visitForEachStatement_variable() {
@@ -4191,11 +4323,11 @@ class ToSourceVisitorTest extends EngineTestCase {
null,
TokenFactory.tokenFromKeyword(Keyword.FOR),
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
- AstFactory.identifier3("a"),
+ AstTestFactory.identifier3("a"),
TokenFactory.tokenFromKeyword(Keyword.IN),
- AstFactory.identifier3("b"),
+ AstTestFactory.identifier3("b"),
TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
- AstFactory.block()));
+ AstTestFactory.block()));
}
void test_visitForEachStatement_variable_await() {
@@ -4205,268 +4337,288 @@ class ToSourceVisitorTest extends EngineTestCase {
TokenFactory.tokenFromString("await"),
TokenFactory.tokenFromKeyword(Keyword.FOR),
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
- AstFactory.identifier3("a"),
+ AstTestFactory.identifier3("a"),
TokenFactory.tokenFromKeyword(Keyword.IN),
- AstFactory.identifier3("b"),
+ AstTestFactory.identifier3("b"),
TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
- AstFactory.block()));
+ AstTestFactory.block()));
}
void test_visitFormalParameterList_empty() {
- _assertSource("()", AstFactory.formalParameterList());
+ _assertSource("()", AstTestFactory.formalParameterList());
}
void test_visitFormalParameterList_n() {
_assertSource(
"({a : 0})",
- AstFactory.formalParameterList([
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.integer(0))
]));
}
void test_visitFormalParameterList_nn() {
_assertSource(
"({a : 0, b : 1})",
- AstFactory.formalParameterList([
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0)),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.integer(0)),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1))
]));
}
void test_visitFormalParameterList_p() {
_assertSource(
"([a = 0])",
- AstFactory.formalParameterList([
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.integer(0))
]));
}
void test_visitFormalParameterList_pp() {
_assertSource(
"([a = 0, b = 1])",
- AstFactory.formalParameterList([
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0)),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.integer(0)),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1))
]));
}
void test_visitFormalParameterList_r() {
_assertSource(
"(a)",
- AstFactory
- .formalParameterList([AstFactory.simpleFormalParameter3("a")]));
+ AstTestFactory
+ .formalParameterList([AstTestFactory.simpleFormalParameter3("a")]));
}
void test_visitFormalParameterList_rn() {
_assertSource(
"(a, {b : 1})",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1))
]));
}
void test_visitFormalParameterList_rnn() {
_assertSource(
"(a, {b : 1, c : 2})",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(2))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1)),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(2))
]));
}
void test_visitFormalParameterList_rp() {
_assertSource(
"(a, [b = 1])",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1))
]));
}
void test_visitFormalParameterList_rpp() {
_assertSource(
"(a, [b = 1, c = 2])",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(2))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.integer(1)),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(2))
]));
}
void test_visitFormalParameterList_rr() {
_assertSource(
"(a, b)",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.simpleFormalParameter3("b")
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.simpleFormalParameter3("b")
]));
}
void test_visitFormalParameterList_rrn() {
_assertSource(
"(a, b, {c : 3})",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.simpleFormalParameter3("b"),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(3))
]));
}
void test_visitFormalParameterList_rrnn() {
_assertSource(
"(a, b, {c : 3, d : 4})",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.simpleFormalParameter3("b"),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3)),
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter3("d"), AstFactory.integer(4))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(3)),
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter3("d"),
+ AstTestFactory.integer(4))
]));
}
void test_visitFormalParameterList_rrp() {
_assertSource(
"(a, b, [c = 3])",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.simpleFormalParameter3("b"),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(3))
]));
}
void test_visitFormalParameterList_rrpp() {
_assertSource(
"(a, b, [c = 3, d = 4])",
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter3("a"),
- AstFactory.simpleFormalParameter3("b"),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3)),
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter3("d"), AstFactory.integer(4))
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter3("a"),
+ AstTestFactory.simpleFormalParameter3("b"),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("c"),
+ AstTestFactory.integer(3)),
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter3("d"),
+ AstTestFactory.integer(4))
]));
}
void test_visitForStatement_c() {
_assertSource(
"for (; c;) {}",
- AstFactory.forStatement(
- null, AstFactory.identifier3("c"), null, AstFactory.block()));
+ AstTestFactory.forStatement(null, AstTestFactory.identifier3("c"), null,
+ AstTestFactory.block()));
}
void test_visitForStatement_cu() {
_assertSource(
"for (; c; u) {}",
- AstFactory.forStatement(null, AstFactory.identifier3("c"),
- [AstFactory.identifier3("u")], AstFactory.block()));
+ AstTestFactory.forStatement(null, AstTestFactory.identifier3("c"),
+ [AstTestFactory.identifier3("u")], AstTestFactory.block()));
}
void test_visitForStatement_e() {
_assertSource(
"for (e;;) {}",
- AstFactory.forStatement(
- AstFactory.identifier3("e"), null, null, AstFactory.block()));
+ AstTestFactory.forStatement(AstTestFactory.identifier3("e"), null, null,
+ AstTestFactory.block()));
}
void test_visitForStatement_ec() {
_assertSource(
"for (e; c;) {}",
- AstFactory.forStatement(AstFactory.identifier3("e"),
- AstFactory.identifier3("c"), null, AstFactory.block()));
+ AstTestFactory.forStatement(AstTestFactory.identifier3("e"),
+ AstTestFactory.identifier3("c"), null, AstTestFactory.block()));
}
void test_visitForStatement_ecu() {
_assertSource(
"for (e; c; u) {}",
- AstFactory.forStatement(
- AstFactory.identifier3("e"),
- AstFactory.identifier3("c"),
- [AstFactory.identifier3("u")],
- AstFactory.block()));
+ AstTestFactory.forStatement(
+ AstTestFactory.identifier3("e"),
+ AstTestFactory.identifier3("c"),
+ [AstTestFactory.identifier3("u")],
+ AstTestFactory.block()));
}
void test_visitForStatement_eu() {
_assertSource(
"for (e;; u) {}",
- AstFactory.forStatement(AstFactory.identifier3("e"), null,
- [AstFactory.identifier3("u")], AstFactory.block()));
+ AstTestFactory.forStatement(AstTestFactory.identifier3("e"), null,
+ [AstTestFactory.identifier3("u")], AstTestFactory.block()));
}
void test_visitForStatement_i() {
_assertSource(
"for (var i;;) {}",
- AstFactory.forStatement2(
- AstFactory.variableDeclarationList2(
- Keyword.VAR, [AstFactory.variableDeclaration("i")]),
+ AstTestFactory.forStatement2(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
null,
null,
- AstFactory.block()));
+ AstTestFactory.block()));
}
void test_visitForStatement_ic() {
_assertSource(
"for (var i; c;) {}",
- AstFactory.forStatement2(
- AstFactory.variableDeclarationList2(
- Keyword.VAR, [AstFactory.variableDeclaration("i")]),
- AstFactory.identifier3("c"),
+ AstTestFactory.forStatement2(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ AstTestFactory.identifier3("c"),
null,
- AstFactory.block()));
+ AstTestFactory.block()));
}
void test_visitForStatement_icu() {
_assertSource(
"for (var i; c; u) {}",
- AstFactory.forStatement2(
- AstFactory.variableDeclarationList2(
- Keyword.VAR, [AstFactory.variableDeclaration("i")]),
- AstFactory.identifier3("c"),
- [AstFactory.identifier3("u")],
- AstFactory.block()));
+ AstTestFactory.forStatement2(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
+ AstTestFactory.identifier3("c"),
+ [AstTestFactory.identifier3("u")],
+ AstTestFactory.block()));
}
void test_visitForStatement_iu() {
_assertSource(
"for (var i;; u) {}",
- AstFactory.forStatement2(
- AstFactory.variableDeclarationList2(
- Keyword.VAR, [AstFactory.variableDeclaration("i")]),
+ AstTestFactory.forStatement2(
+ AstTestFactory.variableDeclarationList2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("i")]),
null,
- [AstFactory.identifier3("u")],
- AstFactory.block()));
+ [AstTestFactory.identifier3("u")],
+ AstTestFactory.block()));
}
void test_visitForStatement_u() {
_assertSource(
"for (;; u) {}",
- AstFactory.forStatement(
- null, null, [AstFactory.identifier3("u")], AstFactory.block()));
+ AstTestFactory.forStatement(null, null,
+ [AstTestFactory.identifier3("u")], AstTestFactory.block()));
}
void test_visitFunctionDeclaration_external() {
- FunctionDeclaration functionDeclaration = AstFactory.functionDeclaration(
- null,
- null,
- "f",
- AstFactory.functionExpression2(
- AstFactory.formalParameterList(), AstFactory.emptyFunctionBody()));
+ FunctionDeclaration functionDeclaration =
+ AstTestFactory.functionDeclaration(
+ null,
+ null,
+ "f",
+ AstTestFactory.functionExpression2(
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.emptyFunctionBody()));
functionDeclaration.externalKeyword =
TokenFactory.tokenFromKeyword(Keyword.EXTERNAL);
_assertSource("external f();", functionDeclaration);
@@ -4475,158 +4627,168 @@ class ToSourceVisitorTest extends EngineTestCase {
void test_visitFunctionDeclaration_getter() {
_assertSource(
"get f() {}",
- AstFactory.functionDeclaration(
- null, Keyword.GET, "f", AstFactory.functionExpression()));
+ AstTestFactory.functionDeclaration(
+ null, Keyword.GET, "f", AstTestFactory.functionExpression()));
}
void test_visitFunctionDeclaration_local_blockBody() {
- FunctionDeclaration f = AstFactory.functionDeclaration(
- null, null, "f", AstFactory.functionExpression());
+ FunctionDeclaration f = AstTestFactory.functionDeclaration(
+ null, null, "f", AstTestFactory.functionExpression());
FunctionDeclarationStatement fStatement =
new FunctionDeclarationStatement(f);
_assertSource(
"main() {f() {} 42;}",
- AstFactory.functionDeclaration(
+ AstTestFactory.functionDeclaration(
null,
null,
"main",
- AstFactory.functionExpression2(
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2([
+ AstTestFactory.functionExpression2(
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2([
fStatement,
- AstFactory.expressionStatement(AstFactory.integer(42))
+ AstTestFactory.expressionStatement(AstTestFactory.integer(42))
]))));
}
void test_visitFunctionDeclaration_local_expressionBody() {
- FunctionDeclaration f = AstFactory.functionDeclaration(
+ FunctionDeclaration f = AstTestFactory.functionDeclaration(
null,
null,
"f",
- AstFactory.functionExpression2(AstFactory.formalParameterList(),
- AstFactory.expressionFunctionBody(AstFactory.integer(1))));
+ AstTestFactory.functionExpression2(AstTestFactory.formalParameterList(),
+ AstTestFactory.expressionFunctionBody(AstTestFactory.integer(1))));
FunctionDeclarationStatement fStatement =
new FunctionDeclarationStatement(f);
_assertSource(
"main() {f() => 1; 2;}",
- AstFactory.functionDeclaration(
+ AstTestFactory.functionDeclaration(
null,
null,
"main",
- AstFactory.functionExpression2(
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2([
+ AstTestFactory.functionExpression2(
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2([
fStatement,
- AstFactory.expressionStatement(AstFactory.integer(2))
+ AstTestFactory.expressionStatement(AstTestFactory.integer(2))
]))));
}
void test_visitFunctionDeclaration_normal() {
_assertSource(
"f() {}",
- AstFactory.functionDeclaration(
- null, null, "f", AstFactory.functionExpression()));
+ AstTestFactory.functionDeclaration(
+ null, null, "f", AstTestFactory.functionExpression()));
}
void test_visitFunctionDeclaration_setter() {
_assertSource(
"set f() {}",
- AstFactory.functionDeclaration(
- null, Keyword.SET, "f", AstFactory.functionExpression()));
+ AstTestFactory.functionDeclaration(
+ null, Keyword.SET, "f", AstTestFactory.functionExpression()));
}
void test_visitFunctionDeclaration_typeParameters() {
_assertSource(
"f<E>() {}",
- AstFactory.functionDeclaration(
+ AstTestFactory.functionDeclaration(
null,
null,
"f",
- AstFactory.functionExpression3(
- AstFactory.typeParameterList(['E']),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2())));
+ AstTestFactory.functionExpression3(
+ AstTestFactory.typeParameterList(['E']),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2())));
}
void test_visitFunctionDeclaration_withMetadata() {
- FunctionDeclaration declaration = AstFactory.functionDeclaration(
- null, null, "f", AstFactory.functionExpression());
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ FunctionDeclaration declaration = AstTestFactory.functionDeclaration(
+ null, null, "f", AstTestFactory.functionExpression());
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated f() {}", declaration);
}
void test_visitFunctionDeclarationStatement() {
_assertSource(
"f() {}",
- AstFactory.functionDeclarationStatement(
- null, null, "f", AstFactory.functionExpression()));
+ AstTestFactory.functionDeclarationStatement(
+ null, null, "f", AstTestFactory.functionExpression()));
}
void test_visitFunctionExpression() {
- _assertSource("() {}", AstFactory.functionExpression());
+ _assertSource("() {}", AstTestFactory.functionExpression());
}
void test_visitFunctionExpression_typeParameters() {
_assertSource(
"<E>() {}",
- AstFactory.functionExpression3(AstFactory.typeParameterList(['E']),
- AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()));
+ AstTestFactory.functionExpression3(
+ AstTestFactory.typeParameterList(['E']),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitFunctionExpressionInvocation_minimal() {
- _assertSource("f()",
- AstFactory.functionExpressionInvocation(AstFactory.identifier3("f")));
+ _assertSource(
+ "f()",
+ AstTestFactory
+ .functionExpressionInvocation(AstTestFactory.identifier3("f")));
}
void test_visitFunctionExpressionInvocation_typeArguments() {
_assertSource(
"f<A>()",
- AstFactory.functionExpressionInvocation2(AstFactory.identifier3("f"),
- AstFactory.typeArgumentList([AstFactory.typeName4('A')])));
+ AstTestFactory.functionExpressionInvocation2(
+ AstTestFactory.identifier3("f"),
+ AstTestFactory.typeArgumentList([AstTestFactory.typeName4('A')])));
}
void test_visitFunctionTypeAlias_generic() {
_assertSource(
"typedef A F<B>();",
- AstFactory.typeAlias(
- AstFactory.typeName4("A"),
+ AstTestFactory.typeAlias(
+ AstTestFactory.typeName4("A"),
"F",
- AstFactory.typeParameterList(["B"]),
- AstFactory.formalParameterList()));
+ AstTestFactory.typeParameterList(["B"]),
+ AstTestFactory.formalParameterList()));
}
void test_visitFunctionTypeAlias_nonGeneric() {
_assertSource(
"typedef A F();",
- AstFactory.typeAlias(AstFactory.typeName4("A"), "F", null,
- AstFactory.formalParameterList()));
+ AstTestFactory.typeAlias(AstTestFactory.typeName4("A"), "F", null,
+ AstTestFactory.formalParameterList()));
}
void test_visitFunctionTypeAlias_withMetadata() {
- FunctionTypeAlias declaration = AstFactory.typeAlias(
- AstFactory.typeName4("A"), "F", null, AstFactory.formalParameterList());
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ FunctionTypeAlias declaration = AstTestFactory.typeAlias(
+ AstTestFactory.typeName4("A"),
+ "F",
+ null,
+ AstTestFactory.formalParameterList());
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated typedef A F();", declaration);
}
void test_visitFunctionTypedFormalParameter_annotation() {
FunctionTypedFormalParameter parameter =
- AstFactory.functionTypedFormalParameter(null, "f");
- parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ AstTestFactory.functionTypedFormalParameter(null, "f");
+ parameter.metadata
+ .add(AstTestFactory.annotation(AstTestFactory.identifier3("A")));
_assertSource('@A f()', parameter);
}
void test_visitFunctionTypedFormalParameter_noType() {
- _assertSource("f()", AstFactory.functionTypedFormalParameter(null, "f"));
+ _assertSource(
+ "f()", AstTestFactory.functionTypedFormalParameter(null, "f"));
}
void test_visitFunctionTypedFormalParameter_type() {
_assertSource(
"T f()",
- AstFactory.functionTypedFormalParameter(
- AstFactory.typeName4("T"), "f"));
+ AstTestFactory.functionTypedFormalParameter(
+ AstTestFactory.typeName4("T"), "f"));
}
void test_visitFunctionTypedFormalParameter_typeParameters() {
@@ -4635,939 +4797,971 @@ class ToSourceVisitorTest extends EngineTestCase {
new FunctionTypedFormalParameter(
null,
null,
- AstFactory.typeName4("T"),
- AstFactory.identifier3('f'),
- AstFactory.typeParameterList(['E']),
- AstFactory.formalParameterList([])));
+ AstTestFactory.typeName4("T"),
+ AstTestFactory.identifier3('f'),
+ AstTestFactory.typeParameterList(['E']),
+ AstTestFactory.formalParameterList([])));
}
void test_visitIfStatement_withElse() {
_assertSource(
"if (c) {} else {}",
- AstFactory.ifStatement2(AstFactory.identifier3("c"), AstFactory.block(),
- AstFactory.block()));
+ AstTestFactory.ifStatement2(AstTestFactory.identifier3("c"),
+ AstTestFactory.block(), AstTestFactory.block()));
}
void test_visitIfStatement_withoutElse() {
_assertSource(
"if (c) {}",
- AstFactory.ifStatement(
- AstFactory.identifier3("c"), AstFactory.block()));
+ AstTestFactory.ifStatement(
+ AstTestFactory.identifier3("c"), AstTestFactory.block()));
}
void test_visitImplementsClause_multiple() {
_assertSource(
"implements A, B",
- AstFactory.implementsClause(
- [AstFactory.typeName4("A"), AstFactory.typeName4("B")]));
+ AstTestFactory.implementsClause(
+ [AstTestFactory.typeName4("A"), AstTestFactory.typeName4("B")]));
}
void test_visitImplementsClause_single() {
_assertSource("implements A",
- AstFactory.implementsClause([AstFactory.typeName4("A")]));
+ AstTestFactory.implementsClause([AstTestFactory.typeName4("A")]));
}
void test_visitImportDirective_combinator() {
_assertSource(
"import 'a.dart' show A;",
- AstFactory.importDirective3("a.dart", null, [
- AstFactory.showCombinator([AstFactory.identifier3("A")])
+ AstTestFactory.importDirective3("a.dart", null, [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")])
]));
}
void test_visitImportDirective_combinators() {
_assertSource(
"import 'a.dart' show A hide B;",
- AstFactory.importDirective3("a.dart", null, [
- AstFactory.showCombinator([AstFactory.identifier3("A")]),
- AstFactory.hideCombinator([AstFactory.identifier3("B")])
+ AstTestFactory.importDirective3("a.dart", null, [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")]),
+ AstTestFactory.hideCombinator([AstTestFactory.identifier3("B")])
]));
}
void test_visitImportDirective_deferred() {
_assertSource("import 'a.dart' deferred as p;",
- AstFactory.importDirective2("a.dart", true, "p"));
+ AstTestFactory.importDirective2("a.dart", true, "p"));
}
void test_visitImportDirective_minimal() {
_assertSource(
- "import 'a.dart';", AstFactory.importDirective3("a.dart", null));
+ "import 'a.dart';", AstTestFactory.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;",
+ AstTestFactory.importDirective3("a.dart", "p"));
}
void test_visitImportDirective_prefix_combinator() {
_assertSource(
"import 'a.dart' as p show A;",
- AstFactory.importDirective3("a.dart", "p", [
- AstFactory.showCombinator([AstFactory.identifier3("A")])
+ AstTestFactory.importDirective3("a.dart", "p", [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")])
]));
}
void test_visitImportDirective_prefix_combinators() {
_assertSource(
"import 'a.dart' as p show A hide B;",
- AstFactory.importDirective3("a.dart", "p", [
- AstFactory.showCombinator([AstFactory.identifier3("A")]),
- AstFactory.hideCombinator([AstFactory.identifier3("B")])
+ AstTestFactory.importDirective3("a.dart", "p", [
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("A")]),
+ AstTestFactory.hideCombinator([AstTestFactory.identifier3("B")])
]));
}
void test_visitImportDirective_withMetadata() {
- ImportDirective directive = AstFactory.importDirective3("a.dart", null);
- directive.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ ImportDirective directive = AstTestFactory.importDirective3("a.dart", null);
+ directive.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated import 'a.dart';", directive);
}
void test_visitImportHideCombinator_multiple() {
_assertSource(
"hide a, b",
- AstFactory.hideCombinator(
- [AstFactory.identifier3("a"), AstFactory.identifier3("b")]));
+ AstTestFactory.hideCombinator([
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b")
+ ]));
}
void test_visitImportHideCombinator_single() {
- _assertSource(
- "hide a", AstFactory.hideCombinator([AstFactory.identifier3("a")]));
+ _assertSource("hide a",
+ AstTestFactory.hideCombinator([AstTestFactory.identifier3("a")]));
}
void test_visitImportShowCombinator_multiple() {
_assertSource(
"show a, b",
- AstFactory.showCombinator(
- [AstFactory.identifier3("a"), AstFactory.identifier3("b")]));
+ AstTestFactory.showCombinator([
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b")
+ ]));
}
void test_visitImportShowCombinator_single() {
- _assertSource(
- "show a", AstFactory.showCombinator([AstFactory.identifier3("a")]));
+ _assertSource("show a",
+ AstTestFactory.showCombinator([AstTestFactory.identifier3("a")]));
}
void test_visitIndexExpression() {
_assertSource(
"a[i]",
- AstFactory.indexExpression(
- AstFactory.identifier3("a"), AstFactory.identifier3("i")));
+ AstTestFactory.indexExpression(
+ AstTestFactory.identifier3("a"), AstTestFactory.identifier3("i")));
}
void test_visitInstanceCreationExpression_const() {
_assertSource(
"const C()",
- AstFactory.instanceCreationExpression2(
- Keyword.CONST, AstFactory.typeName4("C")));
+ AstTestFactory.instanceCreationExpression2(
+ Keyword.CONST, AstTestFactory.typeName4("C")));
}
void test_visitInstanceCreationExpression_named() {
_assertSource(
"new C.c()",
- AstFactory.instanceCreationExpression3(
- Keyword.NEW, AstFactory.typeName4("C"), "c"));
+ AstTestFactory.instanceCreationExpression3(
+ Keyword.NEW, AstTestFactory.typeName4("C"), "c"));
}
void test_visitInstanceCreationExpression_unnamed() {
_assertSource(
"new C()",
- AstFactory.instanceCreationExpression2(
- Keyword.NEW, AstFactory.typeName4("C")));
+ AstTestFactory.instanceCreationExpression2(
+ Keyword.NEW, AstTestFactory.typeName4("C")));
}
void test_visitIntegerLiteral() {
- _assertSource("42", AstFactory.integer(42));
+ _assertSource("42", AstTestFactory.integer(42));
}
void test_visitInterpolationExpression_expression() {
- _assertSource("\${a}",
- AstFactory.interpolationExpression(AstFactory.identifier3("a")));
+ _assertSource(
+ "\${a}",
+ AstTestFactory
+ .interpolationExpression(AstTestFactory.identifier3("a")));
}
void test_visitInterpolationExpression_identifier() {
- _assertSource("\$a", AstFactory.interpolationExpression2("a"));
+ _assertSource("\$a", AstTestFactory.interpolationExpression2("a"));
}
void test_visitInterpolationString() {
- _assertSource("'x", AstFactory.interpolationString("'x", "x"));
+ _assertSource("'x", AstTestFactory.interpolationString("'x", "x"));
}
void test_visitIsExpression_negated() {
_assertSource(
"a is! C",
- AstFactory.isExpression(
- AstFactory.identifier3("a"), true, AstFactory.typeName4("C")));
+ AstTestFactory.isExpression(AstTestFactory.identifier3("a"), true,
+ AstTestFactory.typeName4("C")));
}
void test_visitIsExpression_normal() {
_assertSource(
"a is C",
- AstFactory.isExpression(
- AstFactory.identifier3("a"), false, AstFactory.typeName4("C")));
+ AstTestFactory.isExpression(AstTestFactory.identifier3("a"), false,
+ AstTestFactory.typeName4("C")));
}
void test_visitLabel() {
- _assertSource("a:", AstFactory.label2("a"));
+ _assertSource("a:", AstTestFactory.label2("a"));
}
void test_visitLabeledStatement_multiple() {
_assertSource(
"a: b: return;",
- AstFactory.labeledStatement(
- [AstFactory.label2("a"), AstFactory.label2("b")],
- AstFactory.returnStatement()));
+ AstTestFactory.labeledStatement(
+ [AstTestFactory.label2("a"), AstTestFactory.label2("b")],
+ AstTestFactory.returnStatement()));
}
void test_visitLabeledStatement_single() {
_assertSource(
"a: return;",
- AstFactory.labeledStatement(
- [AstFactory.label2("a")], AstFactory.returnStatement()));
+ AstTestFactory.labeledStatement(
+ [AstTestFactory.label2("a")], AstTestFactory.returnStatement()));
}
void test_visitLibraryDirective() {
- _assertSource("library l;", AstFactory.libraryDirective2("l"));
+ _assertSource("library l;", AstTestFactory.libraryDirective2("l"));
}
void test_visitLibraryDirective_withMetadata() {
- LibraryDirective directive = AstFactory.libraryDirective2("l");
- directive.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ LibraryDirective directive = AstTestFactory.libraryDirective2("l");
+ directive.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated library l;", directive);
}
void test_visitLibraryIdentifier_multiple() {
_assertSource(
"a.b.c",
- AstFactory.libraryIdentifier([
- AstFactory.identifier3("a"),
- AstFactory.identifier3("b"),
- AstFactory.identifier3("c")
+ AstTestFactory.libraryIdentifier([
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b"),
+ AstTestFactory.identifier3("c")
]));
}
void test_visitLibraryIdentifier_single() {
- _assertSource(
- "a", AstFactory.libraryIdentifier([AstFactory.identifier3("a")]));
+ _assertSource("a",
+ AstTestFactory.libraryIdentifier([AstTestFactory.identifier3("a")]));
}
void test_visitListLiteral_const() {
- _assertSource("const []", AstFactory.listLiteral2(Keyword.CONST, null));
+ _assertSource("const []", AstTestFactory.listLiteral2(Keyword.CONST, null));
}
void test_visitListLiteral_empty() {
- _assertSource("[]", AstFactory.listLiteral());
+ _assertSource("[]", AstTestFactory.listLiteral());
}
void test_visitListLiteral_nonEmpty() {
_assertSource(
"[a, b, c]",
- AstFactory.listLiteral([
- AstFactory.identifier3("a"),
- AstFactory.identifier3("b"),
- AstFactory.identifier3("c")
+ AstTestFactory.listLiteral([
+ AstTestFactory.identifier3("a"),
+ AstTestFactory.identifier3("b"),
+ AstTestFactory.identifier3("c")
]));
}
void test_visitMapLiteral_const() {
- _assertSource("const {}", AstFactory.mapLiteral(Keyword.CONST, null));
+ _assertSource("const {}", AstTestFactory.mapLiteral(Keyword.CONST, null));
}
void test_visitMapLiteral_empty() {
- _assertSource("{}", AstFactory.mapLiteral2());
+ _assertSource("{}", AstTestFactory.mapLiteral2());
}
void test_visitMapLiteral_nonEmpty() {
_assertSource(
"{'a' : a, 'b' : b, 'c' : c}",
- AstFactory.mapLiteral2([
- AstFactory.mapLiteralEntry("a", AstFactory.identifier3("a")),
- AstFactory.mapLiteralEntry("b", AstFactory.identifier3("b")),
- AstFactory.mapLiteralEntry("c", AstFactory.identifier3("c"))
+ AstTestFactory.mapLiteral2([
+ AstTestFactory.mapLiteralEntry("a", AstTestFactory.identifier3("a")),
+ AstTestFactory.mapLiteralEntry("b", AstTestFactory.identifier3("b")),
+ AstTestFactory.mapLiteralEntry("c", AstTestFactory.identifier3("c"))
]));
}
void test_visitMapLiteralEntry() {
_assertSource("'a' : b",
- AstFactory.mapLiteralEntry("a", AstFactory.identifier3("b")));
+ AstTestFactory.mapLiteralEntry("a", AstTestFactory.identifier3("b")));
}
void test_visitMethodDeclaration_external() {
_assertSource(
"external m();",
- AstFactory.methodDeclaration(null, null, null, null,
- AstFactory.identifier3("m"), AstFactory.formalParameterList()));
+ AstTestFactory.methodDeclaration(
+ null,
+ null,
+ null,
+ null,
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList()));
}
void test_visitMethodDeclaration_external_returnType() {
_assertSource(
"external T m();",
- AstFactory.methodDeclaration(
+ AstTestFactory.methodDeclaration(
null,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList()));
}
void test_visitMethodDeclaration_getter() {
_assertSource(
"get m {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
null,
Keyword.GET,
null,
- AstFactory.identifier3("m"),
+ AstTestFactory.identifier3("m"),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_getter_returnType() {
_assertSource(
"T get m {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
Keyword.GET,
null,
- AstFactory.identifier3("m"),
+ AstTestFactory.identifier3("m"),
null,
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_getter_seturnType() {
_assertSource(
"T set m(var v) {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
Keyword.SET,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(
- [AstFactory.simpleFormalParameter(Keyword.VAR, "v")]),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(
+ [AstTestFactory.simpleFormalParameter(Keyword.VAR, "v")]),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_minimal() {
_assertSource(
"m() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
null,
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_multipleParameters() {
_assertSource(
"m(var a, var b) {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
null,
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList([
- AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
- AstFactory.simpleFormalParameter(Keyword.VAR, "b")
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList([
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "a"),
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "b")
]),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_operator() {
_assertSource(
"operator +() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
null,
null,
Keyword.OPERATOR,
- AstFactory.identifier3("+"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("+"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_operator_returnType() {
_assertSource(
"T operator +() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
null,
Keyword.OPERATOR,
- AstFactory.identifier3("+"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("+"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_returnType() {
_assertSource(
"T m() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_setter() {
_assertSource(
"set m(var v) {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
null,
null,
Keyword.SET,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(
- [AstFactory.simpleFormalParameter(Keyword.VAR, "v")]),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(
+ [AstTestFactory.simpleFormalParameter(Keyword.VAR, "v")]),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_static() {
_assertSource(
"static m() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
Keyword.STATIC,
null,
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_static_returnType() {
_assertSource(
"static T m() {}",
- AstFactory.methodDeclaration2(
+ AstTestFactory.methodDeclaration2(
Keyword.STATIC,
- AstFactory.typeName4("T"),
+ AstTestFactory.typeName4("T"),
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_typeParameters() {
_assertSource(
"m<E>() {}",
- AstFactory.methodDeclaration3(
+ AstTestFactory.methodDeclaration3(
null,
null,
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.typeParameterList(['E']),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2()));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.typeParameterList(['E']),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2()));
}
void test_visitMethodDeclaration_withMetadata() {
- MethodDeclaration declaration = AstFactory.methodDeclaration2(
+ MethodDeclaration declaration = AstTestFactory.methodDeclaration2(
null,
null,
null,
null,
- AstFactory.identifier3("m"),
- AstFactory.formalParameterList(),
- AstFactory.blockFunctionBody2());
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ AstTestFactory.identifier3("m"),
+ AstTestFactory.formalParameterList(),
+ AstTestFactory.blockFunctionBody2());
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated m() {}", declaration);
}
void test_visitMethodInvocation_conditional() {
_assertSource(
"t?.m()",
- AstFactory.methodInvocation(
- AstFactory.identifier3("t"), "m", null, TokenType.QUESTION_PERIOD));
+ AstTestFactory.methodInvocation(AstTestFactory.identifier3("t"), "m",
+ null, TokenType.QUESTION_PERIOD));
}
void test_visitMethodInvocation_noTarget() {
- _assertSource("m()", AstFactory.methodInvocation2("m"));
+ _assertSource("m()", AstTestFactory.methodInvocation2("m"));
}
void test_visitMethodInvocation_target() {
- _assertSource(
- "t.m()", AstFactory.methodInvocation(AstFactory.identifier3("t"), "m"));
+ _assertSource("t.m()",
+ AstTestFactory.methodInvocation(AstTestFactory.identifier3("t"), "m"));
}
void test_visitMethodInvocation_typeArguments() {
_assertSource(
"m<A>()",
- AstFactory.methodInvocation3(null, "m",
- AstFactory.typeArgumentList([AstFactory.typeName4('A')])));
+ AstTestFactory.methodInvocation3(null, "m",
+ AstTestFactory.typeArgumentList([AstTestFactory.typeName4('A')])));
}
void test_visitNamedExpression() {
- _assertSource(
- "a: b", AstFactory.namedExpression2("a", AstFactory.identifier3("b")));
+ _assertSource("a: b",
+ AstTestFactory.namedExpression2("a", AstTestFactory.identifier3("b")));
}
void test_visitNamedFormalParameter() {
_assertSource(
"var a : 0",
- AstFactory.namedFormalParameter(
- AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
- AstFactory.integer(0)));
+ AstTestFactory.namedFormalParameter(
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "a"),
+ AstTestFactory.integer(0)));
}
void test_visitNativeClause() {
- _assertSource("native 'code'", AstFactory.nativeClause("code"));
+ _assertSource("native 'code'", AstTestFactory.nativeClause("code"));
}
void test_visitNativeFunctionBody() {
- _assertSource("native 'str';", AstFactory.nativeFunctionBody("str"));
+ _assertSource("native 'str';", AstTestFactory.nativeFunctionBody("str"));
}
void test_visitNullLiteral() {
- _assertSource("null", AstFactory.nullLiteral());
+ _assertSource("null", AstTestFactory.nullLiteral());
}
void test_visitParenthesizedExpression() {
_assertSource(
- "(a)", AstFactory.parenthesizedExpression(AstFactory.identifier3("a")));
+ "(a)",
+ AstTestFactory
+ .parenthesizedExpression(AstTestFactory.identifier3("a")));
}
void test_visitPartDirective() {
- _assertSource("part 'a.dart';", AstFactory.partDirective2("a.dart"));
+ _assertSource("part 'a.dart';", AstTestFactory.partDirective2("a.dart"));
}
void test_visitPartDirective_withMetadata() {
- PartDirective directive = AstFactory.partDirective2("a.dart");
- directive.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ PartDirective directive = AstTestFactory.partDirective2("a.dart");
+ directive.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated part 'a.dart';", directive);
}
void test_visitPartOfDirective() {
- _assertSource("part of l;",
- AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["l"])));
+ _assertSource(
+ "part of l;",
+ AstTestFactory
+ .partOfDirective(AstTestFactory.libraryIdentifier2(["l"])));
}
void test_visitPartOfDirective_withMetadata() {
- PartOfDirective directive =
- AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["l"]));
- directive.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ PartOfDirective directive = AstTestFactory
+ .partOfDirective(AstTestFactory.libraryIdentifier2(["l"]));
+ directive.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated part of l;", directive);
}
void test_visitPositionalFormalParameter() {
_assertSource(
"var a = 0",
- AstFactory.positionalFormalParameter(
- AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
- AstFactory.integer(0)));
+ AstTestFactory.positionalFormalParameter(
+ AstTestFactory.simpleFormalParameter(Keyword.VAR, "a"),
+ AstTestFactory.integer(0)));
}
void test_visitPostfixExpression() {
_assertSource(
"a++",
- AstFactory.postfixExpression(
- AstFactory.identifier3("a"), TokenType.PLUS_PLUS));
+ AstTestFactory.postfixExpression(
+ AstTestFactory.identifier3("a"), TokenType.PLUS_PLUS));
}
void test_visitPrefixedIdentifier() {
- _assertSource("a.b", AstFactory.identifier5("a", "b"));
+ _assertSource("a.b", AstTestFactory.identifier5("a", "b"));
}
void test_visitPrefixExpression() {
_assertSource(
"-a",
- AstFactory.prefixExpression(
- TokenType.MINUS, AstFactory.identifier3("a")));
+ AstTestFactory.prefixExpression(
+ TokenType.MINUS, AstTestFactory.identifier3("a")));
}
void test_visitPropertyAccess() {
- _assertSource(
- "a.b", AstFactory.propertyAccess2(AstFactory.identifier3("a"), "b"));
+ _assertSource("a.b",
+ AstTestFactory.propertyAccess2(AstTestFactory.identifier3("a"), "b"));
}
void test_visitPropertyAccess_conditional() {
_assertSource(
"a?.b",
- AstFactory.propertyAccess2(
- AstFactory.identifier3("a"), "b", TokenType.QUESTION_PERIOD));
+ AstTestFactory.propertyAccess2(
+ AstTestFactory.identifier3("a"), "b", TokenType.QUESTION_PERIOD));
}
void test_visitRedirectingConstructorInvocation_named() {
_assertSource(
- "this.c()", AstFactory.redirectingConstructorInvocation2("c"));
+ "this.c()", AstTestFactory.redirectingConstructorInvocation2("c"));
}
void test_visitRedirectingConstructorInvocation_unnamed() {
- _assertSource("this()", AstFactory.redirectingConstructorInvocation());
+ _assertSource("this()", AstTestFactory.redirectingConstructorInvocation());
}
void test_visitRethrowExpression() {
- _assertSource("rethrow", AstFactory.rethrowExpression());
+ _assertSource("rethrow", AstTestFactory.rethrowExpression());
}
void test_visitReturnStatement_expression() {
- _assertSource(
- "return a;", AstFactory.returnStatement2(AstFactory.identifier3("a")));
+ _assertSource("return a;",
+ AstTestFactory.returnStatement2(AstTestFactory.identifier3("a")));
}
void test_visitReturnStatement_noExpression() {
- _assertSource("return;", AstFactory.returnStatement());
+ _assertSource("return;", AstTestFactory.returnStatement());
}
void test_visitScriptTag() {
String scriptTag = "!#/bin/dart.exe";
- _assertSource(scriptTag, AstFactory.scriptTag(scriptTag));
+ _assertSource(scriptTag, AstTestFactory.scriptTag(scriptTag));
}
void test_visitSimpleFormalParameter_annotation() {
- SimpleFormalParameter parameter = AstFactory.simpleFormalParameter3('x');
- parameter.metadata.add(AstFactory.annotation(AstFactory.identifier3("A")));
+ SimpleFormalParameter parameter =
+ AstTestFactory.simpleFormalParameter3('x');
+ parameter.metadata
+ .add(AstTestFactory.annotation(AstTestFactory.identifier3("A")));
_assertSource('@A x', parameter);
}
void test_visitSimpleFormalParameter_keyword() {
- _assertSource("var a", AstFactory.simpleFormalParameter(Keyword.VAR, "a"));
+ _assertSource(
+ "var a", AstTestFactory.simpleFormalParameter(Keyword.VAR, "a"));
}
void test_visitSimpleFormalParameter_keyword_type() {
_assertSource(
"final A a",
- AstFactory.simpleFormalParameter2(
- Keyword.FINAL, AstFactory.typeName4("A"), "a"));
+ AstTestFactory.simpleFormalParameter2(
+ Keyword.FINAL, AstTestFactory.typeName4("A"), "a"));
}
void test_visitSimpleFormalParameter_type() {
- _assertSource("A a",
- AstFactory.simpleFormalParameter4(AstFactory.typeName4("A"), "a"));
+ _assertSource(
+ "A a",
+ AstTestFactory.simpleFormalParameter4(
+ AstTestFactory.typeName4("A"), "a"));
}
void test_visitSimpleIdentifier() {
- _assertSource("a", AstFactory.identifier3("a"));
+ _assertSource("a", AstTestFactory.identifier3("a"));
}
void test_visitSimpleStringLiteral() {
- _assertSource("'a'", AstFactory.string2("a"));
+ _assertSource("'a'", AstTestFactory.string2("a"));
}
void test_visitStringInterpolation() {
_assertSource(
"'a\${e}b'",
- AstFactory.string([
- AstFactory.interpolationString("'a", "a"),
- AstFactory.interpolationExpression(AstFactory.identifier3("e")),
- AstFactory.interpolationString("b'", "b")
+ AstTestFactory.string([
+ AstTestFactory.interpolationString("'a", "a"),
+ AstTestFactory
+ .interpolationExpression(AstTestFactory.identifier3("e")),
+ AstTestFactory.interpolationString("b'", "b")
]));
}
void test_visitSuperConstructorInvocation() {
- _assertSource("super()", AstFactory.superConstructorInvocation());
+ _assertSource("super()", AstTestFactory.superConstructorInvocation());
}
void test_visitSuperConstructorInvocation_named() {
- _assertSource("super.c()", AstFactory.superConstructorInvocation2("c"));
+ _assertSource("super.c()", AstTestFactory.superConstructorInvocation2("c"));
}
void test_visitSuperExpression() {
- _assertSource("super", AstFactory.superExpression());
+ _assertSource("super", AstTestFactory.superExpression());
}
void test_visitSwitchCase_multipleLabels() {
_assertSource(
"l1: l2: case a: {}",
- AstFactory.switchCase2(
- [AstFactory.label2("l1"), AstFactory.label2("l2")],
- AstFactory.identifier3("a"),
- [AstFactory.block()]));
+ AstTestFactory.switchCase2(
+ [AstTestFactory.label2("l1"), AstTestFactory.label2("l2")],
+ AstTestFactory.identifier3("a"),
+ [AstTestFactory.block()]));
}
void test_visitSwitchCase_multipleStatements() {
_assertSource(
"case a: {} {}",
- AstFactory.switchCase(AstFactory.identifier3("a"),
- [AstFactory.block(), AstFactory.block()]));
+ AstTestFactory.switchCase(AstTestFactory.identifier3("a"),
+ [AstTestFactory.block(), AstTestFactory.block()]));
}
void test_visitSwitchCase_noLabels() {
_assertSource(
"case a: {}",
- AstFactory
- .switchCase(AstFactory.identifier3("a"), [AstFactory.block()]));
+ AstTestFactory.switchCase(
+ AstTestFactory.identifier3("a"), [AstTestFactory.block()]));
}
void test_visitSwitchCase_singleLabel() {
_assertSource(
"l1: case a: {}",
- AstFactory.switchCase2([AstFactory.label2("l1")],
- AstFactory.identifier3("a"), [AstFactory.block()]));
+ AstTestFactory.switchCase2([AstTestFactory.label2("l1")],
+ AstTestFactory.identifier3("a"), [AstTestFactory.block()]));
}
void test_visitSwitchDefault_multipleLabels() {
_assertSource(
"l1: l2: default: {}",
- AstFactory.switchDefault(
- [AstFactory.label2("l1"), AstFactory.label2("l2")],
- [AstFactory.block()]));
+ AstTestFactory.switchDefault(
+ [AstTestFactory.label2("l1"), AstTestFactory.label2("l2")],
+ [AstTestFactory.block()]));
}
void test_visitSwitchDefault_multipleStatements() {
- _assertSource("default: {} {}",
- AstFactory.switchDefault2([AstFactory.block(), AstFactory.block()]));
+ _assertSource(
+ "default: {} {}",
+ AstTestFactory
+ .switchDefault2([AstTestFactory.block(), AstTestFactory.block()]));
}
void test_visitSwitchDefault_noLabels() {
_assertSource(
- "default: {}", AstFactory.switchDefault2([AstFactory.block()]));
+ "default: {}", AstTestFactory.switchDefault2([AstTestFactory.block()]));
}
void test_visitSwitchDefault_singleLabel() {
_assertSource(
"l1: default: {}",
- AstFactory
- .switchDefault([AstFactory.label2("l1")], [AstFactory.block()]));
+ AstTestFactory.switchDefault(
+ [AstTestFactory.label2("l1")], [AstTestFactory.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()])
+ AstTestFactory.switchStatement(AstTestFactory.identifier3("a"), [
+ AstTestFactory.switchCase(
+ AstTestFactory.string2("b"), [AstTestFactory.block()]),
+ AstTestFactory.switchDefault2([AstTestFactory.block()])
]));
}
void test_visitSymbolLiteral_multiple() {
- _assertSource("#a.b.c", AstFactory.symbolLiteral(["a", "b", "c"]));
+ _assertSource("#a.b.c", AstTestFactory.symbolLiteral(["a", "b", "c"]));
}
void test_visitSymbolLiteral_single() {
- _assertSource("#a", AstFactory.symbolLiteral(["a"]));
+ _assertSource("#a", AstTestFactory.symbolLiteral(["a"]));
}
void test_visitThisExpression() {
- _assertSource("this", AstFactory.thisExpression());
+ _assertSource("this", AstTestFactory.thisExpression());
}
void test_visitThrowStatement() {
- _assertSource(
- "throw e", AstFactory.throwExpression2(AstFactory.identifier3("e")));
+ _assertSource("throw e",
+ AstTestFactory.throwExpression2(AstTestFactory.identifier3("e")));
}
void test_visitTopLevelVariableDeclaration_multiple() {
_assertSource(
"var a;",
- AstFactory.topLevelVariableDeclaration2(
- Keyword.VAR, [AstFactory.variableDeclaration("a")]));
+ AstTestFactory.topLevelVariableDeclaration2(
+ Keyword.VAR, [AstTestFactory.variableDeclaration("a")]));
}
void test_visitTopLevelVariableDeclaration_single() {
_assertSource(
"var a, b;",
- AstFactory.topLevelVariableDeclaration2(Keyword.VAR, [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.topLevelVariableDeclaration2(Keyword.VAR, [
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]));
}
void test_visitTryStatement_catch() {
_assertSource(
"try {} on E {}",
- AstFactory.tryStatement2(AstFactory.block(),
- [AstFactory.catchClause3(AstFactory.typeName4("E"))]));
+ AstTestFactory.tryStatement2(AstTestFactory.block(),
+ [AstTestFactory.catchClause3(AstTestFactory.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"))
+ AstTestFactory.tryStatement2(AstTestFactory.block(), [
+ AstTestFactory.catchClause3(AstTestFactory.typeName4("E")),
+ AstTestFactory.catchClause3(AstTestFactory.typeName4("F"))
]));
}
void test_visitTryStatement_catchFinally() {
_assertSource(
"try {} on E {} finally {}",
- AstFactory.tryStatement3(
- AstFactory.block(),
- [AstFactory.catchClause3(AstFactory.typeName4("E"))],
- AstFactory.block()));
+ AstTestFactory.tryStatement3(
+ AstTestFactory.block(),
+ [AstTestFactory.catchClause3(AstTestFactory.typeName4("E"))],
+ AstTestFactory.block()));
}
void test_visitTryStatement_finally() {
- _assertSource("try {} finally {}",
- AstFactory.tryStatement(AstFactory.block(), AstFactory.block()));
+ _assertSource(
+ "try {} finally {}",
+ AstTestFactory.tryStatement(
+ AstTestFactory.block(), AstTestFactory.block()));
}
void test_visitTypeArgumentList_multiple() {
_assertSource(
"<E, F>",
- AstFactory.typeArgumentList(
- [AstFactory.typeName4("E"), AstFactory.typeName4("F")]));
+ AstTestFactory.typeArgumentList(
+ [AstTestFactory.typeName4("E"), AstTestFactory.typeName4("F")]));
}
void test_visitTypeArgumentList_single() {
- _assertSource(
- "<E>", AstFactory.typeArgumentList([AstFactory.typeName4("E")]));
+ _assertSource("<E>",
+ AstTestFactory.typeArgumentList([AstTestFactory.typeName4("E")]));
}
void test_visitTypeName_multipleArgs() {
_assertSource(
"C<D, E>",
- AstFactory.typeName4(
- "C", [AstFactory.typeName4("D"), AstFactory.typeName4("E")]));
+ AstTestFactory.typeName4("C",
+ [AstTestFactory.typeName4("D"), AstTestFactory.typeName4("E")]));
}
void test_visitTypeName_nestedArg() {
_assertSource(
"C<D<E>>",
- AstFactory.typeName4("C", [
- AstFactory.typeName4("D", [AstFactory.typeName4("E")])
+ AstTestFactory.typeName4("C", [
+ AstTestFactory.typeName4("D", [AstTestFactory.typeName4("E")])
]));
}
void test_visitTypeName_noArgs() {
- _assertSource("C", AstFactory.typeName4("C"));
+ _assertSource("C", AstTestFactory.typeName4("C"));
}
void test_visitTypeName_singleArg() {
_assertSource(
- "C<D>", AstFactory.typeName4("C", [AstFactory.typeName4("D")]));
+ "C<D>", AstTestFactory.typeName4("C", [AstTestFactory.typeName4("D")]));
}
void test_visitTypeParameter_withExtends() {
_assertSource("E extends C",
- AstFactory.typeParameter2("E", AstFactory.typeName4("C")));
+ AstTestFactory.typeParameter2("E", AstTestFactory.typeName4("C")));
}
void test_visitTypeParameter_withMetadata() {
- TypeParameter parameter = AstFactory.typeParameter("E");
- parameter.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ TypeParameter parameter = AstTestFactory.typeParameter("E");
+ parameter.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated E", parameter);
}
void test_visitTypeParameter_withoutExtends() {
- _assertSource("E", AstFactory.typeParameter("E"));
+ _assertSource("E", AstTestFactory.typeParameter("E"));
}
void test_visitTypeParameterList_multiple() {
- _assertSource("<E, F>", AstFactory.typeParameterList(["E", "F"]));
+ _assertSource("<E, F>", AstTestFactory.typeParameterList(["E", "F"]));
}
void test_visitTypeParameterList_single() {
- _assertSource("<E>", AstFactory.typeParameterList(["E"]));
+ _assertSource("<E>", AstTestFactory.typeParameterList(["E"]));
}
void test_visitVariableDeclaration_initialized() {
- _assertSource("a = b",
- AstFactory.variableDeclaration2("a", AstFactory.identifier3("b")));
+ _assertSource(
+ "a = b",
+ AstTestFactory.variableDeclaration2(
+ "a", AstTestFactory.identifier3("b")));
}
void test_visitVariableDeclaration_uninitialized() {
- _assertSource("a", AstFactory.variableDeclaration("a"));
+ _assertSource("a", AstTestFactory.variableDeclaration("a"));
}
void test_visitVariableDeclaration_withMetadata() {
- VariableDeclaration declaration = AstFactory.variableDeclaration("a");
- declaration.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ VariableDeclaration declaration = AstTestFactory.variableDeclaration("a");
+ declaration.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated a", declaration);
}
void test_visitVariableDeclarationList_const_type() {
_assertSource(
"const C a, b",
- AstFactory.variableDeclarationList(
- Keyword.CONST, AstFactory.typeName4("C"), [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.variableDeclarationList(
+ Keyword.CONST, AstTestFactory.typeName4("C"), [
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]));
}
void test_visitVariableDeclarationList_final_noType() {
_assertSource(
"final a, b",
- AstFactory.variableDeclarationList2(Keyword.FINAL, [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.variableDeclarationList2(Keyword.FINAL, [
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]));
}
void test_visitVariableDeclarationList_final_withMetadata() {
- VariableDeclarationList declarationList = AstFactory
+ VariableDeclarationList declarationList = AstTestFactory
.variableDeclarationList2(Keyword.FINAL, [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]);
- declarationList.metadata
- .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
+ declarationList.metadata.add(
+ AstTestFactory.annotation(AstTestFactory.identifier3("deprecated")));
_assertSource("@deprecated final a, b", declarationList);
}
void test_visitVariableDeclarationList_type() {
_assertSource(
"C a, b",
- AstFactory.variableDeclarationList(null, AstFactory.typeName4("C"), [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.variableDeclarationList(
+ null, AstTestFactory.typeName4("C"), [
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]));
}
void test_visitVariableDeclarationList_var() {
_assertSource(
"var a, b",
- AstFactory.variableDeclarationList2(Keyword.VAR, [
- AstFactory.variableDeclaration("a"),
- AstFactory.variableDeclaration("b")
+ AstTestFactory.variableDeclarationList2(Keyword.VAR, [
+ AstTestFactory.variableDeclaration("a"),
+ AstTestFactory.variableDeclaration("b")
]));
}
void test_visitVariableDeclarationStatement() {
_assertSource(
"C c;",
- AstFactory.variableDeclarationStatement(null, AstFactory.typeName4("C"),
- [AstFactory.variableDeclaration("c")]));
+ AstTestFactory.variableDeclarationStatement(
+ null,
+ AstTestFactory.typeName4("C"),
+ [AstTestFactory.variableDeclaration("c")]));
}
void test_visitWhileStatement() {
_assertSource(
"while (c) {}",
- AstFactory.whileStatement(
- AstFactory.identifier3("c"), AstFactory.block()));
+ AstTestFactory.whileStatement(
+ AstTestFactory.identifier3("c"), AstTestFactory.block()));
}
void test_visitWithClause_multiple() {
_assertSource(
"with A, B, C",
- AstFactory.withClause([
- AstFactory.typeName4("A"),
- AstFactory.typeName4("B"),
- AstFactory.typeName4("C")
+ AstTestFactory.withClause([
+ AstTestFactory.typeName4("A"),
+ AstTestFactory.typeName4("B"),
+ AstTestFactory.typeName4("C")
]));
}
void test_visitWithClause_single() {
- _assertSource("with A", AstFactory.withClause([AstFactory.typeName4("A")]));
+ _assertSource(
+ "with A", AstTestFactory.withClause([AstTestFactory.typeName4("A")]));
}
void test_visitYieldStatement() {
- _assertSource(
- "yield e;", AstFactory.yieldStatement(AstFactory.identifier3("e")));
+ _assertSource("yield e;",
+ AstTestFactory.yieldStatement(AstTestFactory.identifier3("e")));
}
void test_visitYieldStatement_each() {
_assertSource("yield* e;",
- AstFactory.yieldEachStatement(AstFactory.identifier3("e")));
+ AstTestFactory.yieldEachStatement(AstTestFactory.identifier3("e")));
}
/**
« no previous file with comments | « pkg/analyzer/test/generated/utilities_test.dart ('k') | pkg/analyzer/test/src/dart/constant/evaluation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698