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

Unified Diff: pkg/analyzer/lib/dart/ast/ast.dart

Issue 2542753002: Revert "Transition analyzer and analysis_server to new astFactory; remove old AST factory methods." (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/CHANGELOG.md ('k') | pkg/analyzer/lib/src/dart/ast/utilities.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/dart/ast/ast.dart
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 78b3c0668b5217a2130b381489b26bad25f2810d..c36925f0d17607544d5d16390d7632e0c63a3666 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -40,6 +40,7 @@ import 'package:analyzer/dart/ast/syntactic_entity.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/element/element.dart' show AuxiliaryElements;
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/source.dart' show LineInfo, Source;
@@ -60,6 +61,12 @@ import 'package:analyzer/src/generated/utilities_dart.dart';
*/
abstract class AdjacentStrings extends StringLiteral {
/**
+ * Initialize a newly created list of adjacent strings. To be syntactically
+ * valid, the list of [strings] must contain at least two elements.
+ */
+ factory AdjacentStrings(List<StringLiteral> strings) = AdjacentStringsImpl;
+
+ /**
* Return the strings that are implicitly concatenated.
*/
NodeList<StringLiteral> get strings;
@@ -114,6 +121,16 @@ abstract class AnnotatedNode extends AstNode {
*/
abstract class Annotation extends AstNode {
/**
+ * Initialize a newly created annotation. Both the [period] and the
+ * [constructorName] can be `null` if the annotation is not referencing a
+ * named constructor. The [arguments] can be `null` if the annotation is not
+ * referencing a constructor.
+ */
+ factory Annotation(Token atSign, Identifier name, Token period,
+ SimpleIdentifier constructorName, ArgumentList arguments) =>
+ new AnnotationImpl(atSign, name, period, constructorName, arguments);
+
+ /**
* Return the arguments to the constructor being invoked, or `null` if this
* annotation is not the invocation of a constructor.
*/
@@ -207,6 +224,13 @@ abstract class Annotation extends AstNode {
*/
abstract class ArgumentList extends AstNode {
/**
+ * Initialize a newly created list of arguments. The list of [arguments] can
+ * be `null` if there are no arguments.
+ */
+ factory ArgumentList(Token leftParenthesis, List<Expression> arguments,
+ Token rightParenthesis) = ArgumentListImpl;
+
+ /**
* Return the expressions producing the values of the arguments. Although the
* language requires that positional arguments appear before named arguments,
* this class allows them to be intermixed.
@@ -260,6 +284,13 @@ abstract class ArgumentList extends AstNode {
*/
abstract class AsExpression extends Expression {
/**
+ * Initialize a newly created as expression.
+ */
+ factory AsExpression(
+ Expression expression, Token asOperator, TypeName type) =>
+ new AsExpressionImpl(expression, asOperator, type);
+
+ /**
* Return the 'as' operator.
*/
Token get asOperator;
@@ -299,7 +330,21 @@ abstract class AsExpression extends Expression {
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class AssertInitializer implements Assertion, ConstructorInitializer {}
+abstract class AssertInitializer implements Assertion, ConstructorInitializer {
+ /**
+ * Initialize a newly created assert initializer. The [comma] and [message]
+ * can be `null` if there is no message.
+ */
+ factory AssertInitializer(
+ Token assertKeyword,
+ Token leftParenthesis,
+ Expression condition,
+ Token comma,
+ Expression message,
+ Token rightParenthesis) =>
+ new AssertInitializerImpl(assertKeyword, leftParenthesis, condition,
+ comma, message, rightParenthesis);
+}
/**
* An assertion, either in a block or in the initializer list of a constructor.
@@ -383,6 +428,21 @@ abstract class Assertion implements AstNode {
*/
abstract class AssertStatement implements Assertion, Statement {
/**
+ * Initialize a newly created assert statement. The [comma] and [message] can
+ * be `null` if there is no message.
+ */
+ factory AssertStatement(
+ Token assertKeyword,
+ Token leftParenthesis,
+ Expression condition,
+ Token comma,
+ Expression message,
+ Token rightParenthesis,
+ Token semicolon) =>
+ new AssertStatementImpl(assertKeyword, leftParenthesis, condition, comma,
+ message, rightParenthesis, semicolon);
+
+ /**
* Return the semicolon terminating the statement.
*/
Token get semicolon;
@@ -404,6 +464,13 @@ abstract class AssertStatement implements Assertion, Statement {
abstract class AssignmentExpression extends Expression
implements MethodReferenceExpression {
/**
+ * Initialize a newly created assignment expression.
+ */
+ factory AssignmentExpression(
+ Expression leftHandSide, Token operator, Expression rightHandSide) =>
+ new AssignmentExpressionImpl(leftHandSide, operator, rightHandSide);
+
+ /**
* Return the expression used to compute the left hand side.
*/
Expression get leftHandSide;
@@ -789,6 +856,12 @@ abstract class AstVisitor<R> {
*/
abstract class AwaitExpression extends Expression {
/**
+ * Initialize a newly created await expression.
+ */
+ factory AwaitExpression(Token awaitKeyword, Expression expression) =>
+ new AwaitExpressionImpl(awaitKeyword, expression);
+
+ /**
* Return the 'await' keyword.
*/
Token get awaitKeyword;
@@ -820,6 +893,13 @@ abstract class AwaitExpression extends Expression {
abstract class BinaryExpression extends Expression
implements MethodReferenceExpression {
/**
+ * Initialize a newly created binary expression.
+ */
+ factory BinaryExpression(
+ Expression leftOperand, Token operator, Expression rightOperand) =>
+ new BinaryExpressionImpl(leftOperand, operator, rightOperand);
+
+ /**
* Return the expression used to compute the left operand.
*/
Expression get leftOperand;
@@ -862,6 +942,13 @@ abstract class BinaryExpression extends Expression
*/
abstract class Block extends Statement {
/**
+ * Initialize a newly created block of code.
+ */
+ factory Block(
+ Token leftBracket, List<Statement> statements, Token rightBracket) =>
+ new BlockImpl(leftBracket, statements, rightBracket);
+
+ /**
* Return the left curly bracket.
*/
Token get leftBracket;
@@ -897,6 +984,15 @@ abstract class Block extends Statement {
*/
abstract class BlockFunctionBody extends FunctionBody {
/**
+ * Initialize a newly created function body consisting of a block of
+ * statements. The [keyword] can be `null` if there is no keyword specified
+ * for the block. The [star] can be `null` if there is no star following the
+ * keyword (and must be `null` if there is no keyword).
+ */
+ factory BlockFunctionBody(Token keyword, Token star, Block block) =>
+ new BlockFunctionBodyImpl(keyword, star, block);
+
+ /**
* Return the block representing the body of the function.
*/
Block get block;
@@ -927,6 +1023,11 @@ abstract class BlockFunctionBody extends FunctionBody {
*/
abstract class BooleanLiteral extends Literal {
/**
+ * Initialize a newly created boolean literal.
+ */
+ factory BooleanLiteral(Token literal, bool value) = BooleanLiteralImpl;
+
+ /**
* Return the token representing the literal.
*/
Token get literal;
@@ -952,6 +1053,14 @@ abstract class BooleanLiteral extends Literal {
*/
abstract class BreakStatement extends Statement {
/**
+ * Initialize a newly created break statement. The [label] can be `null` if
+ * there is no label associated with the statement.
+ */
+ factory BreakStatement(
+ Token breakKeyword, SimpleIdentifier label, Token semicolon) =>
+ new BreakStatementImpl(breakKeyword, label, semicolon);
+
+ /**
* Return the token representing the 'break' keyword.
*/
Token get breakKeyword;
@@ -1020,6 +1129,14 @@ abstract class BreakStatement extends Statement {
*/
abstract class CascadeExpression extends Expression {
/**
+ * Initialize a newly created cascade expression. The list of
+ * [cascadeSections] must contain at least one element.
+ */
+ factory CascadeExpression(
+ Expression target, List<Expression> cascadeSections) =>
+ new CascadeExpressionImpl(target, cascadeSections);
+
+ /**
* Return the cascade sections sharing the common target.
*/
NodeList<Expression> get cascadeSections;
@@ -1049,6 +1166,33 @@ abstract class CascadeExpression extends Expression {
*/
abstract class CatchClause extends AstNode {
/**
+ * Initialize a newly created catch clause. The [onKeyword] and
+ * [exceptionType] can be `null` if the clause will catch all exceptions. The
+ * [comma] and [stackTraceParameter] can be `null` if the stack trace
+ * parameter is not defined.
+ */
+ factory CatchClause(
+ Token onKeyword,
+ TypeName exceptionType,
+ Token catchKeyword,
+ Token leftParenthesis,
+ SimpleIdentifier exceptionParameter,
+ Token comma,
+ SimpleIdentifier stackTraceParameter,
+ Token rightParenthesis,
+ Block body) =>
+ new CatchClauseImpl(
+ onKeyword,
+ exceptionType,
+ catchKeyword,
+ leftParenthesis,
+ exceptionParameter,
+ comma,
+ stackTraceParameter,
+ rightParenthesis,
+ body);
+
+ /**
* Return the body of the catch block.
*/
Block get body;
@@ -1162,6 +1306,43 @@ abstract class CatchClause extends AstNode {
*/
abstract class ClassDeclaration extends NamedCompilationUnitMember {
/**
+ * Initialize a newly created class declaration. Either or both of the
+ * [comment] and [metadata] can be `null` if the class does not have the
+ * corresponding attribute. The [abstractKeyword] can be `null` if the class
+ * is not abstract. The [typeParameters] can be `null` if the class does not
+ * have any type parameters. Any or all of the [extendsClause], [withClause],
+ * and [implementsClause] can be `null` if the class does not have the
+ * corresponding clause. The list of [members] can be `null` if the class does
+ * not have any members.
+ */
+ factory ClassDeclaration(
+ Comment comment,
+ List<Annotation> metadata,
+ Token abstractKeyword,
+ Token classKeyword,
+ SimpleIdentifier name,
+ TypeParameterList typeParameters,
+ ExtendsClause extendsClause,
+ WithClause withClause,
+ ImplementsClause implementsClause,
+ Token leftBracket,
+ List<ClassMember> members,
+ Token rightBracket) =>
+ new ClassDeclarationImpl(
+ comment,
+ metadata,
+ abstractKeyword,
+ classKeyword,
+ name,
+ typeParameters,
+ extendsClause,
+ withClause,
+ implementsClause,
+ leftBracket,
+ members,
+ rightBracket);
+
+ /**
* Return the 'abstract' keyword, or `null` if the keyword was absent.
*/
Token get abstractKeyword;
@@ -1309,6 +1490,39 @@ abstract class ClassMember extends Declaration {}
*/
abstract class ClassTypeAlias extends TypeAlias {
/**
+ * Initialize a newly created class type alias. Either or both of the
+ * [comment] and [metadata] can be `null` if the class type alias does not
+ * have the corresponding attribute. The [typeParameters] can be `null` if the
+ * class does not have any type parameters. The [abstractKeyword] can be
+ * `null` if the class is not abstract. The [implementsClause] can be `null`
+ * if the class does not implement any interfaces.
+ */
+ factory ClassTypeAlias(
+ Comment comment,
+ List<Annotation> metadata,
+ Token keyword,
+ SimpleIdentifier name,
+ TypeParameterList typeParameters,
+ Token equals,
+ Token abstractKeyword,
+ TypeName superclass,
+ WithClause withClause,
+ ImplementsClause implementsClause,
+ Token semicolon) =>
+ new ClassTypeAliasImpl(
+ comment,
+ metadata,
+ keyword,
+ name,
+ typeParameters,
+ equals,
+ abstractKeyword,
+ superclass,
+ withClause,
+ implementsClause,
+ semicolon);
+
+ /**
* Return the token for the 'abstract' keyword, or `null` if this is not
* defining an abstract class.
*/
@@ -1424,6 +1638,15 @@ abstract class Combinator extends AstNode {
*/
abstract class Comment extends AstNode {
/**
+ * Initialize a newly created comment. The list of [tokens] must contain at
+ * least one token. The [type] is the type of the comment. The list of
+ * [references] can be empty if the comment does not contain any embedded
+ * references.
+ */
+ factory Comment(List<Token> tokens, CommentType type,
+ List<CommentReference> references) = CommentImpl;
+
+ /**
* Return `true` if this is a block comment.
*/
bool get isBlock;
@@ -1447,6 +1670,32 @@ abstract class Comment extends AstNode {
* Return the tokens representing the comment.
*/
List<Token> get tokens;
+
+ /**
+ * Create a block comment consisting of the given [tokens].
+ */
+ static Comment createBlockComment(List<Token> tokens) =>
+ CommentImpl.createBlockComment(tokens);
+
+ /**
+ * Create a documentation comment consisting of the given [tokens].
+ */
+ static Comment createDocumentationComment(List<Token> tokens) =>
+ CommentImpl.createDocumentationComment(tokens);
+
+ /**
+ * Create a documentation comment consisting of the given [tokens] and having
+ * the given [references] embedded within it.
+ */
+ static Comment createDocumentationCommentWithReferences(
+ List<Token> tokens, List<CommentReference> references) =>
+ CommentImpl.createDocumentationCommentWithReferences(tokens, references);
+
+ /**
+ * Create an end-of-line comment consisting of the given [tokens].
+ */
+ static Comment createEndOfLineComment(List<Token> tokens) =>
+ CommentImpl.createEndOfLineComment(tokens);
}
/**
@@ -1459,6 +1708,13 @@ abstract class Comment extends AstNode {
*/
abstract class CommentReference extends AstNode {
/**
+ * Initialize a newly created reference to a Dart element. The [newKeyword]
+ * can be `null` if the reference is not to a constructor.
+ */
+ factory CommentReference(Token newKeyword, Identifier identifier) =>
+ new CommentReferenceImpl(newKeyword, identifier);
+
+ /**
* Return the identifier being referenced.
*/
Identifier get identifier;
@@ -1507,6 +1763,22 @@ abstract class CommentReference extends AstNode {
*/
abstract class CompilationUnit extends AstNode {
/**
+ * Initialize a newly created compilation unit to have the given directives
+ * and declarations. The [scriptTag] can be `null` if there is no script tag
+ * in the compilation unit. The list of [directives] can be `null` if there
+ * are no directives in the compilation unit. The list of [declarations] can
+ * be `null` if there are no declarations in the compilation unit.
+ */
+ factory CompilationUnit(
+ Token beginToken,
+ ScriptTag scriptTag,
+ List<Directive> directives,
+ List<CompilationUnitMember> declarations,
+ Token endToken) =>
+ new CompilationUnitImpl(
+ beginToken, scriptTag, directives, declarations, endToken);
+
+ /**
* Set the first token included in this node's source range to the given
* [token].
*/
@@ -1595,6 +1867,14 @@ abstract class CompilationUnitMember extends Declaration {}
*/
abstract class ConditionalExpression extends Expression {
/**
+ * Initialize a newly created conditional expression.
+ */
+ factory ConditionalExpression(Expression condition, Token question,
+ Expression thenExpression, Token colon, Expression elseExpression) =>
+ new ConditionalExpressionImpl(
+ condition, question, thenExpression, colon, elseExpression);
+
+ /**
* Return the token used to separate the then expression from the else
* expression.
*/
@@ -1670,6 +1950,20 @@ abstract class ConditionalExpression extends Expression {
*/
abstract class Configuration extends AstNode {
/**
+ * Initialize a newly created configuration.
+ */
+ factory Configuration(
+ Token ifKeyword,
+ Token leftParenthesis,
+ DottedName name,
+ Token equalToken,
+ StringLiteral value,
+ Token rightParenthesis,
+ StringLiteral libraryUri) =>
+ new ConfigurationImpl(ifKeyword, leftParenthesis, name, equalToken, value,
+ rightParenthesis, libraryUri);
+
+ /**
* Return the token for the equal operator, or `null` if the condition does
* not include an equality test.
*/
@@ -1796,6 +2090,50 @@ abstract class Configuration extends AstNode {
*/
abstract class ConstructorDeclaration extends ClassMember {
/**
+ * Initialize a newly created constructor declaration. The [externalKeyword]
+ * can be `null` if the constructor is not external. Either or both of the
+ * [comment] and [metadata] can be `null` if the constructor does not have the
+ * corresponding attribute. The [constKeyword] can be `null` if the
+ * constructor cannot be used to create a constant. The [factoryKeyword] can
+ * be `null` if the constructor is not a factory. The [period] and [name] can
+ * both be `null` if the constructor is not a named constructor. The
+ * [separator] can be `null` if the constructor does not have any initializers
+ * and does not redirect to a different constructor. The list of
+ * [initializers] can be `null` if the constructor does not have any
+ * initializers. The [redirectedConstructor] can be `null` if the constructor
+ * does not redirect to a different constructor. The [body] can be `null` if
+ * the constructor does not have a body.
+ */
+ factory ConstructorDeclaration(
+ Comment comment,
+ List<Annotation> metadata,
+ Token externalKeyword,
+ Token constKeyword,
+ Token factoryKeyword,
+ Identifier returnType,
+ Token period,
+ SimpleIdentifier name,
+ FormalParameterList parameters,
+ Token separator,
+ List<ConstructorInitializer> initializers,
+ ConstructorName redirectedConstructor,
+ FunctionBody body) =>
+ new ConstructorDeclarationImpl(
+ comment,
+ metadata,
+ externalKeyword,
+ constKeyword,
+ factoryKeyword,
+ returnType,
+ period,
+ name,
+ parameters,
+ separator,
+ initializers,
+ redirectedConstructor,
+ body);
+
+ /**
* Return the body of the constructor, or `null` if the constructor does not
* have a body.
*/
@@ -1933,6 +2271,16 @@ abstract class ConstructorDeclaration extends ClassMember {
*/
abstract class ConstructorFieldInitializer extends ConstructorInitializer {
/**
+ * Initialize a newly created field initializer to initialize the field with
+ * the given name to the value of the given expression. The [thisKeyword] and
+ * [period] can be `null` if the 'this' keyword was not specified.
+ */
+ factory ConstructorFieldInitializer(Token thisKeyword, Token period,
+ SimpleIdentifier fieldName, Token equals, Expression expression) =>
+ new ConstructorFieldInitializerImpl(
+ thisKeyword, period, fieldName, equals, expression);
+
+ /**
* Return the token for the equal sign between the field name and the
* expression.
*/
@@ -2012,6 +2360,13 @@ abstract class ConstructorInitializer extends AstNode {}
abstract class ConstructorName extends AstNode
implements ConstructorReferenceNode {
/**
+ * Initialize a newly created constructor name. The [period] and [name] can be
+ * `null` if the constructor being named is the unnamed constructor.
+ */
+ factory ConstructorName(TypeName type, Token period, SimpleIdentifier name) =>
+ new ConstructorNameImpl(type, period, name);
+
+ /**
* Return the name of the constructor, or `null` if the specified constructor
* is the unnamed constructor.
*/
@@ -2075,6 +2430,14 @@ abstract class ConstructorReferenceNode {
*/
abstract class ContinueStatement extends Statement {
/**
+ * Initialize a newly created continue statement. The [label] can be `null` if
+ * there is no label associated with the statement.
+ */
+ factory ContinueStatement(
+ Token continueKeyword, SimpleIdentifier label, Token semicolon) =>
+ new ContinueStatementImpl(continueKeyword, label, semicolon);
+
+ /**
* Return the token representing the 'continue' keyword.
*/
Token get continueKeyword;
@@ -2146,6 +2509,16 @@ abstract class Declaration extends AnnotatedNode {
* Clients may not extend, implement or mix-in this class.
*/
abstract class DeclaredIdentifier extends Declaration {
+ /**
+ * Initialize a newly created formal parameter. Either or both of the
+ * [comment] and [metadata] can be `null` if the declaration does not have the
+ * corresponding attribute. The [keyword] can be `null` if a type name is
+ * given. The [type] must be `null` if the keyword is 'var'.
+ */
+ factory DeclaredIdentifier(Comment comment, List<Annotation> metadata,
+ Token keyword, TypeName type, SimpleIdentifier identifier) =>
+ new DeclaredIdentifierImpl(comment, metadata, keyword, type, identifier);
+
@override
LocalVariableElement get element;
@@ -2210,6 +2583,14 @@ abstract class DeclaredIdentifier extends Declaration {
*/
abstract class DefaultFormalParameter extends FormalParameter {
/**
+ * Initialize a newly created default formal parameter. The [separator] and
+ * [defaultValue] can be `null` if there is no default value.
+ */
+ factory DefaultFormalParameter(NormalFormalParameter parameter,
+ ParameterKind kind, Token separator, Expression defaultValue) =>
+ new DefaultFormalParameterImpl(parameter, kind, separator, defaultValue);
+
+ /**
* Return the expression computing the default value for the parameter, or
* `null` if there is no default value.
*/
@@ -2291,6 +2672,20 @@ abstract class Directive extends AnnotatedNode {
*/
abstract class DoStatement extends Statement {
/**
+ * Initialize a newly created do loop.
+ */
+ factory DoStatement(
+ Token doKeyword,
+ Statement body,
+ Token whileKeyword,
+ Token leftParenthesis,
+ Expression condition,
+ Token rightParenthesis,
+ Token semicolon) =>
+ new DoStatementImpl(doKeyword, body, whileKeyword, leftParenthesis,
+ condition, rightParenthesis, semicolon);
+
+ /**
* Return the body of the loop.
*/
Statement get body;
@@ -2372,6 +2767,11 @@ abstract class DoStatement extends Statement {
*/
abstract class DottedName extends AstNode {
/**
+ * Initialize a newly created dotted name.
+ */
+ factory DottedName(List<SimpleIdentifier> components) = DottedNameImpl;
+
+ /**
* Return the components of the identifier.
*/
NodeList<SimpleIdentifier> get components;
@@ -2391,6 +2791,11 @@ abstract class DottedName extends AstNode {
*/
abstract class DoubleLiteral extends Literal {
/**
+ * Initialize a newly created floating point literal.
+ */
+ factory DoubleLiteral(Token literal, double value) = DoubleLiteralImpl;
+
+ /**
* Return the token representing the literal.
*/
Token get literal;
@@ -2422,6 +2827,11 @@ abstract class DoubleLiteral extends Literal {
*/
abstract class EmptyFunctionBody extends FunctionBody {
/**
+ * Initialize a newly created function body.
+ */
+ factory EmptyFunctionBody(Token semicolon) = EmptyFunctionBodyImpl;
+
+ /**
* Return the token representing the semicolon that marks the end of the
* function body.
*/
@@ -2444,6 +2854,11 @@ abstract class EmptyFunctionBody extends FunctionBody {
*/
abstract class EmptyStatement extends Statement {
/**
+ * Initialize a newly created empty statement.
+ */
+ factory EmptyStatement(Token semicolon) = EmptyStatementImpl;
+
+ /**
* Return the semicolon terminating the statement.
*/
Token get semicolon;
@@ -2461,6 +2876,16 @@ abstract class EmptyStatement extends Statement {
*/
abstract class EnumConstantDeclaration extends Declaration {
/**
+ * Initialize a newly created enum constant declaration. Either or both of the
+ * [comment] and [metadata] can be `null` if the constant does not have the
+ * corresponding attribute. (Technically, enum constants cannot have metadata,
+ * but we allow it for consistency.)
+ */
+ factory EnumConstantDeclaration(
+ Comment comment, List<Annotation> metadata, SimpleIdentifier name) =>
+ new EnumConstantDeclarationImpl(comment, metadata, name);
+
+ /**
* Return the name of the constant.
*/
SimpleIdentifier get name;
@@ -2481,6 +2906,23 @@ abstract class EnumConstantDeclaration extends Declaration {
*/
abstract class EnumDeclaration extends NamedCompilationUnitMember {
/**
+ * Initialize a newly created enumeration declaration. Either or both of the
+ * [comment] and [metadata] can be `null` if the declaration does not have the
+ * corresponding attribute. The list of [constants] must contain at least one
+ * value.
+ */
+ factory EnumDeclaration(
+ Comment comment,
+ List<Annotation> metadata,
+ Token enumKeyword,
+ SimpleIdentifier name,
+ Token leftBracket,
+ List<EnumConstantDeclaration> constants,
+ Token rightBracket) =>
+ new EnumDeclarationImpl(comment, metadata, enumKeyword, name, leftBracket,
+ constants, rightBracket);
+
+ /**
* Return the enumeration constants being declared.
*/
NodeList<EnumConstantDeclaration> get constants;
@@ -2527,7 +2969,24 @@ abstract class EnumDeclaration extends NamedCompilationUnitMember {
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class ExportDirective extends NamespaceDirective {}
+abstract class ExportDirective extends NamespaceDirective {
+ /**
+ * Initialize a newly created export directive. Either or both of the
+ * [comment] and [metadata] can be `null` if the directive does not have the
+ * corresponding attribute. The list of [combinators] can be `null` if there
+ * are no combinators.
+ */
+ factory ExportDirective(
+ Comment comment,
+ List<Annotation> metadata,
+ Token keyword,
+ StringLiteral libraryUri,
+ List<Configuration> configurations,
+ List<Combinator> combinators,
+ Token semicolon) =>
+ new ExportDirectiveImpl(comment, metadata, keyword, libraryUri,
+ configurations, combinators, semicolon);
+}
/**
* A node that represents an expression.
@@ -2640,6 +3099,16 @@ abstract class Expression extends AstNode {
*/
abstract class ExpressionFunctionBody extends FunctionBody {
/**
+ * Initialize a newly created function body consisting of a block of
+ * statements. The [keyword] can be `null` if the function body is not an
+ * async function body.
+ */
+ factory ExpressionFunctionBody(Token keyword, Token functionDefinition,
+ Expression expression, Token semicolon) =>
+ new ExpressionFunctionBodyImpl(
+ keyword, functionDefinition, expression, semicolon);
+
+ /**
* Return the expression representing the body of the function.
*/
Expression get expression;
@@ -2688,6 +3157,12 @@ abstract class ExpressionFunctionBody extends FunctionBody {
*/
abstract class ExpressionStatement extends Statement {
/**
+ * Initialize a newly created expression statement.
+ */
+ factory ExpressionStatement(Expression expression, Token semicolon) =>
+ new ExpressionStatementImpl(expression, semicolon);
+
+ /**
* Return the expression that comprises the statement.
*/
Expression get expression;
@@ -2719,6 +3194,12 @@ abstract class ExpressionStatement extends Statement {
*/
abstract class ExtendsClause extends AstNode {
/**
+ * Initialize a newly created extends clause.
+ */
+ factory ExtendsClause(Token extendsKeyword, TypeName superclass) =>
+ new ExtendsClauseImpl(extendsKeyword, superclass);
+
+ /**
* Return the token representing the 'extends' keyword.
*/
Token get extendsKeyword;
@@ -2749,6 +3230,21 @@ abstract class ExtendsClause extends AstNode {
*/
abstract class FieldDeclaration extends ClassMember {
/**
+ * Initialize a newly created field declaration. Either or both of the
+ * [comment] and [metadata] can be `null` if the declaration does not have the
+ * corresponding attribute. The [staticKeyword] can be `null` if the field is
+ * not a static field.
+ */
+ factory FieldDeclaration(
+ Comment comment,
+ List<Annotation> metadata,
+ Token staticKeyword,
+ VariableDeclarationList fieldList,
+ Token semicolon) =>
+ new FieldDeclarationImpl(
+ comment, metadata, staticKeyword, fieldList, semicolon);
+
+ /**
* Return the fields being declared.
*/
VariableDeclarationList get fields;
@@ -2796,6 +3292,28 @@ abstract class FieldDeclaration extends ClassMember {
*/
abstract class FieldFormalParameter extends NormalFormalParameter {
/**
+ * Initialize a newly created formal parameter. Either or both of the
+ * [comment] and [metadata] can be `null` if the parameter does not have the
+ * corresponding attribute. The [keyword] can be `null` if there is a type.
+ * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
+ * [period] can be `null` if the keyword 'this' was not provided. The
+ * [parameters] can be `null` if this is not a function-typed field formal
+ * parameter.
+ */
+ factory FieldFormalParameter(
+ Comment comment,
+ List<Annotation> metadata,
+ Token keyword,
+ TypeName type,
+ Token thisKeyword,
+ Token period,
+ SimpleIdentifier identifier,
+ TypeParameterList typeParameters,
+ FormalParameterList parameters) =>
+ new FieldFormalParameterImpl(comment, metadata, keyword, type,
+ thisKeyword, period, identifier, typeParameters, parameters);
+
+ /**
* Return the token representing either the 'final', 'const' or 'var' keyword,
* or `null` if no keyword was used.
*/
@@ -2876,6 +3394,54 @@ abstract class FieldFormalParameter extends NormalFormalParameter {
*/
abstract class ForEachStatement extends Statement {
/**
+ * Initialize a newly created for-each statement whose loop control variable
+ * is declared internally (in the for-loop part). The [awaitKeyword] can be
+ * `null` if this is not an asynchronous for loop.
+ */
+ factory ForEachStatement.withDeclaration(
+ Token awaitKeyword,
+ Token forKeyword,
+ Token leftParenthesis,
+ DeclaredIdentifier loopVariable,
+ Token inKeyword,
+ Expression iterator,
+ Token rightParenthesis,
+ Statement body) =>
+ new ForEachStatementImpl.withDeclaration(
+ awaitKeyword,
+ forKeyword,
+ leftParenthesis,
+ loopVariable,
+ inKeyword,
+ iterator,
+ rightParenthesis,
+ body);
+
+ /**
+ * Initialize a newly created for-each statement whose loop control variable
+ * is declared outside the for loop. The [awaitKeyword] can be `null` if this
+ * is not an asynchronous for loop.
+ */
+ factory ForEachStatement.withReference(
+ Token awaitKeyword,
+ Token forKeyword,
+ Token leftParenthesis,
+ SimpleIdentifier identifier,
+ Token inKeyword,
+ Expression iterator,
+ Token rightParenthesis,
+ Statement body) =>
+ new ForEachStatementImpl.withReference(
+ awaitKeyword,
+ forKeyword,
+ leftParenthesis,
+ identifier,
+ inKeyword,
+ iterator,
+ rightParenthesis,
+ body);
+
+ /**
* Return the token representing the 'await' keyword, or `null` if there is no
* 'await' keyword.
*/
@@ -3046,6 +3612,18 @@ abstract class FormalParameter extends AstNode {
*/
abstract class FormalParameterList extends AstNode {
/**
+ * Initialize a newly created parameter list. The list of [parameters] can be
+ * `null` if there are no parameters. The [leftDelimiter] and [rightDelimiter]
+ * can be `null` if there are no optional parameters.
+ */
+ factory FormalParameterList(
+ Token leftParenthesis,
+ List<FormalParameter> parameters,
+ Token leftDelimiter,
+ Token rightDelimiter,
+ Token rightParenthesis) = FormalParameterListImpl;
+
+ /**
* Return the left square bracket ('[') or left curly brace ('{') introducing
* the optional parameters, or `null` if there are no optional parameters.
*/
@@ -3119,6 +3697,35 @@ abstract class FormalParameterList extends AstNode {
*/
abstract class ForStatement extends Statement {
/**
+ * Initialize a newly created for statement. Either the [variableList] or the
+ * [initialization] must be `null`. Either the [condition] and the list of
+ * [updaters] can be `null` if the loop does not have the corresponding
+ * attribute.
+ */
+ factory ForStatement(
+ Token forKeyword,
+ Token leftParenthesis,
+ VariableDeclarationList variableList,
+ Expression initialization,
+ Token leftSeparator,
+ Expression condition,
+ Token rightSeparator,
+ List<Expression> updaters,
+ Token rightParenthesis,
+ Statement body) =>
+ new ForStatementImpl(
+ forKeyword,
+ leftParenthesis,
+ variableList,
+ initialization,
+ leftSeparator,
+ condition,
+ rightSeparator,
+ updaters,
+ rightParenthesis,
+ body);
+
+ /**
* Return the body of the loop.
*/
Statement get body;
@@ -3298,6 +3905,25 @@ abstract class FunctionBody extends AstNode {
* Clients may not extend, implement or mix-in this class.
*/
abstract class FunctionDeclaration extends NamedCompilationUnitMember {
+ /**
+ * Initialize a newly created function declaration. Either or both of the
+ * [comment] and [metadata] can be `null` if the function does not have the
+ * corresponding attribute. The [externalKeyword] can be `null` if the
+ * function is not an external function. The [returnType] can be `null` if no
+ * return type was specified. The [propertyKeyword] can be `null` if the
+ * function is neither a getter or a setter.
+ */
+ factory FunctionDeclaration(
+ Comment comment,
+ List<Annotation> metadata,
+ Token externalKeyword,
+ TypeName returnType,
+ Token propertyKeyword,
+ SimpleIdentifier name,
+ FunctionExpression functionExpression) =>
+ new FunctionDeclarationImpl(comment, metadata, externalKeyword,
+ returnType, propertyKeyword, name, functionExpression);
+
@override
ExecutableElement get element;
@@ -3363,6 +3989,13 @@ abstract class FunctionDeclaration extends NamedCompilationUnitMember {
*/
abstract class FunctionDeclarationStatement extends Statement {
/**
+ * Initialize a newly created function declaration statement.
+ */
+ factory FunctionDeclarationStatement(
+ FunctionDeclaration functionDeclaration) =
+ FunctionDeclarationStatementImpl;
+
+ /**
* Return the function declaration being wrapped.
*/
FunctionDeclaration get functionDeclaration;
@@ -3384,6 +4017,13 @@ abstract class FunctionDeclarationStatement extends Statement {
*/
abstract class FunctionExpression extends Expression {
/**
+ * Initialize a newly created function declaration.
+ */
+ factory FunctionExpression(TypeParameterList typeParameters,
+ FormalParameterList parameters, FunctionBody body) =>
+ new FunctionExpressionImpl(typeParameters, parameters, body);
+
+ /**
* Return the body of the function, or `null` if this is an external function.
*/
FunctionBody get body;
@@ -3441,6 +4081,14 @@ abstract class FunctionExpression extends Expression {
*/
abstract class FunctionExpressionInvocation extends InvocationExpression {
/**
+ * Initialize a newly created function expression invocation.
+ */
+ factory FunctionExpressionInvocation(Expression function,
+ TypeArgumentList typeArguments, ArgumentList argumentList) =>
+ new FunctionExpressionInvocationImpl(
+ function, typeArguments, argumentList);
+
+ /**
* Set the list of arguments to the method to the given [argumentList].
*/
void set argumentList(ArgumentList argumentList);
@@ -3512,6 +4160,25 @@ abstract class FunctionExpressionInvocation extends InvocationExpression {
*/
abstract class FunctionTypeAlias extends TypeAlias {
/**
+ * Initialize a newly created function type alias. Either or both of the
+ * [comment] and [metadata] can be `null` if the function does not have the
+ * corresponding attribute. The [returnType] can be `null` if no return type
+ * was specified. The [typeParameters] can be `null` if the function has no
+ * type parameters.
+ */
+ factory FunctionTypeAlias(
+ Comment comment,
+ List<Annotation> metadata,
+ Token keyword,
+ TypeName returnType,
+ SimpleIdentifier name,
+ TypeParameterList typeParameters,
+ FormalParameterList parameters,
+ Token semicolon) =>
+ new FunctionTypeAliasImpl(comment, metadata, keyword, returnType, name,
+ typeParameters, parameters, semicolon);
+
+ /**
* Return the parameters associated with the function type.
*/
FormalParameterList get parameters;
@@ -3557,6 +4224,23 @@ abstract class FunctionTypeAlias extends TypeAlias {
*/
abstract class FunctionTypedFormalParameter extends NormalFormalParameter {
/**
+ * Initialize a newly created formal parameter. Either or both of the
+ * [comment] and [metadata] can be `null` if the parameter does not have the
+ * corresponding attribute. The [returnType] can be `null` if no return type
+ * was specified.
+ */
+ factory FunctionTypedFormalParameter(
+ Comment comment,
+ List<Annotation> metadata,
+ TypeName returnType,
+ SimpleIdentifier identifier,
+ TypeParameterList typeParameters,
+ FormalParameterList parameters,
+ {Token question: null}) =>
+ new FunctionTypedFormalParameterImpl(comment, metadata, returnType,
+ identifier, typeParameters, parameters, question);
+
+ /**
* Return the parameters of the function-typed parameter.
*/
FormalParameterList get parameters;
@@ -3614,6 +4298,12 @@ abstract class FunctionTypedFormalParameter extends NormalFormalParameter {
*/
abstract class HideCombinator extends Combinator {
/**
+ * Initialize a newly created import show combinator.
+ */
+ factory HideCombinator(Token keyword, List<SimpleIdentifier> hiddenNames) =
+ HideCombinatorImpl;
+
+ /**
* Return the list of names from the library that are hidden by this
* combinator.
*/
@@ -3678,6 +4368,21 @@ abstract class Identifier extends Expression {
*/
abstract class IfStatement extends Statement {
/**
+ * Initialize a newly created if statement. The [elseKeyword] and
+ * [elseStatement] can be `null` if there is no else clause.
+ */
+ factory IfStatement(
+ Token ifKeyword,
+ Token leftParenthesis,
+ Expression condition,
+ Token rightParenthesis,
+ Statement thenStatement,
+ Token elseKeyword,
+ Statement elseStatement) =>
+ new IfStatementImpl(ifKeyword, leftParenthesis, condition,
+ rightParenthesis, thenStatement, elseKeyword, elseStatement);
+
+ /**
* Return the condition used to determine which of the statements is executed
* next.
*/
@@ -3764,6 +4469,12 @@ abstract class IfStatement extends Statement {
*/
abstract class ImplementsClause extends AstNode {
/**
+ * Initialize a newly created implements clause.
+ */
+ factory ImplementsClause(Token implementsKeyword, List<TypeName> interfaces) =
+ ImplementsClauseImpl;
+
+ /**
* Return the token representing the 'implements' keyword.
*/
Token get implementsKeyword;
@@ -3894,6 +4605,38 @@ abstract class ImportDirective extends NamespaceDirective {
}
return 0;
};
+
+ /**
+ * Initialize a newly created import directive. Either or both of the
+ * [comment] and [metadata] can be `null` if the function does not have the
+ * corresponding attribute. The [deferredKeyword] can be `null` if the import
+ * is not deferred. The [asKeyword] and [prefix] can be `null` if the import
+ * does not specify a prefix. The list of [combinators] can be `null` if there
+ * are no combinators.
+ */
+ factory ImportDirective(
+ Comment comment,
+ List<Annotation> metadata,
+ Token keyword,
+ StringLiteral libraryUri,
+ List<Configuration> configurations,
+ Token deferredKeyword,
+ Token asKeyword,
+ SimpleIdentifier prefix,
+ List<Combinator> combinators,
+ Token semicolon) =>
+ new ImportDirectiveImpl(
+ comment,
+ metadata,
+ keyword,
+ libraryUri,
+ configurations,
+ deferredKeyword,
+ asKeyword,
+ prefix,
+ combinators,
+ semicolon);
+
/**
* Return the token representing the 'as' keyword, or `null` if the imported
* names are not prefixed.
@@ -3939,6 +4682,22 @@ abstract class ImportDirective extends NamespaceDirective {
abstract class IndexExpression extends Expression
implements MethodReferenceExpression {
/**
+ * Initialize a newly created index expression.
+ */
+ factory IndexExpression.forCascade(Token period, Token leftBracket,
+ Expression index, Token rightBracket) =>
+ new IndexExpressionImpl.forCascade(
+ period, leftBracket, index, rightBracket);
+
+ /**
+ * Initialize a newly created index expression.
+ */
+ factory IndexExpression.forTarget(Expression target, Token leftBracket,
+ Expression index, Token rightBracket) =>
+ new IndexExpressionImpl.forTarget(
+ target, leftBracket, index, rightBracket);
+
+ /**
* Return the auxiliary elements associated with this identifier, or `null` if
* this identifier is not in both a getter and setter context. The auxiliary
* elements hold the static and propagated elements associated with the getter
@@ -4057,6 +4816,14 @@ abstract class IndexExpression extends Expression
abstract class InstanceCreationExpression extends Expression
implements ConstructorReferenceNode {
/**
+ * Initialize a newly created instance creation expression.
+ */
+ factory InstanceCreationExpression(Token keyword,
+ ConstructorName constructorName, ArgumentList argumentList) =>
+ new InstanceCreationExpressionImpl(
+ keyword, constructorName, argumentList);
+
+ /**
* Return the list of arguments to the constructor.
*/
ArgumentList get argumentList;
@@ -4113,6 +4880,11 @@ abstract class InstanceCreationExpression extends Expression
*/
abstract class IntegerLiteral extends Literal {
/**
+ * Initialize a newly created integer literal.
+ */
+ factory IntegerLiteral(Token literal, int value) = IntegerLiteralImpl;
+
+ /**
* Return the token representing the literal.
*/
Token get literal;
@@ -4155,6 +4927,13 @@ abstract class InterpolationElement extends AstNode {}
*/
abstract class InterpolationExpression extends InterpolationElement {
/**
+ * Initialize a newly created interpolation expression.
+ */
+ factory InterpolationExpression(
+ Token leftBracket, Expression expression, Token rightBracket) =>
+ new InterpolationExpressionImpl(leftBracket, expression, rightBracket);
+
+ /**
* Return the expression to be evaluated for the value to be converted into a
* string.
*/
@@ -4202,6 +4981,13 @@ abstract class InterpolationExpression extends InterpolationElement {
*/
abstract class InterpolationString extends InterpolationElement {
/**
+ * Initialize a newly created string of characters that are part of a string
+ * interpolation.
+ */
+ factory InterpolationString(Token contents, String value) =
+ InterpolationStringImpl;
+
+ /**
* Return the characters that will be added to the string.
*/
Token get contents;
@@ -4309,6 +5095,14 @@ abstract class InvocationExpression extends Expression {
*/
abstract class IsExpression extends Expression {
/**
+ * Initialize a newly created is expression. The [notOperator] can be `null`
+ * if the sense of the test is not negated.
+ */
+ factory IsExpression(Expression expression, Token isOperator,
+ Token notOperator, TypeName type) =>
+ new IsExpressionImpl(expression, isOperator, notOperator, type);
+
+ /**
* Return the expression used to compute the value whose type is being tested.
*/
Expression get expression;
@@ -4360,6 +5154,12 @@ abstract class IsExpression extends Expression {
*/
abstract class Label extends AstNode {
/**
+ * Initialize a newly created label.
+ */
+ factory Label(SimpleIdentifier label, Token colon) =>
+ new LabelImpl(label, colon);
+
+ /**
* Return the colon that separates the label from the statement.
*/
Token get colon;
@@ -4391,6 +5191,12 @@ abstract class Label extends AstNode {
*/
abstract class LabeledStatement extends Statement {
/**
+ * Initialize a newly created labeled statement.
+ */
+ factory LabeledStatement(List<Label> labels, Statement statement) =>
+ new LabeledStatementImpl(labels, statement);
+
+ /**
* Return the labels being associated with the statement.
*/
NodeList<Label> get labels;
@@ -4417,6 +5223,16 @@ abstract class LabeledStatement extends Statement {
*/
abstract class LibraryDirective extends Directive {
/**
+ * Initialize a newly created library directive. Either or both of the
+ * [comment] and [metadata] can be `null` if the directive does not have the
+ * corresponding attribute.
+ */
+ factory LibraryDirective(Comment comment, List<Annotation> metadata,
+ Token libraryKeyword, LibraryIdentifier name, Token semicolon) =>
+ new LibraryDirectiveImpl(
+ comment, metadata, libraryKeyword, name, semicolon);
+
+ /**
* Return the token representing the 'library' keyword.
*/
Token get libraryKeyword;
@@ -4457,6 +5273,12 @@ abstract class LibraryDirective extends Directive {
*/
abstract class LibraryIdentifier extends Identifier {
/**
+ * Initialize a newly created prefixed identifier.
+ */
+ factory LibraryIdentifier(List<SimpleIdentifier> components) =
+ LibraryIdentifierImpl;
+
+ /**
* Return the components of the identifier.
*/
NodeList<SimpleIdentifier> get components;
@@ -4472,6 +5294,19 @@ abstract class LibraryIdentifier extends Identifier {
*/
abstract class ListLiteral extends TypedLiteral {
/**
+ * Initialize a newly created list literal. The [constKeyword] can be `null`
+ * if the literal is not a constant. The [typeArguments] can be `null` if no
+ * type arguments were declared. The list of [elements] can be `null` if the
+ * list is empty.
+ */
+ factory ListLiteral(
+ Token constKeyword,
+ TypeArgumentList typeArguments,
+ Token leftBracket,
+ List<Expression> elements,
+ Token rightBracket) = ListLiteralImpl;
+
+ /**
* Return the expressions used to compute the elements of the list.
*/
NodeList<Expression> get elements;
@@ -4524,6 +5359,18 @@ abstract class Literal extends Expression {}
*/
abstract class MapLiteral extends TypedLiteral {
/**
+ * Initialize a newly created map literal. The [constKeyword] can be `null` if
+ * the literal is not a constant. The [typeArguments] can be `null` if no type
+ * arguments were declared. The [entries] can be `null` if the map is empty.
+ */
+ factory MapLiteral(
+ Token constKeyword,
+ TypeArgumentList typeArguments,
+ Token leftBracket,
+ List<MapLiteralEntry> entries,
+ Token rightBracket) = MapLiteralImpl;
+
+ /**
* Return the entries in the map.
*/
NodeList<MapLiteralEntry> get entries;
@@ -4559,6 +5406,12 @@ abstract class MapLiteral extends TypedLiteral {
*/
abstract class MapLiteralEntry extends AstNode {
/**
+ * Initialize a newly created map literal entry.
+ */
+ factory MapLiteralEntry(Expression key, Token separator, Expression value) =>
+ new MapLiteralEntryImpl(key, separator, value);
+
+ /**
* Return the expression computing the key with which the value will be
* associated.
*/
@@ -4611,6 +5464,42 @@ abstract class MapLiteralEntry extends AstNode {
*/
abstract class MethodDeclaration extends ClassMember {
/**
+ * Initialize a newly created method declaration. Either or both of the
+ * [comment] and [metadata] can be `null` if the declaration does not have the
+ * corresponding attribute. The [externalKeyword] can be `null` if the method
+ * is not external. The [modifierKeyword] can be `null` if the method is
+ * neither abstract nor static. The [returnType] can be `null` if no return
+ * type was specified. The [propertyKeyword] can be `null` if the method is
+ * neither a getter or a setter. The [operatorKeyword] can be `null` if the
+ * method does not implement an operator. The [parameters] must be `null` if
+ * this method declares a getter.
+ */
+ factory MethodDeclaration(
+ Comment comment,
+ List<Annotation> metadata,
+ Token externalKeyword,
+ Token modifierKeyword,
+ TypeName returnType,
+ Token propertyKeyword,
+ Token operatorKeyword,
+ SimpleIdentifier name,
+ TypeParameterList typeParameters,
+ FormalParameterList parameters,
+ FunctionBody body) =>
+ new MethodDeclarationImpl(
+ comment,
+ metadata,
+ externalKeyword,
+ modifierKeyword,
+ returnType,
+ propertyKeyword,
+ operatorKeyword,
+ name,
+ typeParameters,
+ parameters,
+ body);
+
+ /**
* Return the body of the method.
*/
FunctionBody get body;
@@ -4752,6 +5641,19 @@ abstract class MethodDeclaration extends ClassMember {
*/
abstract class MethodInvocation extends InvocationExpression {
/**
+ * Initialize a newly created method invocation. The [target] and [operator]
+ * can be `null` if there is no target.
+ */
+ factory MethodInvocation(
+ Expression target,
+ Token operator,
+ SimpleIdentifier methodName,
+ TypeArgumentList typeArguments,
+ ArgumentList argumentList) =>
+ new MethodInvocationImpl(
+ target, operator, methodName, typeArguments, argumentList);
+
+ /**
* Set the list of arguments to the method to the given [argumentList].
*/
void set argumentList(ArgumentList argumentList);
@@ -4892,6 +5794,12 @@ abstract class NamedCompilationUnitMember extends CompilationUnitMember {
*/
abstract class NamedExpression extends Expression {
/**
+ * Initialize a newly created named expression..
+ */
+ factory NamedExpression(Label name, Expression expression) =>
+ new NamedExpressionImpl(name, expression);
+
+ /**
* Return the element representing the parameter being named by this
* expression, or `null` if the AST structure has not been resolved or if
* there is no parameter with the same name as this expression.
@@ -4984,6 +5892,12 @@ abstract class NamespaceDirective extends UriBasedDirective {
*/
abstract class NativeClause extends AstNode {
/**
+ * Initialize a newly created native clause.
+ */
+ factory NativeClause(Token nativeKeyword, StringLiteral name) =>
+ new NativeClauseImpl(nativeKeyword, name);
+
+ /**
* Return the name of the native object that implements the class.
*/
StringLiteral get name;
@@ -5016,6 +5930,14 @@ abstract class NativeClause extends AstNode {
*/
abstract class NativeFunctionBody extends FunctionBody {
/**
+ * Initialize a newly created function body consisting of the 'native' token,
+ * a string literal, and a semicolon.
+ */
+ factory NativeFunctionBody(
+ Token nativeKeyword, StringLiteral stringLiteral, Token semicolon) =>
+ new NativeFunctionBodyImpl(nativeKeyword, stringLiteral, semicolon);
+
+ /**
* Return the token representing 'native' that marks the start of the function
* body.
*/
@@ -5058,6 +5980,14 @@ abstract class NativeFunctionBody extends FunctionBody {
*/
abstract class NodeList<E extends AstNode> implements List<E> {
/**
+ * Initialize a newly created list of nodes such that all of the nodes that
+ * are added to the list will have their parent set to the given [owner]. The
+ * list will initially be populated with the given [elements].
+ */
+ factory NodeList(AstNode owner, [List<E> elements]) =>
+ new NodeListImpl<E>(owner as AstNodeImpl, elements);
+
+ /**
* Return the first token included in this node list's source range, or `null`
* if the list is empty.
*/
@@ -5151,6 +6081,11 @@ abstract class NormalFormalParameter extends FormalParameter {
*/
abstract class NullLiteral extends Literal {
/**
+ * Initialize a newly created null literal.
+ */
+ factory NullLiteral(Token literal) = NullLiteralImpl;
+
+ /**
* Return the token representing the literal.
*/
Token get literal;
@@ -5171,6 +6106,14 @@ abstract class NullLiteral extends Literal {
*/
abstract class ParenthesizedExpression extends Expression {
/**
+ * Initialize a newly created parenthesized expression.
+ */
+ factory ParenthesizedExpression(Token leftParenthesis, Expression expression,
+ Token rightParenthesis) =>
+ new ParenthesizedExpressionImpl(
+ leftParenthesis, expression, rightParenthesis);
+
+ /**
* Return the expression within the parentheses.
*/
Expression get expression;
@@ -5211,6 +6154,18 @@ abstract class ParenthesizedExpression extends Expression {
*/
abstract class PartDirective extends UriBasedDirective {
/**
+ * Initialize a newly created part directive. Either or both of the [comment]
+ * and [metadata] can be `null` if the directive does not have the
+ * corresponding attribute.
+ */
+ factory PartDirective(
+ Comment comment,
+ List<Annotation> metadata,
+ Token partKeyword,
+ StringLiteral partUri,
+ Token semicolon) = PartDirectiveImpl;
+
+ /**
* Return the token representing the 'part' keyword.
*/
Token get partKeyword;
@@ -5241,6 +6196,23 @@ abstract class PartDirective extends UriBasedDirective {
*/
abstract class PartOfDirective extends Directive {
/**
+ * Initialize a newly created part-of directive. Either or both of the
+ * [comment] and [metadata] can be `null` if the directive does not have the
+ * corresponding attribute. Only one of the [uri] and [libraryName] should be
+ * provided.
+ */
+ factory PartOfDirective(
+ Comment comment,
+ List<Annotation> metadata,
+ Token partKeyword,
+ Token ofKeyword,
+ StringLiteral uri,
+ LibraryIdentifier libraryName,
+ Token semicolon) =>
+ new PartOfDirectiveImpl(comment, metadata, partKeyword, ofKeyword, uri,
+ libraryName, semicolon);
+
+ /**
* Return the name of the library that the containing compilation unit is part
* of.
*/
@@ -5308,6 +6280,12 @@ abstract class PartOfDirective extends Directive {
abstract class PostfixExpression extends Expression
implements MethodReferenceExpression {
/**
+ * Initialize a newly created postfix expression.
+ */
+ factory PostfixExpression(Expression operand, Token operator) =>
+ new PostfixExpressionImpl(operand, operator);
+
+ /**
* Return the expression computing the operand for the operator.
*/
Expression get operand;
@@ -5340,6 +6318,13 @@ abstract class PostfixExpression extends Expression
*/
abstract class PrefixedIdentifier extends Identifier {
/**
+ * Initialize a newly created prefixed identifier.
+ */
+ factory PrefixedIdentifier(
+ SimpleIdentifier prefix, Token period, SimpleIdentifier identifier) =>
+ new PrefixedIdentifierImpl(prefix, period, identifier);
+
+ /**
* Return the identifier being prefixed.
*/
SimpleIdentifier get identifier;
@@ -5393,6 +6378,12 @@ abstract class PrefixedIdentifier extends Identifier {
abstract class PrefixExpression extends Expression
implements MethodReferenceExpression {
/**
+ * Initialize a newly created prefix expression.
+ */
+ factory PrefixExpression(Token operator, Expression operand) =>
+ new PrefixExpressionImpl(operator, operand);
+
+ /**
* Return the expression computing the operand for the operator.
*/
Expression get operand;
@@ -5428,6 +6419,13 @@ abstract class PrefixExpression extends Expression
*/
abstract class PropertyAccess extends Expression {
/**
+ * Initialize a newly created property access expression.
+ */
+ factory PropertyAccess(
+ Expression target, Token operator, SimpleIdentifier propertyName) =>
+ new PropertyAccessImpl(target, operator, propertyName);
+
+ /**
* Return `true` if this expression is cascaded. If it is, then the target of
* this expression is not stored locally but is stored in the nearest ancestor
* that is a [CascadeExpression].
@@ -5490,6 +6488,16 @@ abstract class PropertyAccess extends Expression {
abstract class RedirectingConstructorInvocation extends ConstructorInitializer
implements ConstructorReferenceNode {
/**
+ * Initialize a newly created redirecting invocation to invoke the constructor
+ * with the given name with the given arguments. The [constructorName] can be
+ * `null` if the constructor being invoked is the unnamed constructor.
+ */
+ factory RedirectingConstructorInvocation(Token thisKeyword, Token period,
+ SimpleIdentifier constructorName, ArgumentList argumentList) =>
+ new RedirectingConstructorInvocationImpl(
+ thisKeyword, period, constructorName, argumentList);
+
+ /**
* Return the list of arguments to the constructor.
*/
ArgumentList get argumentList;
@@ -5544,6 +6552,11 @@ abstract class RedirectingConstructorInvocation extends ConstructorInitializer
*/
abstract class RethrowExpression extends Expression {
/**
+ * Initialize a newly created rethrow expression.
+ */
+ factory RethrowExpression(Token rethrowKeyword) = RethrowExpressionImpl;
+
+ /**
* Return the token representing the 'rethrow' keyword.
*/
Token get rethrowKeyword;
@@ -5564,6 +6577,14 @@ abstract class RethrowExpression extends Expression {
*/
abstract class ReturnStatement extends Statement {
/**
+ * Initialize a newly created return statement. The [expression] can be `null`
+ * if no explicit value was provided.
+ */
+ factory ReturnStatement(
+ Token returnKeyword, Expression expression, Token semicolon) =>
+ new ReturnStatementImpl(returnKeyword, expression, semicolon);
+
+ /**
* Return the expression computing the value to be returned, or `null` if no
* explicit value was provided.
*/
@@ -5606,6 +6627,11 @@ abstract class ReturnStatement extends Statement {
*/
abstract class ScriptTag extends AstNode {
/**
+ * Initialize a newly created script tag.
+ */
+ factory ScriptTag(Token scriptTag) = ScriptTagImpl;
+
+ /**
* Return the token representing this script tag.
*/
Token get scriptTag;
@@ -5626,6 +6652,12 @@ abstract class ScriptTag extends AstNode {
*/
abstract class ShowCombinator extends Combinator {
/**
+ * Initialize a newly created import show combinator.
+ */
+ factory ShowCombinator(Token keyword, List<SimpleIdentifier> shownNames) =
+ ShowCombinatorImpl;
+
+ /**
* Return the list of names from the library that are made visible by this
* combinator.
*/
@@ -5642,6 +6674,17 @@ abstract class ShowCombinator extends Combinator {
*/
abstract class SimpleFormalParameter extends NormalFormalParameter {
/**
+ * Initialize a newly created formal parameter. Either or both of the
+ * [comment] and [metadata] can be `null` if the parameter does not have the
+ * corresponding attribute. The [keyword] can be `null` if a type was
+ * specified. The [type] must be `null` if the keyword is 'var'.
+ */
+ factory SimpleFormalParameter(Comment comment, List<Annotation> metadata,
+ Token keyword, TypeName type, SimpleIdentifier identifier) =>
+ new SimpleFormalParameterImpl(
+ comment, metadata, keyword, type, identifier);
+
+ /**
* Return the token representing either the 'final', 'const' or 'var' keyword,
* or `null` if no keyword was used.
*/
@@ -5679,6 +6722,16 @@ abstract class SimpleFormalParameter extends NormalFormalParameter {
*/
abstract class SimpleIdentifier extends Identifier {
/**
+ * Initialize a newly created identifier.
+ */
+ factory SimpleIdentifier(Token token, {bool isDeclaration: false}) {
+ if (isDeclaration) {
+ return new DeclaredSimpleIdentifier(token);
+ }
+ return new SimpleIdentifierImpl(token);
+ }
+
+ /**
* Return the auxiliary elements associated with this identifier, or `null` if
* this identifier is not in both a getter and setter context. The auxiliary
* elements hold the static and propagated elements associated with the getter
@@ -5776,6 +6829,12 @@ abstract class SimpleIdentifier extends Identifier {
*/
abstract class SimpleStringLiteral extends SingleStringLiteral {
/**
+ * Initialize a newly created simple string literal.
+ */
+ factory SimpleStringLiteral(Token literal, String value) =
+ SimpleStringLiteralImpl;
+
+ /**
* Return the token representing the literal.
*/
Token get literal;
@@ -5874,6 +6933,12 @@ abstract class Statement extends AstNode {
*/
abstract class StringInterpolation extends SingleStringLiteral {
/**
+ * Initialize a newly created string interpolation expression.
+ */
+ factory StringInterpolation(List<InterpolationElement> elements) =
+ StringInterpolationImpl;
+
+ /**
* Return the elements that will be composed to produce the resulting string.
*/
NodeList<InterpolationElement> get elements;
@@ -5909,6 +6974,17 @@ abstract class StringLiteral extends Literal {
abstract class SuperConstructorInvocation extends ConstructorInitializer
implements ConstructorReferenceNode {
/**
+ * Initialize a newly created super invocation to invoke the inherited
+ * constructor with the given name with the given arguments. The [period] and
+ * [constructorName] can be `null` if the constructor being invoked is the
+ * unnamed constructor.
+ */
+ factory SuperConstructorInvocation(Token superKeyword, Token period,
+ SimpleIdentifier constructorName, ArgumentList argumentList) =>
+ new SuperConstructorInvocationImpl(
+ superKeyword, period, constructorName, argumentList);
+
+ /**
* Return the list of arguments to the constructor.
*/
ArgumentList get argumentList;
@@ -5963,6 +7039,11 @@ abstract class SuperConstructorInvocation extends ConstructorInitializer
*/
abstract class SuperExpression extends Expression {
/**
+ * Initialize a newly created super expression.
+ */
+ factory SuperExpression(Token superKeyword) = SuperExpressionImpl;
+
+ /**
* Return the token representing the 'super' keyword.
*/
Token get superKeyword;
@@ -5983,6 +7064,14 @@ abstract class SuperExpression extends Expression {
*/
abstract class SwitchCase extends SwitchMember {
/**
+ * Initialize a newly created switch case. The list of [labels] can be `null`
+ * if there are no labels.
+ */
+ factory SwitchCase(List<Label> labels, Token keyword, Expression expression,
+ Token colon, List<Statement> statements) =>
+ new SwitchCaseImpl(labels, keyword, expression, colon, statements);
+
+ /**
* Return the expression controlling whether the statements will be executed.
*/
Expression get expression;
@@ -6002,7 +7091,14 @@ abstract class SwitchCase extends SwitchMember {
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class SwitchDefault extends SwitchMember {}
+abstract class SwitchDefault extends SwitchMember {
+ /**
+ * Initialize a newly created switch default. The list of [labels] can be
+ * `null` if there are no labels.
+ */
+ factory SwitchDefault(List<Label> labels, Token keyword, Token colon,
+ List<Statement> statements) = SwitchDefaultImpl;
+}
/**
* An element within a switch statement.
@@ -6059,6 +7155,21 @@ abstract class SwitchMember extends AstNode {
*/
abstract class SwitchStatement extends Statement {
/**
+ * Initialize a newly created switch statement. The list of [members] can be
+ * `null` if there are no switch members.
+ */
+ factory SwitchStatement(
+ Token switchKeyword,
+ Token leftParenthesis,
+ Expression expression,
+ Token rightParenthesis,
+ Token leftBracket,
+ List<SwitchMember> members,
+ Token rightBracket) =>
+ new SwitchStatementImpl(switchKeyword, leftParenthesis, expression,
+ rightParenthesis, leftBracket, members, rightBracket);
+
+ /**
* Return the expression used to determine which of the switch members will be
* selected.
*/
@@ -6136,6 +7247,12 @@ abstract class SwitchStatement extends Statement {
*/
abstract class SymbolLiteral extends Literal {
/**
+ * Initialize a newly created symbol literal.
+ */
+ factory SymbolLiteral(Token poundSign, List<Token> components) =
+ SymbolLiteralImpl;
+
+ /**
* Return the components of the literal.
*/
List<Token> get components;
@@ -6161,6 +7278,11 @@ abstract class SymbolLiteral extends Literal {
*/
abstract class ThisExpression extends Expression {
/**
+ * Initialize a newly created this expression.
+ */
+ factory ThisExpression(Token thisKeyword) = ThisExpressionImpl;
+
+ /**
* Return the token representing the 'this' keyword.
*/
Token get thisKeyword;
@@ -6181,6 +7303,12 @@ abstract class ThisExpression extends Expression {
*/
abstract class ThrowExpression extends Expression {
/**
+ * Initialize a newly created throw expression.
+ */
+ factory ThrowExpression(Token throwKeyword, Expression expression) =>
+ new ThrowExpressionImpl(throwKeyword, expression);
+
+ /**
* Return the expression computing the exception to be thrown.
*/
Expression get expression;
@@ -6213,6 +7341,19 @@ abstract class ThrowExpression extends Expression {
*/
abstract class TopLevelVariableDeclaration extends CompilationUnitMember {
/**
+ * Initialize a newly created top-level variable declaration. Either or both
+ * of the [comment] and [metadata] can be `null` if the variable does not have
+ * the corresponding attribute.
+ */
+ factory TopLevelVariableDeclaration(
+ Comment comment,
+ List<Annotation> metadata,
+ VariableDeclarationList variableList,
+ Token semicolon) =>
+ new TopLevelVariableDeclarationImpl(
+ comment, metadata, variableList, semicolon);
+
+ /**
* Return the semicolon terminating the declaration.
*/
Token get semicolon;
@@ -6247,6 +7388,20 @@ abstract class TopLevelVariableDeclaration extends CompilationUnitMember {
*/
abstract class TryStatement extends Statement {
/**
+ * Initialize a newly created try statement. The list of [catchClauses] can be
+ * `null` if there are no catch clauses. The [finallyKeyword] and
+ * [finallyBlock] can be `null` if there is no finally clause.
+ */
+ factory TryStatement(
+ Token tryKeyword,
+ Block body,
+ List<CatchClause> catchClauses,
+ Token finallyKeyword,
+ Block finallyBlock) =>
+ new TryStatementImpl(
+ tryKeyword, body, catchClauses, finallyKeyword, finallyBlock);
+
+ /**
* Return the body of the statement.
*/
Block get body;
@@ -6338,6 +7493,13 @@ abstract class TypeAlias extends NamedCompilationUnitMember {
*/
abstract class TypeArgumentList extends AstNode {
/**
+ * Initialize a newly created list of type arguments.
+ */
+ factory TypeArgumentList(
+ Token leftBracket, List<TypeName> arguments, Token rightBracket) =
+ TypeArgumentListImpl;
+
+ /**
* Return the type arguments associated with the type.
*/
NodeList<TypeName> get arguments;
@@ -6407,6 +7569,14 @@ abstract class TypedLiteral extends Literal {
*/
abstract class TypeName extends AstNode {
/**
+ * Initialize a newly created type name. The [typeArguments] can be `null` if
+ * there are no type arguments.
+ */
+ factory TypeName(Identifier name, TypeArgumentList typeArguments,
+ {Token question: null}) =>
+ new TypeNameImpl(name, typeArguments, question);
+
+ /**
* Return `true` if this type is a deferred type.
*
* 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form
@@ -6470,6 +7640,16 @@ abstract class TypeName extends AstNode {
*/
abstract class TypeParameter extends Declaration {
/**
+ * Initialize a newly created type parameter. Either or both of the [comment]
+ * and [metadata] can be `null` if the parameter does not have the
+ * corresponding attribute. The [extendsKeyword] and [bound] can be `null` if
+ * the parameter does not have an upper bound.
+ */
+ factory TypeParameter(Comment comment, List<Annotation> metadata,
+ SimpleIdentifier name, Token extendsKeyword, TypeName bound) =>
+ new TypeParameterImpl(comment, metadata, name, extendsKeyword, bound);
+
+ /**
* Return the name of the upper bound for legal arguments, or `null` if there
* is no explicit upper bound.
*/
@@ -6513,6 +7693,14 @@ abstract class TypeParameter extends Declaration {
*/
abstract class TypeParameterList extends AstNode {
/**
+ * Initialize a newly created list of type parameters.
+ */
+ factory TypeParameterList(
+ Token leftBracket,
+ List<TypeParameter> typeParameters,
+ Token rightBracket) = TypeParameterListImpl;
+
+ /**
* Return the left angle bracket.
*/
Token get leftBracket;
@@ -6605,6 +7793,14 @@ abstract class UriBasedDirective extends Directive {
* Clients may not extend, implement or mix-in this class.
*/
abstract class VariableDeclaration extends Declaration {
+ /**
+ * Initialize a newly created variable declaration. The [equals] and
+ * [initializer] can be `null` if there is no initializer.
+ */
+ factory VariableDeclaration(
+ SimpleIdentifier name, Token equals, Expression initializer) =>
+ new VariableDeclarationImpl(name, equals, initializer);
+
@override
VariableElement get element;
@@ -6671,6 +7867,17 @@ abstract class VariableDeclaration extends Declaration {
*/
abstract class VariableDeclarationList extends AnnotatedNode {
/**
+ * Initialize a newly created variable declaration list. Either or both of the
+ * [comment] and [metadata] can be `null` if the variable list does not have
+ * the corresponding attribute. The [keyword] can be `null` if a type was
+ * specified. The [type] must be `null` if the keyword is 'var'.
+ */
+ factory VariableDeclarationList(Comment comment, List<Annotation> metadata,
+ Token keyword, TypeName type, List<VariableDeclaration> variables) =>
+ new VariableDeclarationListImpl(
+ comment, metadata, keyword, type, variables);
+
+ /**
* Return `true` if the variables in this list were declared with the 'const'
* modifier.
*/
@@ -6724,6 +7931,13 @@ abstract class VariableDeclarationList extends AnnotatedNode {
*/
abstract class VariableDeclarationStatement extends Statement {
/**
+ * Initialize a newly created variable declaration statement.
+ */
+ factory VariableDeclarationStatement(
+ VariableDeclarationList variableList, Token semicolon) =>
+ new VariableDeclarationStatementImpl(variableList, semicolon);
+
+ /**
* Return the semicolon terminating the statement.
*/
Token get semicolon;
@@ -6754,6 +7968,14 @@ abstract class VariableDeclarationStatement extends Statement {
*/
abstract class WhileStatement extends Statement {
/**
+ * Initialize a newly created while statement.
+ */
+ factory WhileStatement(Token whileKeyword, Token leftParenthesis,
+ Expression condition, Token rightParenthesis, Statement body) =>
+ new WhileStatementImpl(
+ whileKeyword, leftParenthesis, condition, rightParenthesis, body);
+
+ /**
* Return the body of the loop.
*/
Statement get body;
@@ -6816,6 +8038,12 @@ abstract class WhileStatement extends Statement {
*/
abstract class WithClause extends AstNode {
/**
+ * Initialize a newly created with clause.
+ */
+ factory WithClause(Token withKeyword, List<TypeName> mixinTypes) =
+ WithClauseImpl;
+
+ /**
* Return the names of the mixins that were specified.
*/
NodeList<TypeName> get mixinTypes;
@@ -6841,6 +8069,14 @@ abstract class WithClause extends AstNode {
*/
abstract class YieldStatement extends Statement {
/**
+ * Initialize a newly created yield expression. The [star] can be `null` if no
+ * star was provided.
+ */
+ factory YieldStatement(Token yieldKeyword, Token star, Expression expression,
+ Token semicolon) =>
+ new YieldStatementImpl(yieldKeyword, star, expression, semicolon);
+
+ /**
* Return the expression whose value will be yielded.
*/
Expression get expression;
« no previous file with comments | « pkg/analyzer/CHANGELOG.md ('k') | pkg/analyzer/lib/src/dart/ast/utilities.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698