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