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