mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 08:31:29 +00:00
Revert "Transition analyzer and analysis_server to new astFactory; remove old AST factory methods."
This reverts commit 1d028eed8d
.
This was breaking DDC.
TBR=paulberry@google.com
Review URL: https://codereview.chromium.org/2542753002 .
This commit is contained in:
parent
554c3c9683
commit
b8d3758dcd
|
@ -19,7 +19,6 @@ import 'package:analysis_server/src/services/completion/dart/contribution_sorter
|
|||
import 'package:analysis_server/src/services/completion/dart/optype.dart';
|
||||
import 'package:analysis_server/src/services/search/search_engine.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
|
@ -517,8 +516,7 @@ class ReplacementRange {
|
|||
}
|
||||
}
|
||||
if (token is StringToken) {
|
||||
SimpleStringLiteral uri =
|
||||
astFactory.simpleStringLiteral(token, token.lexeme);
|
||||
SimpleStringLiteral uri = new SimpleStringLiteral(token, token.lexeme);
|
||||
Keyword keyword = token.previous?.keyword;
|
||||
if (keyword == Keyword.IMPORT ||
|
||||
keyword == Keyword.EXPORT ||
|
||||
|
|
|
@ -15,7 +15,6 @@ import 'package:analysis_server/src/services/completion/dart/local_declaration_v
|
|||
show LocalDeclarationVisitor;
|
||||
import 'package:analysis_server/src/services/completion/dart/optype.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/src/dart/ast/token.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
|
@ -25,9 +24,8 @@ import '../../../protocol_server.dart'
|
|||
|
||||
const DYNAMIC = 'dynamic';
|
||||
|
||||
final TypeName NO_RETURN_TYPE = astFactory.typeName(
|
||||
astFactory.simpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)),
|
||||
null);
|
||||
final TypeName NO_RETURN_TYPE = new TypeName(
|
||||
new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), null);
|
||||
|
||||
/**
|
||||
* Create a new protocol Element for inclusion in a completion suggestion.
|
||||
|
|
|
@ -16,7 +16,6 @@ import 'package:analysis_server/src/services/completion/dart/local_declaration_v
|
|||
import 'package:analysis_server/src/services/completion/dart/optype.dart';
|
||||
import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/src/dart/ast/token.dart';
|
||||
|
@ -27,9 +26,8 @@ import '../../../protocol_server.dart'
|
|||
|
||||
const DYNAMIC = 'dynamic';
|
||||
|
||||
final TypeName NO_RETURN_TYPE = astFactory.typeName(
|
||||
astFactory.simpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)),
|
||||
null);
|
||||
final TypeName NO_RETURN_TYPE = new TypeName(
|
||||
new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), null);
|
||||
|
||||
/**
|
||||
* Create a new protocol Element for inclusion in a completion suggestion.
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
library services.completion.dart.local.declaration.visitor;
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/src/dart/ast/token.dart';
|
||||
|
@ -16,8 +15,8 @@ import 'package:analyzer/src/dart/ast/token.dart';
|
|||
* which catches the exception thrown by [finished()].
|
||||
*/
|
||||
abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor {
|
||||
static final TypeName STACKTRACE_TYPE = astFactory.typeName(
|
||||
astFactory.simpleIdentifier(
|
||||
static final TypeName STACKTRACE_TYPE = new TypeName(
|
||||
new SimpleIdentifier(
|
||||
new StringToken(TokenType.IDENTIFIER, 'StackTrace', 0)),
|
||||
null);
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import 'package:analysis_server/src/services/completion/dart/optype.dart';
|
|||
import 'package:analysis_server/src/services/correction/strings.dart';
|
||||
import 'package:analysis_server/src/utilities/documentation.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
|
@ -30,9 +29,8 @@ import '../../../protocol_server.dart'
|
|||
|
||||
const DYNAMIC = 'dynamic';
|
||||
|
||||
final TypeName NO_RETURN_TYPE = astFactory.typeName(
|
||||
astFactory.simpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)),
|
||||
null);
|
||||
final TypeName NO_RETURN_TYPE = new TypeName(
|
||||
new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), null);
|
||||
|
||||
/**
|
||||
* Create a new protocol Element for inclusion in a completion suggestion.
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* Changed the API for creating BazelWorkspace. It should now be constructed using BazelWorkspace.find(). Note that this might return `null` in the event that the given path is not part of a BazelWorkspace.
|
||||
* Added an AST structure to support asserts in constructor initializers (AssertInitializer). AstVisitor classes must now implement visitAssertInitializer().
|
||||
* Changed the API for creating PartOfDirective. It now accepts a StringLiteral URI, to accomodate "part of" declarations with a URI string rather than a library name.
|
||||
* Removed AST constructors. AST nodes should now be created using `astFactory`, located in `package:analyzer/dart/ast/standard_ast_factory.dart`.
|
||||
|
||||
## 0.29.0-alpha.0
|
||||
* Removed `Element.docRange`.
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -29,7 +29,6 @@ import 'package:analyzer/src/generated/type_system.dart'
|
|||
import 'package:analyzer/src/generated/utilities_collection.dart';
|
||||
import 'package:analyzer/src/generated/utilities_dart.dart' show ParameterKind;
|
||||
import 'package:analyzer/src/task/dart.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
|
||||
/**
|
||||
* Helper class encapsulating the methods for evaluating constants and
|
||||
|
@ -718,7 +717,7 @@ class ConstantEvaluationEngine {
|
|||
superclass.lookUpConstructor(superName, constructor.library);
|
||||
if (superConstructor != null) {
|
||||
if (superArguments == null) {
|
||||
superArguments = astFactory.nodeList/*<Expression>*/(null);
|
||||
superArguments = new NodeList<Expression>(null);
|
||||
}
|
||||
|
||||
evaluateSuperConstructorCall(node, fieldMap, superConstructor,
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import 'dart:collection';
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
|
@ -963,8 +962,8 @@ class InheritanceManager {
|
|||
int numOfPositionalParameters,
|
||||
List<String> namedParameters) {
|
||||
DynamicTypeImpl dynamicType = DynamicTypeImpl.instance;
|
||||
SimpleIdentifier nameIdentifier = astFactory
|
||||
.simpleIdentifier(new StringToken(TokenType.IDENTIFIER, name, 0));
|
||||
SimpleIdentifier nameIdentifier =
|
||||
new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, name, 0));
|
||||
ExecutableElementImpl executable;
|
||||
ExecutableElement elementToMerge = elementArrayToMerge[0];
|
||||
if (elementToMerge is MethodElement) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5,9 +5,9 @@
|
|||
library analyzer.src.generated.testing.ast_test_factory;
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/src/dart/ast/ast.dart';
|
||||
import 'package:analyzer/src/generated/testing/token_factory.dart';
|
||||
import 'package:analyzer/src/generated/utilities_dart.dart';
|
||||
|
||||
|
@ -25,14 +25,14 @@ import 'package:analyzer/src/generated/utilities_dart.dart';
|
|||
*/
|
||||
class AstTestFactory {
|
||||
static AdjacentStrings adjacentStrings(List<StringLiteral> strings) =>
|
||||
astFactory.adjacentStrings(strings);
|
||||
new AdjacentStrings(strings);
|
||||
|
||||
static Annotation annotation(Identifier name) => astFactory.annotation(
|
||||
static Annotation annotation(Identifier name) => new Annotation(
|
||||
TokenFactory.tokenFromType(TokenType.AT), name, null, null, null);
|
||||
|
||||
static Annotation annotation2(Identifier name,
|
||||
SimpleIdentifier constructorName, ArgumentList arguments) =>
|
||||
astFactory.annotation(
|
||||
new Annotation(
|
||||
TokenFactory.tokenFromType(TokenType.AT),
|
||||
name,
|
||||
constructorName == null
|
||||
|
@ -42,16 +42,16 @@ class AstTestFactory {
|
|||
arguments);
|
||||
|
||||
static ArgumentList argumentList([List<Expression> arguments]) =>
|
||||
astFactory.argumentList(TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
new ArgumentList(TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
arguments, TokenFactory.tokenFromType(TokenType.CLOSE_PAREN));
|
||||
|
||||
static AsExpression asExpression(Expression expression, TypeName type) =>
|
||||
astFactory.asExpression(
|
||||
new AsExpression(
|
||||
expression, TokenFactory.tokenFromKeyword(Keyword.AS), type);
|
||||
|
||||
static AssertStatement assertStatement(Expression condition,
|
||||
[Expression message]) =>
|
||||
astFactory.assertStatement(
|
||||
new AssertStatement(
|
||||
TokenFactory.tokenFromKeyword(Keyword.ASSERT),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
condition,
|
||||
|
@ -62,19 +62,19 @@ class AstTestFactory {
|
|||
|
||||
static AssignmentExpression assignmentExpression(Expression leftHandSide,
|
||||
TokenType operator, Expression rightHandSide) =>
|
||||
astFactory.assignmentExpression(
|
||||
new AssignmentExpression(
|
||||
leftHandSide, TokenFactory.tokenFromType(operator), rightHandSide);
|
||||
|
||||
static BlockFunctionBody asyncBlockFunctionBody(
|
||||
[List<Statement> statements]) =>
|
||||
astFactory.blockFunctionBody(
|
||||
new BlockFunctionBody(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"),
|
||||
null,
|
||||
block(statements));
|
||||
|
||||
static ExpressionFunctionBody asyncExpressionFunctionBody(
|
||||
Expression expression) =>
|
||||
astFactory.expressionFunctionBody(
|
||||
new ExpressionFunctionBody(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"),
|
||||
TokenFactory.tokenFromType(TokenType.FUNCTION),
|
||||
expression,
|
||||
|
@ -82,49 +82,50 @@ class AstTestFactory {
|
|||
|
||||
static BlockFunctionBody asyncGeneratorBlockFunctionBody(
|
||||
[List<Statement> statements]) =>
|
||||
astFactory.blockFunctionBody(
|
||||
new BlockFunctionBody(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"),
|
||||
TokenFactory.tokenFromType(TokenType.STAR),
|
||||
block(statements));
|
||||
|
||||
static AwaitExpression awaitExpression(Expression expression) =>
|
||||
astFactory.awaitExpression(
|
||||
new AwaitExpression(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "await"),
|
||||
expression);
|
||||
|
||||
static BinaryExpression binaryExpression(Expression leftOperand,
|
||||
TokenType operator, Expression rightOperand) =>
|
||||
astFactory.binaryExpression(
|
||||
new BinaryExpression(
|
||||
leftOperand, TokenFactory.tokenFromType(operator), rightOperand);
|
||||
|
||||
static Block block([List<Statement> statements]) => astFactory.block(
|
||||
static Block block([List<Statement> statements]) => new Block(
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET),
|
||||
statements,
|
||||
TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET));
|
||||
|
||||
static BlockFunctionBody blockFunctionBody(Block block) =>
|
||||
astFactory.blockFunctionBody(null, null, block);
|
||||
new BlockFunctionBody(null, null, block);
|
||||
|
||||
static BlockFunctionBody blockFunctionBody2([List<Statement> statements]) =>
|
||||
astFactory.blockFunctionBody(null, null, block(statements));
|
||||
new BlockFunctionBody(null, null, block(statements));
|
||||
|
||||
static BooleanLiteral booleanLiteral(bool value) => astFactory.booleanLiteral(
|
||||
static BooleanLiteral booleanLiteral(bool value) => new BooleanLiteral(
|
||||
value
|
||||
? TokenFactory.tokenFromKeyword(Keyword.TRUE)
|
||||
: TokenFactory.tokenFromKeyword(Keyword.FALSE),
|
||||
value);
|
||||
|
||||
static BreakStatement breakStatement() => astFactory.breakStatement(
|
||||
static BreakStatement breakStatement() => new BreakStatement(
|
||||
TokenFactory.tokenFromKeyword(Keyword.BREAK),
|
||||
null,
|
||||
TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
static BreakStatement breakStatement2(String label) =>
|
||||
astFactory.breakStatement(TokenFactory.tokenFromKeyword(Keyword.BREAK),
|
||||
identifier3(label), TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
static BreakStatement breakStatement2(String label) => new BreakStatement(
|
||||
TokenFactory.tokenFromKeyword(Keyword.BREAK),
|
||||
identifier3(label),
|
||||
TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
static IndexExpression cascadedIndexExpression(Expression index) =>
|
||||
astFactory.indexExpressionForCascade(
|
||||
new IndexExpression.forCascade(
|
||||
TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET),
|
||||
index,
|
||||
|
@ -132,7 +133,7 @@ class AstTestFactory {
|
|||
|
||||
static MethodInvocation cascadedMethodInvocation(String methodName,
|
||||
[List<Expression> arguments]) =>
|
||||
astFactory.methodInvocation(
|
||||
new MethodInvocation(
|
||||
null,
|
||||
TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD),
|
||||
identifier3(methodName),
|
||||
|
@ -140,14 +141,14 @@ class AstTestFactory {
|
|||
argumentList(arguments));
|
||||
|
||||
static PropertyAccess cascadedPropertyAccess(String propertyName) =>
|
||||
astFactory.propertyAccess(
|
||||
new PropertyAccess(
|
||||
null,
|
||||
TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD),
|
||||
identifier3(propertyName));
|
||||
|
||||
static CascadeExpression cascadeExpression(Expression target,
|
||||
[List<Expression> cascadeSections]) =>
|
||||
astFactory.cascadeExpression(target, cascadeSections);
|
||||
new CascadeExpression(target, cascadeSections);
|
||||
|
||||
static CatchClause catchClause(String exceptionParameter,
|
||||
[List<Statement> statements]) =>
|
||||
|
@ -170,7 +171,7 @@ class AstTestFactory {
|
|||
static CatchClause catchClause5(TypeName exceptionType,
|
||||
String exceptionParameter, String stackTraceParameter,
|
||||
[List<Statement> statements]) =>
|
||||
astFactory.catchClause(
|
||||
new CatchClause(
|
||||
exceptionType == null
|
||||
? null
|
||||
: TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "on"),
|
||||
|
@ -199,7 +200,7 @@ class AstTestFactory {
|
|||
WithClause withClause,
|
||||
ImplementsClause implementsClause,
|
||||
[List<ClassMember> members]) =>
|
||||
astFactory.classDeclaration(
|
||||
new ClassDeclaration(
|
||||
null,
|
||||
null,
|
||||
abstractKeyword == null
|
||||
|
@ -222,7 +223,7 @@ class AstTestFactory {
|
|||
TypeName superclass,
|
||||
WithClause withClause,
|
||||
ImplementsClause implementsClause) =>
|
||||
astFactory.classTypeAlias(
|
||||
new ClassTypeAlias(
|
||||
null,
|
||||
null,
|
||||
TokenFactory.tokenFromKeyword(Keyword.CLASS),
|
||||
|
@ -266,7 +267,7 @@ class AstTestFactory {
|
|||
String scriptTag,
|
||||
List<Directive> directives,
|
||||
List<CompilationUnitMember> declarations) =>
|
||||
astFactory.compilationUnit(
|
||||
new CompilationUnit(
|
||||
TokenFactory.tokenFromType(TokenType.EOF),
|
||||
scriptTag == null ? null : AstTestFactory.scriptTag(scriptTag),
|
||||
directives == null ? new List<Directive>() : directives,
|
||||
|
@ -277,7 +278,7 @@ class AstTestFactory {
|
|||
|
||||
static ConditionalExpression conditionalExpression(Expression condition,
|
||||
Expression thenExpression, Expression elseExpression) =>
|
||||
astFactory.conditionalExpression(
|
||||
new ConditionalExpression(
|
||||
condition,
|
||||
TokenFactory.tokenFromType(TokenType.QUESTION),
|
||||
thenExpression,
|
||||
|
@ -289,7 +290,7 @@ class AstTestFactory {
|
|||
String name,
|
||||
FormalParameterList parameters,
|
||||
List<ConstructorInitializer> initializers) =>
|
||||
astFactory.constructorDeclaration(
|
||||
new ConstructorDeclaration(
|
||||
null,
|
||||
null,
|
||||
TokenFactory.tokenFromKeyword(Keyword.EXTERNAL),
|
||||
|
@ -316,7 +317,7 @@ class AstTestFactory {
|
|||
FormalParameterList parameters,
|
||||
List<ConstructorInitializer> initializers,
|
||||
FunctionBody body) =>
|
||||
astFactory.constructorDeclaration(
|
||||
new ConstructorDeclaration(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
@ -341,7 +342,7 @@ class AstTestFactory {
|
|||
|
||||
static ConstructorFieldInitializer constructorFieldInitializer(
|
||||
bool prefixedWithThis, String fieldName, Expression expression) =>
|
||||
astFactory.constructorFieldInitializer(
|
||||
new ConstructorFieldInitializer(
|
||||
prefixedWithThis ? TokenFactory.tokenFromKeyword(Keyword.THIS) : null,
|
||||
prefixedWithThis
|
||||
? TokenFactory.tokenFromType(TokenType.PERIOD)
|
||||
|
@ -351,13 +352,13 @@ class AstTestFactory {
|
|||
expression);
|
||||
|
||||
static ConstructorName constructorName(TypeName type, String name) =>
|
||||
astFactory.constructorName(
|
||||
new ConstructorName(
|
||||
type,
|
||||
name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD),
|
||||
name == null ? null : identifier3(name));
|
||||
|
||||
static ContinueStatement continueStatement([String label]) =>
|
||||
astFactory.continueStatement(
|
||||
new ContinueStatement(
|
||||
TokenFactory.tokenFromKeyword(Keyword.CONTINUE),
|
||||
label == null ? null : identifier3(label),
|
||||
TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
@ -368,7 +369,7 @@ class AstTestFactory {
|
|||
|
||||
static DeclaredIdentifier declaredIdentifier2(
|
||||
Keyword keyword, TypeName type, String identifier) =>
|
||||
astFactory.declaredIdentifier(
|
||||
new DeclaredIdentifier(
|
||||
null,
|
||||
null,
|
||||
keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
|
||||
|
@ -384,11 +385,11 @@ class AstTestFactory {
|
|||
|
||||
static Comment documentationComment(
|
||||
List<Token> tokens, List<CommentReference> references) {
|
||||
return astFactory.documentationComment(tokens, references);
|
||||
return new Comment(tokens, CommentType.DOCUMENTATION, references);
|
||||
}
|
||||
|
||||
static DoStatement doStatement(Statement body, Expression condition) =>
|
||||
astFactory.doStatement(
|
||||
new DoStatement(
|
||||
TokenFactory.tokenFromKeyword(Keyword.DO),
|
||||
body,
|
||||
TokenFactory.tokenFromKeyword(Keyword.WHILE),
|
||||
|
@ -397,18 +398,18 @@ class AstTestFactory {
|
|||
TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
|
||||
TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
static DoubleLiteral doubleLiteral(double value) => astFactory.doubleLiteral(
|
||||
TokenFactory.tokenFromString(value.toString()), value);
|
||||
static DoubleLiteral doubleLiteral(double value) =>
|
||||
new DoubleLiteral(TokenFactory.tokenFromString(value.toString()), value);
|
||||
|
||||
static EmptyFunctionBody emptyFunctionBody() => astFactory
|
||||
.emptyFunctionBody(TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
static EmptyFunctionBody emptyFunctionBody() =>
|
||||
new EmptyFunctionBody(TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
static EmptyStatement emptyStatement() => astFactory
|
||||
.emptyStatement(TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
static EmptyStatement emptyStatement() =>
|
||||
new EmptyStatement(TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
static EnumDeclaration enumDeclaration(
|
||||
SimpleIdentifier name, List<EnumConstantDeclaration> constants) =>
|
||||
astFactory.enumDeclaration(
|
||||
new EnumDeclaration(
|
||||
null,
|
||||
null,
|
||||
TokenFactory.tokenFromKeyword(Keyword.ENUM),
|
||||
|
@ -423,7 +424,7 @@ class AstTestFactory {
|
|||
List<EnumConstantDeclaration> constants =
|
||||
new List<EnumConstantDeclaration>(count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
constants[i] = astFactory.enumConstantDeclaration(
|
||||
constants[i] = new EnumConstantDeclaration(
|
||||
null, null, identifier3(constantNames[i]));
|
||||
}
|
||||
return enumDeclaration(identifier3(name), constants);
|
||||
|
@ -431,7 +432,7 @@ class AstTestFactory {
|
|||
|
||||
static ExportDirective exportDirective(List<Annotation> metadata, String uri,
|
||||
[List<Combinator> combinators]) =>
|
||||
astFactory.exportDirective(
|
||||
new ExportDirective(
|
||||
null,
|
||||
metadata,
|
||||
TokenFactory.tokenFromKeyword(Keyword.EXPORT),
|
||||
|
@ -445,22 +446,22 @@ class AstTestFactory {
|
|||
exportDirective(null, uri, combinators);
|
||||
|
||||
static ExpressionFunctionBody expressionFunctionBody(Expression expression) =>
|
||||
astFactory.expressionFunctionBody(
|
||||
new ExpressionFunctionBody(
|
||||
null,
|
||||
TokenFactory.tokenFromType(TokenType.FUNCTION),
|
||||
expression,
|
||||
TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
static ExpressionStatement expressionStatement(Expression expression) =>
|
||||
astFactory.expressionStatement(
|
||||
new ExpressionStatement(
|
||||
expression, TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
static ExtendsClause extendsClause(TypeName type) => astFactory.extendsClause(
|
||||
TokenFactory.tokenFromKeyword(Keyword.EXTENDS), type);
|
||||
static ExtendsClause extendsClause(TypeName type) =>
|
||||
new ExtendsClause(TokenFactory.tokenFromKeyword(Keyword.EXTENDS), type);
|
||||
|
||||
static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword,
|
||||
TypeName type, List<VariableDeclaration> variables) =>
|
||||
astFactory.fieldDeclaration(
|
||||
new FieldDeclaration(
|
||||
null,
|
||||
null,
|
||||
isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null,
|
||||
|
@ -474,7 +475,7 @@ class AstTestFactory {
|
|||
static FieldFormalParameter fieldFormalParameter(
|
||||
Keyword keyword, TypeName type, String identifier,
|
||||
[FormalParameterList parameterList]) =>
|
||||
astFactory.fieldFormalParameter(
|
||||
new FieldFormalParameter(
|
||||
null,
|
||||
null,
|
||||
keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
|
||||
|
@ -490,7 +491,7 @@ class AstTestFactory {
|
|||
|
||||
static ForEachStatement forEachStatement(DeclaredIdentifier loopVariable,
|
||||
Expression iterator, Statement body) =>
|
||||
astFactory.forEachStatementWithDeclaration(
|
||||
new ForEachStatement.withDeclaration(
|
||||
null,
|
||||
TokenFactory.tokenFromKeyword(Keyword.FOR),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
|
@ -502,7 +503,7 @@ class AstTestFactory {
|
|||
|
||||
static ForEachStatement forEachStatement2(
|
||||
SimpleIdentifier identifier, Expression iterator, Statement body) =>
|
||||
astFactory.forEachStatementWithReference(
|
||||
new ForEachStatement.withReference(
|
||||
null,
|
||||
TokenFactory.tokenFromKeyword(Keyword.FOR),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
|
@ -514,7 +515,7 @@ class AstTestFactory {
|
|||
|
||||
static FormalParameterList formalParameterList(
|
||||
[List<FormalParameter> parameters]) =>
|
||||
astFactory.formalParameterList(
|
||||
new FormalParameterList(
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
parameters,
|
||||
null,
|
||||
|
@ -523,7 +524,7 @@ class AstTestFactory {
|
|||
|
||||
static ForStatement forStatement(Expression initialization,
|
||||
Expression condition, List<Expression> updaters, Statement body) =>
|
||||
astFactory.forStatement(
|
||||
new ForStatement(
|
||||
TokenFactory.tokenFromKeyword(Keyword.FOR),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
null,
|
||||
|
@ -537,7 +538,7 @@ class AstTestFactory {
|
|||
|
||||
static ForStatement forStatement2(VariableDeclarationList variableList,
|
||||
Expression condition, List<Expression> updaters, Statement body) =>
|
||||
astFactory.forStatement(
|
||||
new ForStatement(
|
||||
TokenFactory.tokenFromKeyword(Keyword.FOR),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
variableList,
|
||||
|
@ -551,7 +552,7 @@ class AstTestFactory {
|
|||
|
||||
static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword,
|
||||
String name, FunctionExpression functionExpression) =>
|
||||
astFactory.functionDeclaration(
|
||||
new FunctionDeclaration(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
@ -565,21 +566,21 @@ class AstTestFactory {
|
|||
Keyword keyword,
|
||||
String name,
|
||||
FunctionExpression functionExpression) =>
|
||||
astFactory.functionDeclarationStatement(
|
||||
new FunctionDeclarationStatement(
|
||||
functionDeclaration(type, keyword, name, functionExpression));
|
||||
|
||||
static FunctionExpression functionExpression() => astFactory
|
||||
.functionExpression(null, formalParameterList(), blockFunctionBody2());
|
||||
static FunctionExpression functionExpression() =>
|
||||
new FunctionExpression(null, formalParameterList(), blockFunctionBody2());
|
||||
|
||||
static FunctionExpression functionExpression2(
|
||||
FormalParameterList parameters, FunctionBody body) =>
|
||||
astFactory.functionExpression(null, parameters, body);
|
||||
new FunctionExpression(null, parameters, body);
|
||||
|
||||
static FunctionExpression functionExpression3(
|
||||
TypeParameterList typeParameters,
|
||||
FormalParameterList parameters,
|
||||
FunctionBody body) =>
|
||||
astFactory.functionExpression(typeParameters, parameters, body);
|
||||
new FunctionExpression(typeParameters, parameters, body);
|
||||
|
||||
static FunctionExpressionInvocation functionExpressionInvocation(
|
||||
Expression function,
|
||||
|
@ -590,39 +591,37 @@ class AstTestFactory {
|
|||
Expression function,
|
||||
[TypeArgumentList typeArguments,
|
||||
List<Expression> arguments]) =>
|
||||
astFactory.functionExpressionInvocation(
|
||||
new FunctionExpressionInvocation(
|
||||
function, typeArguments, argumentList(arguments));
|
||||
|
||||
static FunctionTypedFormalParameter functionTypedFormalParameter(
|
||||
TypeName returnType, String identifier,
|
||||
[List<FormalParameter> parameters]) =>
|
||||
astFactory.functionTypedFormalParameter(null, null, returnType,
|
||||
new FunctionTypedFormalParameter(null, null, returnType,
|
||||
identifier3(identifier), null, formalParameterList(parameters));
|
||||
|
||||
static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) =>
|
||||
astFactory.hideCombinator(
|
||||
TokenFactory.tokenFromString("hide"), identifiers);
|
||||
new HideCombinator(TokenFactory.tokenFromString("hide"), identifiers);
|
||||
|
||||
static HideCombinator hideCombinator2(List<String> identifiers) =>
|
||||
astFactory.hideCombinator(
|
||||
new HideCombinator(
|
||||
TokenFactory.tokenFromString("hide"), identifierList(identifiers));
|
||||
|
||||
static PrefixedIdentifier identifier(
|
||||
SimpleIdentifier prefix, SimpleIdentifier identifier) =>
|
||||
astFactory.prefixedIdentifier(
|
||||
new PrefixedIdentifier(
|
||||
prefix, TokenFactory.tokenFromType(TokenType.PERIOD), identifier);
|
||||
|
||||
static SimpleIdentifier identifier3(String lexeme) =>
|
||||
astFactory.simpleIdentifier(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, lexeme));
|
||||
static SimpleIdentifier identifier3(String lexeme) => new SimpleIdentifier(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, lexeme));
|
||||
|
||||
static PrefixedIdentifier identifier4(
|
||||
String prefix, SimpleIdentifier identifier) =>
|
||||
astFactory.prefixedIdentifier(identifier3(prefix),
|
||||
new PrefixedIdentifier(identifier3(prefix),
|
||||
TokenFactory.tokenFromType(TokenType.PERIOD), identifier);
|
||||
|
||||
static PrefixedIdentifier identifier5(String prefix, String identifier) =>
|
||||
astFactory.prefixedIdentifier(
|
||||
new PrefixedIdentifier(
|
||||
identifier3(prefix),
|
||||
TokenFactory.tokenFromType(TokenType.PERIOD),
|
||||
identifier3(identifier));
|
||||
|
@ -642,7 +641,7 @@ class AstTestFactory {
|
|||
|
||||
static IfStatement ifStatement2(Expression condition, Statement thenStatement,
|
||||
Statement elseStatement) =>
|
||||
astFactory.ifStatement(
|
||||
new IfStatement(
|
||||
TokenFactory.tokenFromKeyword(Keyword.IF),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
condition,
|
||||
|
@ -654,13 +653,13 @@ class AstTestFactory {
|
|||
elseStatement);
|
||||
|
||||
static ImplementsClause implementsClause(List<TypeName> types) =>
|
||||
astFactory.implementsClause(
|
||||
new ImplementsClause(
|
||||
TokenFactory.tokenFromKeyword(Keyword.IMPLEMENTS), types);
|
||||
|
||||
static ImportDirective importDirective(
|
||||
List<Annotation> metadata, String uri, bool isDeferred, String prefix,
|
||||
[List<Combinator> combinators]) =>
|
||||
astFactory.importDirective(
|
||||
new ImportDirective(
|
||||
null,
|
||||
metadata,
|
||||
TokenFactory.tokenFromKeyword(Keyword.IMPORT),
|
||||
|
@ -682,7 +681,7 @@ class AstTestFactory {
|
|||
importDirective(null, uri, false, prefix, combinators);
|
||||
|
||||
static IndexExpression indexExpression(Expression array, Expression index) =>
|
||||
astFactory.indexExpressionForTarget(
|
||||
new IndexExpression.forTarget(
|
||||
array,
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET),
|
||||
index,
|
||||
|
@ -691,7 +690,7 @@ class AstTestFactory {
|
|||
static InstanceCreationExpression instanceCreationExpression(
|
||||
Keyword keyword, ConstructorName name,
|
||||
[List<Expression> arguments]) =>
|
||||
astFactory.instanceCreationExpression(
|
||||
new InstanceCreationExpression(
|
||||
keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
|
||||
name,
|
||||
argumentList(arguments));
|
||||
|
@ -706,7 +705,7 @@ class AstTestFactory {
|
|||
[List<Expression> arguments]) =>
|
||||
instanceCreationExpression(
|
||||
keyword,
|
||||
astFactory.constructorName(
|
||||
new ConstructorName(
|
||||
type,
|
||||
identifier == null
|
||||
? null
|
||||
|
@ -714,48 +713,44 @@ class AstTestFactory {
|
|||
identifier == null ? null : identifier3(identifier)),
|
||||
arguments);
|
||||
|
||||
static IntegerLiteral integer(int value) => astFactory.integerLiteral(
|
||||
static IntegerLiteral integer(int value) => new IntegerLiteral(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.INT, value.toString()),
|
||||
value);
|
||||
|
||||
static InterpolationExpression interpolationExpression(
|
||||
Expression expression) =>
|
||||
astFactory.interpolationExpression(
|
||||
new InterpolationExpression(
|
||||
TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_EXPRESSION),
|
||||
expression,
|
||||
TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET));
|
||||
|
||||
static InterpolationExpression interpolationExpression2(String identifier) =>
|
||||
astFactory.interpolationExpression(
|
||||
new InterpolationExpression(
|
||||
TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_IDENTIFIER),
|
||||
identifier3(identifier),
|
||||
null);
|
||||
|
||||
static InterpolationString interpolationString(
|
||||
String contents, String value) =>
|
||||
astFactory.interpolationString(
|
||||
TokenFactory.tokenFromString(contents), value);
|
||||
new InterpolationString(TokenFactory.tokenFromString(contents), value);
|
||||
|
||||
static IsExpression isExpression(
|
||||
Expression expression, bool negated, TypeName type) =>
|
||||
astFactory.isExpression(
|
||||
expression,
|
||||
TokenFactory.tokenFromKeyword(Keyword.IS),
|
||||
negated ? TokenFactory.tokenFromType(TokenType.BANG) : null,
|
||||
type);
|
||||
new IsExpression(expression, TokenFactory.tokenFromKeyword(Keyword.IS),
|
||||
negated ? TokenFactory.tokenFromType(TokenType.BANG) : null, type);
|
||||
|
||||
static Label label(SimpleIdentifier label) =>
|
||||
astFactory.label(label, TokenFactory.tokenFromType(TokenType.COLON));
|
||||
new Label(label, TokenFactory.tokenFromType(TokenType.COLON));
|
||||
|
||||
static Label label2(String label) => AstTestFactory.label(identifier3(label));
|
||||
|
||||
static LabeledStatement labeledStatement(
|
||||
List<Label> labels, Statement statement) =>
|
||||
astFactory.labeledStatement(labels, statement);
|
||||
new LabeledStatement(labels, statement);
|
||||
|
||||
static LibraryDirective libraryDirective(
|
||||
List<Annotation> metadata, LibraryIdentifier libraryName) =>
|
||||
astFactory.libraryDirective(
|
||||
new LibraryDirective(
|
||||
null,
|
||||
metadata,
|
||||
TokenFactory.tokenFromKeyword(Keyword.LIBRARY),
|
||||
|
@ -768,10 +763,10 @@ class AstTestFactory {
|
|||
|
||||
static LibraryIdentifier libraryIdentifier(
|
||||
List<SimpleIdentifier> components) =>
|
||||
astFactory.libraryIdentifier(components);
|
||||
new LibraryIdentifier(components);
|
||||
|
||||
static LibraryIdentifier libraryIdentifier2(List<String> components) {
|
||||
return astFactory.libraryIdentifier(identifierList(components));
|
||||
return new LibraryIdentifier(identifierList(components));
|
||||
}
|
||||
|
||||
static List list(List<Object> elements) {
|
||||
|
@ -784,7 +779,7 @@ class AstTestFactory {
|
|||
static ListLiteral listLiteral2(
|
||||
Keyword keyword, TypeArgumentList typeArguments,
|
||||
[List<Expression> elements]) =>
|
||||
astFactory.listLiteral(
|
||||
new ListLiteral(
|
||||
keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
|
||||
typeArguments,
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET),
|
||||
|
@ -793,7 +788,7 @@ class AstTestFactory {
|
|||
|
||||
static MapLiteral mapLiteral(Keyword keyword, TypeArgumentList typeArguments,
|
||||
[List<MapLiteralEntry> entries]) =>
|
||||
astFactory.mapLiteral(
|
||||
new MapLiteral(
|
||||
keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
|
||||
typeArguments,
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET),
|
||||
|
@ -804,11 +799,11 @@ class AstTestFactory {
|
|||
mapLiteral(null, null, entries);
|
||||
|
||||
static MapLiteralEntry mapLiteralEntry(String key, Expression value) =>
|
||||
astFactory.mapLiteralEntry(
|
||||
new MapLiteralEntry(
|
||||
string2(key), TokenFactory.tokenFromType(TokenType.COLON), value);
|
||||
|
||||
static MapLiteralEntry mapLiteralEntry2(Expression key, Expression value) =>
|
||||
astFactory.mapLiteralEntry(
|
||||
new MapLiteralEntry(
|
||||
key, TokenFactory.tokenFromType(TokenType.COLON), value);
|
||||
|
||||
static MethodDeclaration methodDeclaration(
|
||||
|
@ -818,7 +813,7 @@ class AstTestFactory {
|
|||
Keyword operator,
|
||||
SimpleIdentifier name,
|
||||
FormalParameterList parameters) =>
|
||||
astFactory.methodDeclaration(
|
||||
new MethodDeclaration(
|
||||
null,
|
||||
null,
|
||||
TokenFactory.tokenFromKeyword(Keyword.EXTERNAL),
|
||||
|
@ -839,7 +834,7 @@ class AstTestFactory {
|
|||
SimpleIdentifier name,
|
||||
FormalParameterList parameters,
|
||||
FunctionBody body) =>
|
||||
astFactory.methodDeclaration(
|
||||
new MethodDeclaration(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
@ -861,7 +856,7 @@ class AstTestFactory {
|
|||
TypeParameterList typeParameters,
|
||||
FormalParameterList parameters,
|
||||
FunctionBody body) =>
|
||||
astFactory.methodDeclaration(
|
||||
new MethodDeclaration(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
@ -883,7 +878,7 @@ class AstTestFactory {
|
|||
String name,
|
||||
FormalParameterList parameters,
|
||||
FunctionBody body}) =>
|
||||
astFactory.methodDeclaration(
|
||||
new MethodDeclaration(
|
||||
null,
|
||||
null,
|
||||
external ? TokenFactory.tokenFromKeyword(Keyword.EXTERNAL) : null,
|
||||
|
@ -899,7 +894,7 @@ class AstTestFactory {
|
|||
static MethodInvocation methodInvocation(Expression target, String methodName,
|
||||
[List<Expression> arguments,
|
||||
TokenType operator = TokenType.PERIOD]) =>
|
||||
astFactory.methodInvocation(
|
||||
new MethodInvocation(
|
||||
target,
|
||||
target == null ? null : TokenFactory.tokenFromType(operator),
|
||||
identifier3(methodName),
|
||||
|
@ -914,7 +909,7 @@ class AstTestFactory {
|
|||
Expression target, String methodName, TypeArgumentList typeArguments,
|
||||
[List<Expression> arguments,
|
||||
TokenType operator = TokenType.PERIOD]) =>
|
||||
astFactory.methodInvocation(
|
||||
new MethodInvocation(
|
||||
target,
|
||||
target == null ? null : TokenFactory.tokenFromType(operator),
|
||||
identifier3(methodName),
|
||||
|
@ -922,7 +917,7 @@ class AstTestFactory {
|
|||
argumentList(arguments));
|
||||
|
||||
static NamedExpression namedExpression(Label label, Expression expression) =>
|
||||
astFactory.namedExpression(label, expression);
|
||||
new NamedExpression(label, expression);
|
||||
|
||||
static NamedExpression namedExpression2(
|
||||
String label, Expression expression) =>
|
||||
|
@ -930,7 +925,7 @@ class AstTestFactory {
|
|||
|
||||
static DefaultFormalParameter namedFormalParameter(
|
||||
NormalFormalParameter parameter, Expression expression) =>
|
||||
astFactory.defaultFormalParameter(
|
||||
new DefaultFormalParameter(
|
||||
parameter,
|
||||
ParameterKind.NAMED,
|
||||
expression == null
|
||||
|
@ -938,28 +933,27 @@ class AstTestFactory {
|
|||
: TokenFactory.tokenFromType(TokenType.COLON),
|
||||
expression);
|
||||
|
||||
static NativeClause nativeClause(String nativeCode) =>
|
||||
astFactory.nativeClause(
|
||||
TokenFactory.tokenFromString("native"), string2(nativeCode));
|
||||
static NativeClause nativeClause(String nativeCode) => new NativeClause(
|
||||
TokenFactory.tokenFromString("native"), string2(nativeCode));
|
||||
|
||||
static NativeFunctionBody nativeFunctionBody(String nativeMethodName) =>
|
||||
astFactory.nativeFunctionBody(
|
||||
new NativeFunctionBody(
|
||||
TokenFactory.tokenFromString("native"),
|
||||
string2(nativeMethodName),
|
||||
TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
static NullLiteral nullLiteral() =>
|
||||
astFactory.nullLiteral(TokenFactory.tokenFromKeyword(Keyword.NULL));
|
||||
new NullLiteral(TokenFactory.tokenFromKeyword(Keyword.NULL));
|
||||
|
||||
static ParenthesizedExpression parenthesizedExpression(
|
||||
Expression expression) =>
|
||||
astFactory.parenthesizedExpression(
|
||||
new ParenthesizedExpression(
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
expression,
|
||||
TokenFactory.tokenFromType(TokenType.CLOSE_PAREN));
|
||||
|
||||
static PartDirective partDirective(List<Annotation> metadata, String url) =>
|
||||
astFactory.partDirective(
|
||||
new PartDirective(
|
||||
null,
|
||||
metadata,
|
||||
TokenFactory.tokenFromKeyword(Keyword.PART),
|
||||
|
@ -974,7 +968,7 @@ class AstTestFactory {
|
|||
|
||||
static PartOfDirective partOfDirective2(
|
||||
List<Annotation> metadata, LibraryIdentifier libraryName) =>
|
||||
astFactory.partOfDirective(
|
||||
new PartOfDirective(
|
||||
null,
|
||||
metadata,
|
||||
TokenFactory.tokenFromKeyword(Keyword.PART),
|
||||
|
@ -985,7 +979,7 @@ class AstTestFactory {
|
|||
|
||||
static DefaultFormalParameter positionalFormalParameter(
|
||||
NormalFormalParameter parameter, Expression expression) =>
|
||||
astFactory.defaultFormalParameter(
|
||||
new DefaultFormalParameter(
|
||||
parameter,
|
||||
ParameterKind.POSITIONAL,
|
||||
expression == null ? null : TokenFactory.tokenFromType(TokenType.EQ),
|
||||
|
@ -993,22 +987,20 @@ class AstTestFactory {
|
|||
|
||||
static PostfixExpression postfixExpression(
|
||||
Expression expression, TokenType operator) =>
|
||||
astFactory.postfixExpression(
|
||||
expression, TokenFactory.tokenFromType(operator));
|
||||
new PostfixExpression(expression, TokenFactory.tokenFromType(operator));
|
||||
|
||||
static PrefixExpression prefixExpression(
|
||||
TokenType operator, Expression expression) =>
|
||||
astFactory.prefixExpression(
|
||||
TokenFactory.tokenFromType(operator), expression);
|
||||
new PrefixExpression(TokenFactory.tokenFromType(operator), expression);
|
||||
|
||||
static PropertyAccess propertyAccess(
|
||||
Expression target, SimpleIdentifier propertyName) =>
|
||||
astFactory.propertyAccess(
|
||||
new PropertyAccess(
|
||||
target, TokenFactory.tokenFromType(TokenType.PERIOD), propertyName);
|
||||
|
||||
static PropertyAccess propertyAccess2(Expression target, String propertyName,
|
||||
[TokenType operator = TokenType.PERIOD]) =>
|
||||
astFactory.propertyAccess(target, TokenFactory.tokenFromType(operator),
|
||||
new PropertyAccess(target, TokenFactory.tokenFromType(operator),
|
||||
identifier3(propertyName));
|
||||
|
||||
static RedirectingConstructorInvocation redirectingConstructorInvocation(
|
||||
|
@ -1018,7 +1010,7 @@ class AstTestFactory {
|
|||
static RedirectingConstructorInvocation redirectingConstructorInvocation2(
|
||||
String constructorName,
|
||||
[List<Expression> arguments]) =>
|
||||
astFactory.redirectingConstructorInvocation(
|
||||
new RedirectingConstructorInvocation(
|
||||
TokenFactory.tokenFromKeyword(Keyword.THIS),
|
||||
constructorName == null
|
||||
? null
|
||||
|
@ -1026,24 +1018,23 @@ class AstTestFactory {
|
|||
constructorName == null ? null : identifier3(constructorName),
|
||||
argumentList(arguments));
|
||||
|
||||
static RethrowExpression rethrowExpression() => astFactory
|
||||
.rethrowExpression(TokenFactory.tokenFromKeyword(Keyword.RETHROW));
|
||||
static RethrowExpression rethrowExpression() =>
|
||||
new RethrowExpression(TokenFactory.tokenFromKeyword(Keyword.RETHROW));
|
||||
|
||||
static ReturnStatement returnStatement() => returnStatement2(null);
|
||||
|
||||
static ReturnStatement returnStatement2(Expression expression) =>
|
||||
astFactory.returnStatement(TokenFactory.tokenFromKeyword(Keyword.RETURN),
|
||||
new ReturnStatement(TokenFactory.tokenFromKeyword(Keyword.RETURN),
|
||||
expression, TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
static ScriptTag scriptTag(String scriptTag) =>
|
||||
astFactory.scriptTag(TokenFactory.tokenFromString(scriptTag));
|
||||
new ScriptTag(TokenFactory.tokenFromString(scriptTag));
|
||||
|
||||
static ShowCombinator showCombinator(List<SimpleIdentifier> identifiers) =>
|
||||
astFactory.showCombinator(
|
||||
TokenFactory.tokenFromString("show"), identifiers);
|
||||
new ShowCombinator(TokenFactory.tokenFromString("show"), identifiers);
|
||||
|
||||
static ShowCombinator showCombinator2(List<String> identifiers) =>
|
||||
astFactory.showCombinator(
|
||||
new ShowCombinator(
|
||||
TokenFactory.tokenFromString("show"), identifierList(identifiers));
|
||||
|
||||
static SimpleFormalParameter simpleFormalParameter(
|
||||
|
@ -1052,7 +1043,7 @@ class AstTestFactory {
|
|||
|
||||
static SimpleFormalParameter simpleFormalParameter2(
|
||||
Keyword keyword, TypeName type, String parameterName) =>
|
||||
astFactory.simpleFormalParameter(
|
||||
new SimpleFormalParameter(
|
||||
null,
|
||||
null,
|
||||
keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
|
||||
|
@ -1067,10 +1058,10 @@ class AstTestFactory {
|
|||
simpleFormalParameter2(null, type, parameterName);
|
||||
|
||||
static StringInterpolation string([List<InterpolationElement> elements]) =>
|
||||
astFactory.stringInterpolation(elements);
|
||||
new StringInterpolation(elements);
|
||||
|
||||
static SimpleStringLiteral string2(String content) => astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("'$content'"), content);
|
||||
static SimpleStringLiteral string2(String content) => new SimpleStringLiteral(
|
||||
TokenFactory.tokenFromString("'$content'"), content);
|
||||
|
||||
static SuperConstructorInvocation superConstructorInvocation(
|
||||
[List<Expression> arguments]) =>
|
||||
|
@ -1078,14 +1069,14 @@ class AstTestFactory {
|
|||
|
||||
static SuperConstructorInvocation superConstructorInvocation2(String name,
|
||||
[List<Expression> arguments]) =>
|
||||
astFactory.superConstructorInvocation(
|
||||
new SuperConstructorInvocation(
|
||||
TokenFactory.tokenFromKeyword(Keyword.SUPER),
|
||||
name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD),
|
||||
name == null ? null : identifier3(name),
|
||||
argumentList(arguments));
|
||||
|
||||
static SuperExpression superExpression() =>
|
||||
astFactory.superExpression(TokenFactory.tokenFromKeyword(Keyword.SUPER));
|
||||
new SuperExpression(TokenFactory.tokenFromKeyword(Keyword.SUPER));
|
||||
|
||||
static SwitchCase switchCase(
|
||||
Expression expression, List<Statement> statements) =>
|
||||
|
@ -1093,23 +1084,20 @@ class AstTestFactory {
|
|||
|
||||
static SwitchCase switchCase2(List<Label> labels, Expression expression,
|
||||
List<Statement> statements) =>
|
||||
astFactory.switchCase(labels, TokenFactory.tokenFromKeyword(Keyword.CASE),
|
||||
new SwitchCase(labels, TokenFactory.tokenFromKeyword(Keyword.CASE),
|
||||
expression, TokenFactory.tokenFromType(TokenType.COLON), statements);
|
||||
|
||||
static SwitchDefault switchDefault(
|
||||
List<Label> labels, List<Statement> statements) =>
|
||||
astFactory.switchDefault(
|
||||
labels,
|
||||
TokenFactory.tokenFromKeyword(Keyword.DEFAULT),
|
||||
TokenFactory.tokenFromType(TokenType.COLON),
|
||||
statements);
|
||||
new SwitchDefault(labels, TokenFactory.tokenFromKeyword(Keyword.DEFAULT),
|
||||
TokenFactory.tokenFromType(TokenType.COLON), statements);
|
||||
|
||||
static SwitchDefault switchDefault2(List<Statement> statements) =>
|
||||
switchDefault(new List<Label>(), statements);
|
||||
|
||||
static SwitchStatement switchStatement(
|
||||
Expression expression, List<SwitchMember> members) =>
|
||||
astFactory.switchStatement(
|
||||
new SwitchStatement(
|
||||
TokenFactory.tokenFromKeyword(Keyword.SWITCH),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
expression,
|
||||
|
@ -1124,38 +1112,38 @@ class AstTestFactory {
|
|||
identifierList.add(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, component));
|
||||
}
|
||||
return astFactory.symbolLiteral(
|
||||
return new SymbolLiteral(
|
||||
TokenFactory.tokenFromType(TokenType.HASH), identifierList);
|
||||
}
|
||||
|
||||
static BlockFunctionBody syncBlockFunctionBody(
|
||||
[List<Statement> statements]) =>
|
||||
astFactory.blockFunctionBody(
|
||||
new BlockFunctionBody(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "sync"),
|
||||
null,
|
||||
block(statements));
|
||||
|
||||
static BlockFunctionBody syncGeneratorBlockFunctionBody(
|
||||
[List<Statement> statements]) =>
|
||||
astFactory.blockFunctionBody(
|
||||
new BlockFunctionBody(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "sync"),
|
||||
TokenFactory.tokenFromType(TokenType.STAR),
|
||||
block(statements));
|
||||
|
||||
static ThisExpression thisExpression() =>
|
||||
astFactory.thisExpression(TokenFactory.tokenFromKeyword(Keyword.THIS));
|
||||
new ThisExpression(TokenFactory.tokenFromKeyword(Keyword.THIS));
|
||||
|
||||
static ThrowExpression throwExpression() => throwExpression2(null);
|
||||
|
||||
static ThrowExpression throwExpression2(Expression expression) =>
|
||||
astFactory.throwExpression(
|
||||
new ThrowExpression(
|
||||
TokenFactory.tokenFromKeyword(Keyword.THROW), expression);
|
||||
|
||||
static TopLevelVariableDeclaration topLevelVariableDeclaration(
|
||||
Keyword keyword,
|
||||
TypeName type,
|
||||
List<VariableDeclaration> variables) =>
|
||||
astFactory.topLevelVariableDeclaration(
|
||||
new TopLevelVariableDeclaration(
|
||||
null,
|
||||
null,
|
||||
variableDeclarationList(keyword, type, variables),
|
||||
|
@ -1163,7 +1151,7 @@ class AstTestFactory {
|
|||
|
||||
static TopLevelVariableDeclaration topLevelVariableDeclaration2(
|
||||
Keyword keyword, List<VariableDeclaration> variables) =>
|
||||
astFactory.topLevelVariableDeclaration(
|
||||
new TopLevelVariableDeclaration(
|
||||
null,
|
||||
null,
|
||||
variableDeclarationList(keyword, null, variables),
|
||||
|
@ -1178,7 +1166,7 @@ class AstTestFactory {
|
|||
|
||||
static TryStatement tryStatement3(
|
||||
Block body, List<CatchClause> catchClauses, Block finallyClause) =>
|
||||
astFactory.tryStatement(
|
||||
new TryStatement(
|
||||
TokenFactory.tokenFromKeyword(Keyword.TRY),
|
||||
body,
|
||||
catchClauses,
|
||||
|
@ -1189,7 +1177,7 @@ class AstTestFactory {
|
|||
|
||||
static FunctionTypeAlias typeAlias(TypeName returnType, String name,
|
||||
TypeParameterList typeParameters, FormalParameterList parameters) =>
|
||||
astFactory.functionTypeAlias(
|
||||
new FunctionTypeAlias(
|
||||
null,
|
||||
null,
|
||||
TokenFactory.tokenFromKeyword(Keyword.TYPEDEF),
|
||||
|
@ -1203,7 +1191,7 @@ class AstTestFactory {
|
|||
if (typeNames == null || typeNames.length == 0) {
|
||||
return null;
|
||||
}
|
||||
return astFactory.typeArgumentList(TokenFactory.tokenFromType(TokenType.LT),
|
||||
return new TypeArgumentList(TokenFactory.tokenFromType(TokenType.LT),
|
||||
typeNames, TokenFactory.tokenFromType(TokenType.GT));
|
||||
}
|
||||
|
||||
|
@ -1223,16 +1211,16 @@ class AstTestFactory {
|
|||
}
|
||||
|
||||
static TypeName typeName3(Identifier name, [List<TypeName> arguments]) =>
|
||||
astFactory.typeName(name, typeArgumentList(arguments));
|
||||
new TypeName(name, typeArgumentList(arguments));
|
||||
|
||||
static TypeName typeName4(String name, [List<TypeName> arguments]) =>
|
||||
astFactory.typeName(identifier3(name), typeArgumentList(arguments));
|
||||
new TypeName(identifier3(name), typeArgumentList(arguments));
|
||||
|
||||
static TypeParameter typeParameter(String name) =>
|
||||
astFactory.typeParameter(null, null, identifier3(name), null, null);
|
||||
new TypeParameter(null, null, identifier3(name), null, null);
|
||||
|
||||
static TypeParameter typeParameter2(String name, TypeName bound) =>
|
||||
astFactory.typeParameter(null, null, identifier3(name),
|
||||
new TypeParameter(null, null, identifier3(name),
|
||||
TokenFactory.tokenFromKeyword(Keyword.EXTENDS), bound);
|
||||
|
||||
static TypeParameterList typeParameterList([List<String> typeNames]) {
|
||||
|
@ -1243,23 +1231,21 @@ class AstTestFactory {
|
|||
typeParameters.add(typeParameter(typeName));
|
||||
}
|
||||
}
|
||||
return astFactory.typeParameterList(
|
||||
TokenFactory.tokenFromType(TokenType.LT),
|
||||
typeParameters,
|
||||
TokenFactory.tokenFromType(TokenType.GT));
|
||||
return new TypeParameterList(TokenFactory.tokenFromType(TokenType.LT),
|
||||
typeParameters, TokenFactory.tokenFromType(TokenType.GT));
|
||||
}
|
||||
|
||||
static VariableDeclaration variableDeclaration(String name) =>
|
||||
astFactory.variableDeclaration(identifier3(name), null, null);
|
||||
new VariableDeclaration(identifier3(name), null, null);
|
||||
|
||||
static VariableDeclaration variableDeclaration2(
|
||||
String name, Expression initializer) =>
|
||||
astFactory.variableDeclaration(identifier3(name),
|
||||
new VariableDeclaration(identifier3(name),
|
||||
TokenFactory.tokenFromType(TokenType.EQ), initializer);
|
||||
|
||||
static VariableDeclarationList variableDeclarationList(Keyword keyword,
|
||||
TypeName type, List<VariableDeclaration> variables) =>
|
||||
astFactory.variableDeclarationList(
|
||||
new VariableDeclarationList(
|
||||
null,
|
||||
null,
|
||||
keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
|
||||
|
@ -1274,7 +1260,7 @@ class AstTestFactory {
|
|||
Keyword keyword,
|
||||
TypeName type,
|
||||
List<VariableDeclaration> variables) =>
|
||||
astFactory.variableDeclarationStatement(
|
||||
new VariableDeclarationStatement(
|
||||
variableDeclarationList(keyword, type, variables),
|
||||
TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
|
@ -1283,7 +1269,7 @@ class AstTestFactory {
|
|||
variableDeclarationStatement(keyword, null, variables);
|
||||
|
||||
static WhileStatement whileStatement(Expression condition, Statement body) =>
|
||||
astFactory.whileStatement(
|
||||
new WhileStatement(
|
||||
TokenFactory.tokenFromKeyword(Keyword.WHILE),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
condition,
|
||||
|
@ -1291,17 +1277,17 @@ class AstTestFactory {
|
|||
body);
|
||||
|
||||
static WithClause withClause(List<TypeName> types) =>
|
||||
astFactory.withClause(TokenFactory.tokenFromKeyword(Keyword.WITH), types);
|
||||
new WithClause(TokenFactory.tokenFromKeyword(Keyword.WITH), types);
|
||||
|
||||
static YieldStatement yieldEachStatement(Expression expression) =>
|
||||
astFactory.yieldStatement(
|
||||
new YieldStatement(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"),
|
||||
TokenFactory.tokenFromType(TokenType.STAR),
|
||||
expression,
|
||||
TokenFactory.tokenFromType(TokenType.SEMICOLON));
|
||||
|
||||
static YieldStatement yieldStatement(Expression expression) =>
|
||||
astFactory.yieldStatement(
|
||||
new YieldStatement(
|
||||
TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"),
|
||||
null,
|
||||
expression,
|
||||
|
|
|
@ -7,7 +7,6 @@ library summary_resynthesizer;
|
|||
import 'dart:collection';
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
|
@ -589,9 +588,9 @@ class _ConstExprBuilder {
|
|||
|
||||
InterpolationElement _newInterpolationElement(Expression expr) {
|
||||
if (expr is SimpleStringLiteral) {
|
||||
return astFactory.interpolationString(expr.literal, expr.value);
|
||||
return new InterpolationString(expr.literal, expr.value);
|
||||
} else {
|
||||
return astFactory.interpolationExpression(
|
||||
return new InterpolationExpression(
|
||||
TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_EXPRESSION),
|
||||
expr,
|
||||
TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET));
|
||||
|
@ -715,7 +714,7 @@ class _ConstExprBuilder {
|
|||
typeArguments = AstTestFactory.typeArgumentList(typeNames);
|
||||
}
|
||||
if (node is SimpleIdentifier) {
|
||||
_push(astFactory.methodInvocation(
|
||||
_push(new MethodInvocation(
|
||||
null,
|
||||
TokenFactory.tokenFromType(TokenType.PERIOD),
|
||||
node,
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
library analyzer.test.dart.ast.ast_test;
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/src/dart/ast/token.dart';
|
||||
import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
|
||||
|
@ -366,7 +365,7 @@ class NodeListTest extends EngineTestCase {
|
|||
AstNode parent = AstTestFactory.argumentList();
|
||||
AstNode firstNode = AstTestFactory.booleanLiteral(true);
|
||||
AstNode secondNode = AstTestFactory.booleanLiteral(false);
|
||||
NodeList<AstNode> list = astFactory.nodeList/*<AstNode>*/(parent);
|
||||
NodeList<AstNode> list = new NodeList<AstNode>(parent);
|
||||
list.insert(0, secondNode);
|
||||
list.insert(0, firstNode);
|
||||
expect(list, hasLength(2));
|
||||
|
@ -387,7 +386,7 @@ class NodeListTest extends EngineTestCase {
|
|||
|
||||
void test_add_negative() {
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
try {
|
||||
list.insert(-1, AstTestFactory.booleanLiteral(true));
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
|
@ -398,7 +397,7 @@ class NodeListTest extends EngineTestCase {
|
|||
|
||||
void test_add_tooBig() {
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
try {
|
||||
list.insert(1, AstTestFactory.booleanLiteral(true));
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
|
@ -414,7 +413,7 @@ class NodeListTest extends EngineTestCase {
|
|||
AstNode secondNode = AstTestFactory.booleanLiteral(false);
|
||||
firstNodes.add(firstNode);
|
||||
firstNodes.add(secondNode);
|
||||
NodeList<AstNode> list = astFactory.nodeList/*<AstNode>*/(parent);
|
||||
NodeList<AstNode> list = new NodeList<AstNode>(parent);
|
||||
list.addAll(firstNodes);
|
||||
expect(list, hasLength(2));
|
||||
expect(list[0], same(firstNode));
|
||||
|
@ -440,7 +439,7 @@ class NodeListTest extends EngineTestCase {
|
|||
|
||||
void test_creation() {
|
||||
AstNode owner = AstTestFactory.argumentList();
|
||||
NodeList<AstNode> list = astFactory.nodeList/*<AstNode>*/(owner);
|
||||
NodeList<AstNode> list = new NodeList<AstNode>(owner);
|
||||
expect(list, isNotNull);
|
||||
expect(list, hasLength(0));
|
||||
expect(list.owner, same(owner));
|
||||
|
@ -448,7 +447,7 @@ class NodeListTest extends EngineTestCase {
|
|||
|
||||
void test_get_negative() {
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
try {
|
||||
list[-1];
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
|
@ -459,7 +458,7 @@ class NodeListTest extends EngineTestCase {
|
|||
|
||||
void test_get_tooBig() {
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
try {
|
||||
list[1];
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
|
@ -470,13 +469,13 @@ class NodeListTest extends EngineTestCase {
|
|||
|
||||
void test_getBeginToken_empty() {
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
expect(list.beginToken, isNull);
|
||||
}
|
||||
|
||||
void test_getBeginToken_nonEmpty() {
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
AstNode node = AstTestFactory
|
||||
.parenthesizedExpression(AstTestFactory.booleanLiteral(true));
|
||||
list.add(node);
|
||||
|
@ -485,13 +484,13 @@ class NodeListTest extends EngineTestCase {
|
|||
|
||||
void test_getEndToken_empty() {
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
expect(list.endToken, isNull);
|
||||
}
|
||||
|
||||
void test_getEndToken_nonEmpty() {
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
AstNode node = AstTestFactory
|
||||
.parenthesizedExpression(AstTestFactory.booleanLiteral(true));
|
||||
list.add(node);
|
||||
|
@ -508,7 +507,7 @@ class NodeListTest extends EngineTestCase {
|
|||
nodes.add(secondNode);
|
||||
nodes.add(thirdNode);
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
list.addAll(nodes);
|
||||
expect(list, hasLength(3));
|
||||
expect(list.indexOf(firstNode), 0);
|
||||
|
@ -527,7 +526,7 @@ class NodeListTest extends EngineTestCase {
|
|||
nodes.add(secondNode);
|
||||
nodes.add(thirdNode);
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
list.addAll(nodes);
|
||||
expect(list, hasLength(3));
|
||||
expect(list.removeAt(1), same(secondNode));
|
||||
|
@ -538,7 +537,7 @@ class NodeListTest extends EngineTestCase {
|
|||
|
||||
void test_remove_negative() {
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
try {
|
||||
list.removeAt(-1);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
|
@ -549,7 +548,7 @@ class NodeListTest extends EngineTestCase {
|
|||
|
||||
void test_remove_tooBig() {
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
try {
|
||||
list.removeAt(1);
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
|
@ -567,7 +566,7 @@ class NodeListTest extends EngineTestCase {
|
|||
nodes.add(secondNode);
|
||||
nodes.add(thirdNode);
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
list.addAll(nodes);
|
||||
expect(list, hasLength(3));
|
||||
AstNode fourthNode = AstTestFactory.integer(0);
|
||||
|
@ -581,7 +580,7 @@ class NodeListTest extends EngineTestCase {
|
|||
void test_set_negative() {
|
||||
AstNode node = AstTestFactory.booleanLiteral(true);
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
try {
|
||||
list[-1] = node;
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
|
@ -593,7 +592,7 @@ class NodeListTest extends EngineTestCase {
|
|||
void test_set_tooBig() {
|
||||
AstNode node = AstTestFactory.booleanLiteral(true);
|
||||
NodeList<AstNode> list =
|
||||
astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
|
||||
new NodeList<AstNode>(AstTestFactory.argumentList());
|
||||
try {
|
||||
list[1] = node;
|
||||
fail("Expected IndexOutOfBoundsException");
|
||||
|
@ -796,57 +795,47 @@ class SimpleIdentifierTest extends ParserTestCase {
|
|||
class SimpleStringLiteralTest extends ParserTestCase {
|
||||
void test_contentsEnd() {
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
|
||||
.contentsEnd,
|
||||
2);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString('"X"'), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString('"X"'), "X")
|
||||
.contentsEnd,
|
||||
2);
|
||||
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString('"""X"""'), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString('"""X"""'), "X")
|
||||
.contentsEnd,
|
||||
4);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
|
||||
.contentsEnd,
|
||||
4);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(
|
||||
new SimpleStringLiteral(
|
||||
TokenFactory.tokenFromString("''' \nX'''"), "X")
|
||||
.contentsEnd,
|
||||
7);
|
||||
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
|
||||
.contentsEnd,
|
||||
3);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString('r"X"'), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString('r"X"'), "X")
|
||||
.contentsEnd,
|
||||
3);
|
||||
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString('r"""X"""'), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString('r"""X"""'), "X")
|
||||
.contentsEnd,
|
||||
5);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
|
||||
.contentsEnd,
|
||||
5);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(
|
||||
new SimpleStringLiteral(
|
||||
TokenFactory.tokenFromString("r''' \nX'''"), "X")
|
||||
.contentsEnd,
|
||||
8);
|
||||
|
@ -854,57 +843,47 @@ class SimpleStringLiteralTest extends ParserTestCase {
|
|||
|
||||
void test_contentsOffset() {
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
|
||||
.contentsOffset,
|
||||
1);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
|
||||
.contentsOffset,
|
||||
1);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(
|
||||
new SimpleStringLiteral(
|
||||
TokenFactory.tokenFromString("\"\"\"X\"\"\""), "X")
|
||||
.contentsOffset,
|
||||
3);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
|
||||
.contentsOffset,
|
||||
3);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
|
||||
.contentsOffset,
|
||||
2);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
|
||||
.contentsOffset,
|
||||
2);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(
|
||||
new SimpleStringLiteral(
|
||||
TokenFactory.tokenFromString("r\"\"\"X\"\"\""), "X")
|
||||
.contentsOffset,
|
||||
4);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
|
||||
.contentsOffset,
|
||||
4);
|
||||
// leading whitespace
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(
|
||||
new SimpleStringLiteral(
|
||||
TokenFactory.tokenFromString("''' \ \nX''"), "X")
|
||||
.contentsOffset,
|
||||
6);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(
|
||||
new SimpleStringLiteral(
|
||||
TokenFactory.tokenFromString('r""" \ \nX"""'), "X")
|
||||
.contentsOffset,
|
||||
7);
|
||||
|
@ -912,44 +891,36 @@ class SimpleStringLiteralTest extends ParserTestCase {
|
|||
|
||||
void test_isMultiline() {
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
|
||||
.isMultiline,
|
||||
isFalse);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
|
||||
.isMultiline,
|
||||
isFalse);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
|
||||
.isMultiline,
|
||||
isFalse);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
|
||||
.isMultiline,
|
||||
isFalse);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
|
||||
.isMultiline,
|
||||
isTrue);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
|
||||
.isMultiline,
|
||||
isTrue);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(
|
||||
new SimpleStringLiteral(
|
||||
TokenFactory.tokenFromString("\"\"\"X\"\"\""), "X")
|
||||
.isMultiline,
|
||||
isTrue);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(
|
||||
new SimpleStringLiteral(
|
||||
TokenFactory.tokenFromString("r\"\"\"X\"\"\""), "X")
|
||||
.isMultiline,
|
||||
isTrue);
|
||||
|
@ -957,45 +928,36 @@ class SimpleStringLiteralTest extends ParserTestCase {
|
|||
|
||||
void test_isRaw() {
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X").isRaw,
|
||||
isFalse);
|
||||
expect(
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
|
||||
.isRaw,
|
||||
isFalse);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
|
||||
.isRaw,
|
||||
isFalse);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(
|
||||
new SimpleStringLiteral(
|
||||
TokenFactory.tokenFromString("\"\"\"X\"\"\""), "X")
|
||||
.isRaw,
|
||||
isFalse);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
|
||||
.isRaw,
|
||||
isFalse);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
|
||||
.isRaw,
|
||||
isTrue);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
|
||||
.isRaw,
|
||||
isTrue);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(
|
||||
new SimpleStringLiteral(
|
||||
TokenFactory.tokenFromString("r\"\"\"X\"\"\""), "X")
|
||||
.isRaw,
|
||||
isTrue);
|
||||
expect(
|
||||
astFactory
|
||||
.simpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
|
||||
new SimpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
|
||||
.isRaw,
|
||||
isTrue);
|
||||
}
|
||||
|
@ -1004,25 +966,25 @@ class SimpleStringLiteralTest extends ParserTestCase {
|
|||
// '
|
||||
{
|
||||
var token = TokenFactory.tokenFromString("'X'");
|
||||
var node = astFactory.simpleStringLiteral(token, null);
|
||||
var node = new SimpleStringLiteral(token, null);
|
||||
expect(node.isSingleQuoted, isTrue);
|
||||
}
|
||||
// '''
|
||||
{
|
||||
var token = TokenFactory.tokenFromString("'''X'''");
|
||||
var node = astFactory.simpleStringLiteral(token, null);
|
||||
var node = new SimpleStringLiteral(token, null);
|
||||
expect(node.isSingleQuoted, isTrue);
|
||||
}
|
||||
// "
|
||||
{
|
||||
var token = TokenFactory.tokenFromString('"X"');
|
||||
var node = astFactory.simpleStringLiteral(token, null);
|
||||
var node = new SimpleStringLiteral(token, null);
|
||||
expect(node.isSingleQuoted, isFalse);
|
||||
}
|
||||
// """
|
||||
{
|
||||
var token = TokenFactory.tokenFromString('"""X"""');
|
||||
var node = astFactory.simpleStringLiteral(token, null);
|
||||
var node = new SimpleStringLiteral(token, null);
|
||||
expect(node.isSingleQuoted, isFalse);
|
||||
}
|
||||
}
|
||||
|
@ -1031,33 +993,32 @@ class SimpleStringLiteralTest extends ParserTestCase {
|
|||
// r'
|
||||
{
|
||||
var token = TokenFactory.tokenFromString("r'X'");
|
||||
var node = astFactory.simpleStringLiteral(token, null);
|
||||
var node = new SimpleStringLiteral(token, null);
|
||||
expect(node.isSingleQuoted, isTrue);
|
||||
}
|
||||
// r'''
|
||||
{
|
||||
var token = TokenFactory.tokenFromString("r'''X'''");
|
||||
var node = astFactory.simpleStringLiteral(token, null);
|
||||
var node = new SimpleStringLiteral(token, null);
|
||||
expect(node.isSingleQuoted, isTrue);
|
||||
}
|
||||
// r"
|
||||
{
|
||||
var token = TokenFactory.tokenFromString('r"X"');
|
||||
var node = astFactory.simpleStringLiteral(token, null);
|
||||
var node = new SimpleStringLiteral(token, null);
|
||||
expect(node.isSingleQuoted, isFalse);
|
||||
}
|
||||
// r"""
|
||||
{
|
||||
var token = TokenFactory.tokenFromString('r"""X"""');
|
||||
var node = astFactory.simpleStringLiteral(token, null);
|
||||
var node = new SimpleStringLiteral(token, null);
|
||||
expect(node.isSingleQuoted, isFalse);
|
||||
}
|
||||
}
|
||||
|
||||
void test_simple() {
|
||||
Token token = TokenFactory.tokenFromString("'value'");
|
||||
SimpleStringLiteral stringLiteral =
|
||||
astFactory.simpleStringLiteral(token, "value");
|
||||
SimpleStringLiteral stringLiteral = new SimpleStringLiteral(token, "value");
|
||||
expect(stringLiteral.literal, same(token));
|
||||
expect(stringLiteral.beginToken, same(token));
|
||||
expect(stringLiteral.endToken, same(token));
|
||||
|
@ -1073,7 +1034,7 @@ class StringInterpolationTest extends ParserTestCase {
|
|||
{
|
||||
var ae = AstTestFactory.interpolationString("'a", "a");
|
||||
var cToken = new StringToken(TokenType.STRING, "ccc'", 10);
|
||||
var cElement = astFactory.interpolationString(cToken, 'ccc');
|
||||
var cElement = new InterpolationString(cToken, 'ccc');
|
||||
StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
|
||||
expect(node.contentsOffset, 1);
|
||||
expect(node.contentsEnd, 10 + 4 - 1);
|
||||
|
@ -1082,7 +1043,7 @@ class StringInterpolationTest extends ParserTestCase {
|
|||
{
|
||||
var ae = AstTestFactory.interpolationString("'''a", "a");
|
||||
var cToken = new StringToken(TokenType.STRING, "ccc'''", 10);
|
||||
var cElement = astFactory.interpolationString(cToken, 'ccc');
|
||||
var cElement = new InterpolationString(cToken, 'ccc');
|
||||
StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
|
||||
expect(node.contentsOffset, 3);
|
||||
expect(node.contentsEnd, 10 + 4 - 1);
|
||||
|
@ -1091,7 +1052,7 @@ class StringInterpolationTest extends ParserTestCase {
|
|||
{
|
||||
var ae = AstTestFactory.interpolationString('"""a', "a");
|
||||
var cToken = new StringToken(TokenType.STRING, 'ccc"""', 10);
|
||||
var cElement = astFactory.interpolationString(cToken, 'ccc');
|
||||
var cElement = new InterpolationString(cToken, 'ccc');
|
||||
StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
|
||||
expect(node.contentsOffset, 3);
|
||||
expect(node.contentsEnd, 10 + 4 - 1);
|
||||
|
@ -1100,7 +1061,7 @@ class StringInterpolationTest extends ParserTestCase {
|
|||
{
|
||||
var ae = AstTestFactory.interpolationString("r'a", "a");
|
||||
var cToken = new StringToken(TokenType.STRING, "ccc'", 10);
|
||||
var cElement = astFactory.interpolationString(cToken, 'ccc');
|
||||
var cElement = new InterpolationString(cToken, 'ccc');
|
||||
StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
|
||||
expect(node.contentsOffset, 2);
|
||||
expect(node.contentsEnd, 10 + 4 - 1);
|
||||
|
@ -1109,7 +1070,7 @@ class StringInterpolationTest extends ParserTestCase {
|
|||
{
|
||||
var ae = AstTestFactory.interpolationString("r'''a", "a");
|
||||
var cToken = new StringToken(TokenType.STRING, "ccc'''", 10);
|
||||
var cElement = astFactory.interpolationString(cToken, 'ccc');
|
||||
var cElement = new InterpolationString(cToken, 'ccc');
|
||||
StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
|
||||
expect(node.contentsOffset, 4);
|
||||
expect(node.contentsEnd, 10 + 4 - 1);
|
||||
|
@ -1118,7 +1079,7 @@ class StringInterpolationTest extends ParserTestCase {
|
|||
{
|
||||
var ae = AstTestFactory.interpolationString('r"""a', "a");
|
||||
var cToken = new StringToken(TokenType.STRING, 'ccc"""', 10);
|
||||
var cElement = astFactory.interpolationString(cToken, 'ccc');
|
||||
var cElement = new InterpolationString(cToken, 'ccc');
|
||||
StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
|
||||
expect(node.contentsOffset, 4);
|
||||
expect(node.contentsEnd, 10 + 4 - 1);
|
||||
|
@ -1203,7 +1164,7 @@ class VariableDeclarationTest extends ParserTestCase {
|
|||
VariableDeclaration varDecl = AstTestFactory.variableDeclaration("a");
|
||||
TopLevelVariableDeclaration decl =
|
||||
AstTestFactory.topLevelVariableDeclaration2(Keyword.VAR, [varDecl]);
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
expect(varDecl.documentationComment, isNull);
|
||||
decl.documentationComment = comment;
|
||||
expect(varDecl.documentationComment, isNotNull);
|
||||
|
@ -1212,7 +1173,7 @@ class VariableDeclarationTest extends ParserTestCase {
|
|||
|
||||
void test_getDocumentationComment_onNode() {
|
||||
VariableDeclaration decl = AstTestFactory.variableDeclaration("a");
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
decl.documentationComment = comment;
|
||||
expect(decl.documentationComment, isNotNull);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
library analyzer.test.dart.element.builder_test;
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/src/dart/ast/ast.dart';
|
||||
|
@ -252,7 +251,7 @@ class C {
|
|||
TopLevelVariableDeclaration topLevelVariableDeclaration = AstTestFactory
|
||||
.topLevelVariableDeclaration(null, AstTestFactory.typeName4('int'),
|
||||
[AstTestFactory.variableDeclaration('V')]);
|
||||
CompilationUnit unit = astFactory.compilationUnit(
|
||||
CompilationUnit unit = new CompilationUnit(
|
||||
topLevelVariableDeclaration.beginToken,
|
||||
null,
|
||||
[],
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
library analyzer.test.generated.element_resolver_test;
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
|
@ -547,8 +546,7 @@ class ElementResolverTest extends EngineTestCase {
|
|||
..defineNameWithoutChecking('A', classA);
|
||||
// prepare "A.p"
|
||||
PrefixedIdentifier prefixed = AstTestFactory.identifier5('A', 'p');
|
||||
CommentReference commentReference =
|
||||
astFactory.commentReference(null, prefixed);
|
||||
CommentReference commentReference = new CommentReference(null, prefixed);
|
||||
// resolve
|
||||
_resolveNode(commentReference);
|
||||
expect(prefixed.prefix.staticElement, classA);
|
||||
|
@ -567,8 +565,7 @@ class ElementResolverTest extends EngineTestCase {
|
|||
..defineNameWithoutChecking('A', classA);
|
||||
// prepare "A.m"
|
||||
PrefixedIdentifier prefixed = AstTestFactory.identifier5('A', 'm');
|
||||
CommentReference commentReference =
|
||||
astFactory.commentReference(null, prefixed);
|
||||
CommentReference commentReference = new CommentReference(null, prefixed);
|
||||
// resolve
|
||||
_resolveNode(commentReference);
|
||||
expect(prefixed.prefix.staticElement, classA);
|
||||
|
@ -587,8 +584,7 @@ class ElementResolverTest extends EngineTestCase {
|
|||
..defineNameWithoutChecking('A', classA);
|
||||
// prepare "A.=="
|
||||
PrefixedIdentifier prefixed = AstTestFactory.identifier5('A', '==');
|
||||
CommentReference commentReference =
|
||||
astFactory.commentReference(null, prefixed);
|
||||
CommentReference commentReference = new CommentReference(null, prefixed);
|
||||
// resolve
|
||||
_resolveNode(commentReference);
|
||||
expect(prefixed.prefix.staticElement, classA);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
library analyzer.test.generated.parser_test;
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/error/error.dart';
|
||||
|
@ -5067,7 +5066,7 @@ class SimpleParserTest extends ParserTestCase {
|
|||
void test_parseAssignableSelector_none() {
|
||||
createParser(';');
|
||||
Expression expression =
|
||||
parser.parseAssignableSelector(astFactory.simpleIdentifier(null), true);
|
||||
parser.parseAssignableSelector(new SimpleIdentifier(null), true);
|
||||
expectNotNullIfNoErrors(expression);
|
||||
listener.assertNoErrors();
|
||||
expect(expression, new isInstanceOf<SimpleIdentifier>());
|
||||
|
@ -9424,9 +9423,8 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseFunctionDeclaration_function() {
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
TypeName returnType =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser('f() {}');
|
||||
FunctionDeclaration declaration = parser.parseFunctionDeclaration(
|
||||
commentAndMetadata(comment), null, returnType);
|
||||
|
@ -9444,9 +9442,8 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseFunctionDeclaration_functionWithTypeParameters() {
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
TypeName returnType =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser('f<E>() {}');
|
||||
FunctionDeclaration declaration = parser.parseFunctionDeclaration(
|
||||
commentAndMetadata(comment), null, returnType);
|
||||
|
@ -9465,9 +9462,8 @@ void''');
|
|||
|
||||
void test_parseFunctionDeclaration_functionWithTypeParameters_comment() {
|
||||
enableGenericMethodComments = true;
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
TypeName returnType =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser('f/*<E>*/() {}');
|
||||
FunctionDeclaration declaration = parser.parseFunctionDeclaration(
|
||||
commentAndMetadata(comment), null, returnType);
|
||||
|
@ -9485,9 +9481,8 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseFunctionDeclaration_getter() {
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
TypeName returnType =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser('get p => 0;');
|
||||
FunctionDeclaration declaration = parser.parseFunctionDeclaration(
|
||||
commentAndMetadata(comment), null, returnType);
|
||||
|
@ -9505,9 +9500,8 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseFunctionDeclaration_setter() {
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
TypeName returnType =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser('set p(v) {}');
|
||||
FunctionDeclaration declaration = parser.parseFunctionDeclaration(
|
||||
commentAndMetadata(comment), null, returnType);
|
||||
|
@ -9596,9 +9590,8 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseGetter_nonStatic() {
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
TypeName returnType =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser('get a;');
|
||||
MethodDeclaration method =
|
||||
parser.parseGetter(commentAndMetadata(comment), null, null, returnType);
|
||||
|
@ -9616,10 +9609,9 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseGetter_static() {
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
|
||||
TypeName returnType =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser('get a => 42;');
|
||||
MethodDeclaration method = parser.parseGetter(
|
||||
commentAndMetadata(comment), null, staticKeyword, returnType);
|
||||
|
@ -9868,10 +9860,9 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseInitializedIdentifierList_type() {
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
|
||||
TypeName type =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
TypeName type = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser("a = 1, b, c = 3;");
|
||||
FieldDeclaration declaration = parser.parseInitializedIdentifierList(
|
||||
commentAndMetadata(comment), staticKeyword, null, type);
|
||||
|
@ -9888,7 +9879,7 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseInitializedIdentifierList_var() {
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
|
||||
Token varKeyword = TokenFactory.tokenFromKeyword(Keyword.VAR);
|
||||
createParser('a = 1, b, c = 3;');
|
||||
|
@ -11080,9 +11071,8 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseOperator() {
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
TypeName returnType =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser('operator +(A a);');
|
||||
MethodDeclaration method =
|
||||
parser.parseOperator(commentAndMetadata(comment), null, returnType);
|
||||
|
@ -11739,9 +11729,8 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseSetter_nonStatic() {
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
TypeName returnType =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser('set a(var x);');
|
||||
MethodDeclaration method =
|
||||
parser.parseSetter(commentAndMetadata(comment), null, null, returnType);
|
||||
|
@ -11760,10 +11749,9 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseSetter_static() {
|
||||
Comment comment = astFactory.documentationComment(new List<Token>(0));
|
||||
Comment comment = Comment.createDocumentationComment(new List<Token>(0));
|
||||
Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
|
||||
TypeName returnType =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser('set a(var x) {}');
|
||||
MethodDeclaration method = parser.parseSetter(
|
||||
commentAndMetadata(comment), null, staticKeyword, returnType);
|
||||
|
@ -13130,8 +13118,7 @@ void''');
|
|||
}
|
||||
|
||||
void test_parseVariableDeclarationListAfterType_type() {
|
||||
TypeName type =
|
||||
astFactory.typeName(astFactory.simpleIdentifier(null), null);
|
||||
TypeName type = new TypeName(new SimpleIdentifier(null), null);
|
||||
createParser('a');
|
||||
VariableDeclarationList declarationList =
|
||||
parser.parseVariableDeclarationListAfterType(
|
||||
|
|
|
@ -7,7 +7,6 @@ library analyzer.test.generated.resolver_test;
|
|||
import 'dart:collection';
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
|
@ -3463,7 +3462,7 @@ A v = new A();
|
|||
void test_visitTypeName_noParameters_noArguments_undefined() {
|
||||
SimpleIdentifier id = AstTestFactory.identifier3("unknown")
|
||||
..staticElement = new _StaleElement();
|
||||
TypeName typeName = astFactory.typeName(id, null);
|
||||
TypeName typeName = new TypeName(id, null);
|
||||
_resolveNode(typeName, []);
|
||||
expect(typeName.type, UndefinedTypeImpl.instance);
|
||||
expect(typeName.name.staticElement, null);
|
||||
|
@ -3504,7 +3503,7 @@ A v = new A();
|
|||
SimpleIdentifier suffix = AstTestFactory.identifier3("unknownSuffix")
|
||||
..staticElement = new _StaleElement();
|
||||
TypeName typeName =
|
||||
astFactory.typeName(AstTestFactory.identifier(prefix, suffix), null);
|
||||
new TypeName(AstTestFactory.identifier(prefix, suffix), null);
|
||||
_resolveNode(typeName, []);
|
||||
expect(typeName.type, UndefinedTypeImpl.instance);
|
||||
expect(prefix.staticElement, null);
|
||||
|
|
|
@ -7,7 +7,6 @@ library analyzer.test.generated.utilities_test;
|
|||
import 'dart:collection';
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/src/dart/ast/token.dart';
|
||||
|
@ -1607,7 +1606,7 @@ class ExceptionHandlingDelegatingAstVisitorTest extends EngineTestCase {
|
|||
dynamic exception, StackTrace stackTrace) {
|
||||
handlerInvoked = true;
|
||||
});
|
||||
astFactory.nullLiteral(null).accept(visitor);
|
||||
new NullLiteral(null).accept(visitor);
|
||||
expect(handlerInvoked, isTrue);
|
||||
}
|
||||
}
|
||||
|
@ -3064,7 +3063,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
AstTestFactory.fieldDeclaration2(
|
||||
false, null, [AstTestFactory.variableDeclaration("f")])
|
||||
]);
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
node.nativeClause = AstTestFactory.nativeClause("");
|
||||
|
@ -3087,7 +3087,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
AstTestFactory.typeName4("B"),
|
||||
AstTestFactory.withClause([AstTestFactory.typeName4("C")]),
|
||||
AstTestFactory.implementsClause([AstTestFactory.typeName4("D")]));
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_4());
|
||||
|
@ -3099,15 +3100,15 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
void test_comment() {
|
||||
Comment node = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.references.add(
|
||||
astFactory.commentReference(null, AstTestFactory.identifier3("x")));
|
||||
Comment node = Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.references
|
||||
.add(new CommentReference(null, AstTestFactory.identifier3("x")));
|
||||
_assertReplace(node, new ListGetter_NodeReplacerTest_test_comment(0));
|
||||
}
|
||||
|
||||
void test_commentReference() {
|
||||
CommentReference node =
|
||||
astFactory.commentReference(null, AstTestFactory.identifier3("x"));
|
||||
new CommentReference(null, AstTestFactory.identifier3("x"));
|
||||
_assertReplace(node, new Getter_NodeReplacerTest_test_commentReference());
|
||||
}
|
||||
|
||||
|
@ -3150,7 +3151,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
false, "x", AstTestFactory.integer(0))
|
||||
],
|
||||
AstTestFactory.emptyFunctionBody());
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
node.redirectedConstructor =
|
||||
|
@ -3194,7 +3196,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
void test_declaredIdentifier() {
|
||||
DeclaredIdentifier node =
|
||||
AstTestFactory.declaredIdentifier4(AstTestFactory.typeName4("C"), "i");
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(node, new Getter_NodeReplacerTest_test_declaredIdentifier());
|
||||
|
@ -3220,8 +3223,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
void test_enumConstantDeclaration() {
|
||||
EnumConstantDeclaration node = astFactory.enumConstantDeclaration(
|
||||
astFactory.endOfLineComment(EMPTY_TOKEN_LIST),
|
||||
EnumConstantDeclaration node = new EnumConstantDeclaration(
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST),
|
||||
[AstTestFactory.annotation(AstTestFactory.identifier3("a"))],
|
||||
AstTestFactory.identifier3("C"));
|
||||
_assertReplace(
|
||||
|
@ -3231,7 +3234,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
|
||||
void test_enumDeclaration() {
|
||||
EnumDeclaration node = AstTestFactory.enumDeclaration2("E", ["ONE", "TWO"]);
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(node, new Getter_NodeReplacerTest_test_enumDeclaration());
|
||||
|
@ -3242,7 +3246,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
ExportDirective node = AstTestFactory.exportDirective2("", [
|
||||
AstTestFactory.hideCombinator2(["C"])
|
||||
]);
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_testNamespaceDirective(node);
|
||||
|
@ -3274,7 +3279,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
null,
|
||||
AstTestFactory.typeName4("C"),
|
||||
[AstTestFactory.variableDeclaration("c")]);
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(node, new Getter_NodeReplacerTest_test_fieldDeclaration());
|
||||
|
@ -3287,7 +3293,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
AstTestFactory.typeName4("C"),
|
||||
"f",
|
||||
AstTestFactory.formalParameterList());
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata = [
|
||||
AstTestFactory.annotation(AstTestFactory.identifier3("a"))
|
||||
];
|
||||
|
@ -3373,7 +3380,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
"f",
|
||||
AstTestFactory.functionExpression2(AstTestFactory.formalParameterList(),
|
||||
AstTestFactory.blockFunctionBody(AstTestFactory.block())));
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(
|
||||
|
@ -3423,7 +3431,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
"F",
|
||||
AstTestFactory.typeParameterList(["E"]),
|
||||
AstTestFactory.formalParameterList());
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(
|
||||
|
@ -3440,7 +3449,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
FunctionTypedFormalParameter node = AstTestFactory
|
||||
.functionTypedFormalParameter(AstTestFactory.typeName4("R"), "f",
|
||||
[AstTestFactory.simpleFormalParameter3("p")]);
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata = [
|
||||
AstTestFactory.annotation(AstTestFactory.identifier3("a"))
|
||||
];
|
||||
|
@ -3479,7 +3489,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
AstTestFactory.showCombinator2(["A"]),
|
||||
AstTestFactory.hideCombinator2(["B"])
|
||||
]);
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(node, new Getter_NodeReplacerTest_test_importDirective());
|
||||
|
@ -3531,7 +3542,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
|
||||
void test_libraryDirective() {
|
||||
LibraryDirective node = AstTestFactory.libraryDirective2("lib");
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(node, new Getter_NodeReplacerTest_test_libraryDirective());
|
||||
|
@ -3578,7 +3590,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
AstTestFactory.identifier3("m"),
|
||||
AstTestFactory.formalParameterList(),
|
||||
AstTestFactory.blockFunctionBody(AstTestFactory.block()));
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(node, new Getter_NodeReplacerTest_test_methodDeclaration());
|
||||
|
@ -3625,7 +3638,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
|
||||
void test_partDirective() {
|
||||
PartDirective node = AstTestFactory.partDirective2("");
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_testUriBasedDirective(node);
|
||||
|
@ -3634,7 +3648,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
void test_partOfDirective() {
|
||||
PartOfDirective node = AstTestFactory
|
||||
.partOfDirective(AstTestFactory.libraryIdentifier2(["lib"]));
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(node, new Getter_NodeReplacerTest_test_partOfDirective());
|
||||
|
@ -3691,7 +3706,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
void test_simpleFormalParameter() {
|
||||
SimpleFormalParameter node = AstTestFactory.simpleFormalParameter4(
|
||||
AstTestFactory.typeName4("T"), "p");
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata = [
|
||||
AstTestFactory.annotation(AstTestFactory.identifier3("a"))
|
||||
];
|
||||
|
@ -3752,7 +3768,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
TopLevelVariableDeclaration node = AstTestFactory
|
||||
.topLevelVariableDeclaration(null, AstTestFactory.typeName4("T"),
|
||||
[AstTestFactory.variableDeclaration("t")]);
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(
|
||||
|
@ -3802,7 +3819,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
void test_variableDeclaration() {
|
||||
VariableDeclaration node =
|
||||
AstTestFactory.variableDeclaration2("a", AstTestFactory.nullLiteral());
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(
|
||||
|
@ -3817,7 +3835,8 @@ class NodeReplacerTest extends EngineTestCase {
|
|||
null,
|
||||
AstTestFactory.typeName4("T"),
|
||||
[AstTestFactory.variableDeclaration("a")]);
|
||||
node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.documentationComment =
|
||||
Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
||||
node.metadata
|
||||
.add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
|
||||
_assertReplace(
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
library analyzer.test.src.dart.ast.utilities_test;
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
|
@ -438,9 +437,9 @@ class B {}''');
|
|||
@reflectiveTest
|
||||
class ResolutionCopierTest extends EngineTestCase {
|
||||
void test_visitAdjacentStrings() {
|
||||
AdjacentStrings createNode() => astFactory.adjacentStrings([
|
||||
astFactory.simpleStringLiteral(null, 'hello'),
|
||||
astFactory.simpleStringLiteral(null, 'world')
|
||||
AdjacentStrings createNode() => new AdjacentStrings([
|
||||
new SimpleStringLiteral(null, 'hello'),
|
||||
new SimpleStringLiteral(null, 'world')
|
||||
]);
|
||||
|
||||
AdjacentStrings fromNode = createNode();
|
||||
|
@ -1556,13 +1555,13 @@ class ToSourceVisitor2Test extends EngineTestCase {
|
|||
void test_visitComment() {
|
||||
_assertSource(
|
||||
"",
|
||||
astFactory.blockComment(
|
||||
Comment.createBlockComment(
|
||||
<Token>[TokenFactory.tokenFromString("/* comment */")]));
|
||||
}
|
||||
|
||||
void test_visitCommentReference() {
|
||||
_assertSource(
|
||||
"", astFactory.commentReference(null, AstTestFactory.identifier3("a")));
|
||||
"", new CommentReference(null, AstTestFactory.identifier3("a")));
|
||||
}
|
||||
|
||||
void test_visitCompilationUnit_declaration() {
|
||||
|
@ -1948,7 +1947,7 @@ class ToSourceVisitor2Test extends EngineTestCase {
|
|||
void test_visitFieldFormalParameter_functionTyped_typeParameters() {
|
||||
_assertSource(
|
||||
"A this.a<E, F>(b)",
|
||||
astFactory.fieldFormalParameter(
|
||||
new FieldFormalParameter(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
@ -1990,7 +1989,7 @@ class ToSourceVisitor2Test extends EngineTestCase {
|
|||
void test_visitForEachStatement_variable() {
|
||||
_assertSource(
|
||||
"for (a in b) {}",
|
||||
astFactory.forEachStatementWithReference(
|
||||
new ForEachStatement.withReference(
|
||||
null,
|
||||
TokenFactory.tokenFromKeyword(Keyword.FOR),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
|
@ -2004,7 +2003,7 @@ class ToSourceVisitor2Test extends EngineTestCase {
|
|||
void test_visitForEachStatement_variable_await() {
|
||||
_assertSource(
|
||||
"await for (a in b) {}",
|
||||
astFactory.forEachStatementWithReference(
|
||||
new ForEachStatement.withReference(
|
||||
TokenFactory.tokenFromString("await"),
|
||||
TokenFactory.tokenFromKeyword(Keyword.FOR),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
|
@ -2306,7 +2305,7 @@ class ToSourceVisitor2Test extends EngineTestCase {
|
|||
FunctionDeclaration f = AstTestFactory.functionDeclaration(
|
||||
null, null, "f", AstTestFactory.functionExpression());
|
||||
FunctionDeclarationStatement fStatement =
|
||||
astFactory.functionDeclarationStatement(f);
|
||||
new FunctionDeclarationStatement(f);
|
||||
_assertSource(
|
||||
"main() {f() {} 42;}",
|
||||
AstTestFactory.functionDeclaration(
|
||||
|
@ -2329,7 +2328,7 @@ class ToSourceVisitor2Test extends EngineTestCase {
|
|||
AstTestFactory.functionExpression2(AstTestFactory.formalParameterList(),
|
||||
AstTestFactory.expressionFunctionBody(AstTestFactory.integer(1))));
|
||||
FunctionDeclarationStatement fStatement =
|
||||
astFactory.functionDeclarationStatement(f);
|
||||
new FunctionDeclarationStatement(f);
|
||||
_assertSource(
|
||||
"main() {f() => 1; 2;}",
|
||||
AstTestFactory.functionDeclaration(
|
||||
|
@ -2465,7 +2464,7 @@ class ToSourceVisitor2Test extends EngineTestCase {
|
|||
void test_visitFunctionTypedFormalParameter_typeParameters() {
|
||||
_assertSource(
|
||||
"T f<E>()",
|
||||
astFactory.functionTypedFormalParameter(
|
||||
new FunctionTypedFormalParameter(
|
||||
null,
|
||||
null,
|
||||
AstTestFactory.typeName4("T"),
|
||||
|
@ -3886,13 +3885,13 @@ class ToSourceVisitorTest extends EngineTestCase {
|
|||
void test_visitComment() {
|
||||
_assertSource(
|
||||
"",
|
||||
astFactory.blockComment(
|
||||
Comment.createBlockComment(
|
||||
<Token>[TokenFactory.tokenFromString("/* comment */")]));
|
||||
}
|
||||
|
||||
void test_visitCommentReference() {
|
||||
_assertSource(
|
||||
"", astFactory.commentReference(null, AstTestFactory.identifier3("a")));
|
||||
"", new CommentReference(null, AstTestFactory.identifier3("a")));
|
||||
}
|
||||
|
||||
void test_visitCompilationUnit_declaration() {
|
||||
|
@ -4278,7 +4277,7 @@ class ToSourceVisitorTest extends EngineTestCase {
|
|||
void test_visitFieldFormalParameter_functionTyped_typeParameters() {
|
||||
_assertSource(
|
||||
"A this.a<E, F>(b)",
|
||||
astFactory.fieldFormalParameter(
|
||||
new FieldFormalParameter(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
@ -4320,7 +4319,7 @@ class ToSourceVisitorTest extends EngineTestCase {
|
|||
void test_visitForEachStatement_variable() {
|
||||
_assertSource(
|
||||
"for (a in b) {}",
|
||||
astFactory.forEachStatementWithReference(
|
||||
new ForEachStatement.withReference(
|
||||
null,
|
||||
TokenFactory.tokenFromKeyword(Keyword.FOR),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
|
@ -4334,7 +4333,7 @@ class ToSourceVisitorTest extends EngineTestCase {
|
|||
void test_visitForEachStatement_variable_await() {
|
||||
_assertSource(
|
||||
"await for (a in b) {}",
|
||||
astFactory.forEachStatementWithReference(
|
||||
new ForEachStatement.withReference(
|
||||
TokenFactory.tokenFromString("await"),
|
||||
TokenFactory.tokenFromKeyword(Keyword.FOR),
|
||||
TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
||||
|
@ -4636,7 +4635,7 @@ class ToSourceVisitorTest extends EngineTestCase {
|
|||
FunctionDeclaration f = AstTestFactory.functionDeclaration(
|
||||
null, null, "f", AstTestFactory.functionExpression());
|
||||
FunctionDeclarationStatement fStatement =
|
||||
astFactory.functionDeclarationStatement(f);
|
||||
new FunctionDeclarationStatement(f);
|
||||
_assertSource(
|
||||
"main() {f() {} 42;}",
|
||||
AstTestFactory.functionDeclaration(
|
||||
|
@ -4659,7 +4658,7 @@ class ToSourceVisitorTest extends EngineTestCase {
|
|||
AstTestFactory.functionExpression2(AstTestFactory.formalParameterList(),
|
||||
AstTestFactory.expressionFunctionBody(AstTestFactory.integer(1))));
|
||||
FunctionDeclarationStatement fStatement =
|
||||
astFactory.functionDeclarationStatement(f);
|
||||
new FunctionDeclarationStatement(f);
|
||||
_assertSource(
|
||||
"main() {f() => 1; 2;}",
|
||||
AstTestFactory.functionDeclaration(
|
||||
|
@ -4795,7 +4794,7 @@ class ToSourceVisitorTest extends EngineTestCase {
|
|||
void test_visitFunctionTypedFormalParameter_typeParameters() {
|
||||
_assertSource(
|
||||
"T f<E>()",
|
||||
astFactory.functionTypedFormalParameter(
|
||||
new FunctionTypedFormalParameter(
|
||||
null,
|
||||
null,
|
||||
AstTestFactory.typeName4("T"),
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
library analyzer.test.src.dart.constant.utilities_test;
|
||||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/src/dart/ast/token.dart';
|
||||
|
@ -66,7 +65,7 @@ class ConstantFinderTest {
|
|||
// Analyzer ignores annotations on enum constant declarations.
|
||||
Annotation annotation = AstTestFactory.annotation2(
|
||||
AstTestFactory.identifier3('A'), null, AstTestFactory.argumentList());
|
||||
_node = astFactory.enumConstantDeclaration(
|
||||
_node = new EnumConstantDeclaration(
|
||||
null, <Annotation>[annotation], AstTestFactory.identifier3('C'));
|
||||
expect(_findConstants(), isEmpty);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue