diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart index e00ec2a81a5..26a9af5c403 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart @@ -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/search/search_engine.dart'; import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/standard_ast_factory.dart'; import 'package:analyzer/dart/ast/token.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/type.dart'; @@ -516,7 +517,8 @@ class ReplacementRange { } } if (token is StringToken) { - SimpleStringLiteral uri = new SimpleStringLiteral(token, token.lexeme); + SimpleStringLiteral uri = + astFactory.simpleStringLiteral(token, token.lexeme); Keyword keyword = token.previous?.keyword; if (keyword == Keyword.IMPORT || keyword == Keyword.EXPORT || diff --git a/pkg/analysis_server/lib/src/services/completion/dart/label_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/label_contributor.dart index 8600be2e9ea..a540887fd60 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/label_contributor.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/label_contributor.dart @@ -15,6 +15,7 @@ import 'package:analysis_server/src/services/completion/dart/local_declaration_v show LocalDeclarationVisitor; import 'package:analysis_server/src/services/completion/dart/optype.dart'; import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/standard_ast_factory.dart'; import 'package:analyzer/dart/ast/token.dart'; import 'package:analyzer/src/dart/ast/token.dart'; import 'package:analyzer/src/generated/source.dart'; @@ -24,8 +25,9 @@ import '../../../protocol_server.dart' const DYNAMIC = 'dynamic'; -final TypeName NO_RETURN_TYPE = new TypeName( - new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), null); +final TypeName NO_RETURN_TYPE = astFactory.typeName( + astFactory.simpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), + null); /** * Create a new protocol Element for inclusion in a completion suggestion. diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart index 8778f6c22ef..cef91def59f 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart @@ -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/suggestion_builder.dart'; import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/standard_ast_factory.dart'; import 'package:analyzer/dart/ast/token.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/src/dart/ast/token.dart'; @@ -26,8 +27,9 @@ import '../../../protocol_server.dart' const DYNAMIC = 'dynamic'; -final TypeName NO_RETURN_TYPE = new TypeName( - new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), null); +final TypeName NO_RETURN_TYPE = astFactory.typeName( + astFactory.simpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), + null); /** * Create a new protocol Element for inclusion in a completion suggestion. diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_declaration_visitor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_declaration_visitor.dart index f0c2b3a1192..adf26c7ab6f 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/local_declaration_visitor.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/local_declaration_visitor.dart @@ -5,6 +5,7 @@ library services.completion.dart.local.declaration.visitor; import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/standard_ast_factory.dart'; import 'package:analyzer/dart/ast/token.dart'; import 'package:analyzer/dart/ast/visitor.dart'; import 'package:analyzer/src/dart/ast/token.dart'; @@ -15,8 +16,8 @@ import 'package:analyzer/src/dart/ast/token.dart'; * which catches the exception thrown by [finished()]. */ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor { - static final TypeName STACKTRACE_TYPE = new TypeName( - new SimpleIdentifier( + static final TypeName STACKTRACE_TYPE = astFactory.typeName( + astFactory.simpleIdentifier( new StringToken(TokenType.IDENTIFIER, 'StackTrace', 0)), null); diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart index 70b2b448e4e..01298f86515 100644 --- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart +++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart @@ -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/utilities/documentation.dart'; import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/standard_ast_factory.dart'; import 'package:analyzer/dart/ast/token.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/type.dart'; @@ -29,8 +30,9 @@ import '../../../protocol_server.dart' const DYNAMIC = 'dynamic'; -final TypeName NO_RETURN_TYPE = new TypeName( - new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), null); +final TypeName NO_RETURN_TYPE = astFactory.typeName( + astFactory.simpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), + null); /** * Create a new protocol Element for inclusion in a completion suggestion. diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md index e7a9e48b5f4..8449bf03c20 100644 --- a/pkg/analyzer/CHANGELOG.md +++ b/pkg/analyzer/CHANGELOG.md @@ -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. * Added an AST structure to support asserts in constructor initializers (AssertInitializer). AstVisitor classes must now implement visitAssertInitializer(). * Changed the API for creating PartOfDirective. It now accepts a StringLiteral URI, to accomodate "part of" declarations with a URI string rather than a library name. +* Removed AST constructors. AST nodes should now be created using `astFactory`, located in `package:analyzer/dart/ast/standard_ast_factory.dart`. ## 0.29.0-alpha.0 * Removed `Element.docRange`. diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart index c36925f0d17..78b3c0668b5 100644 --- a/pkg/analyzer/lib/dart/ast/ast.dart +++ b/pkg/analyzer/lib/dart/ast/ast.dart @@ -40,7 +40,6 @@ 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,12 +59,6 @@ import 'package:analyzer/src/generated/utilities_dart.dart'; * Clients may not extend, implement or mix-in this class. */ 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 strings) = AdjacentStringsImpl; - /** * Return the strings that are implicitly concatenated. */ @@ -120,16 +113,6 @@ abstract class AnnotatedNode extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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. @@ -223,13 +206,6 @@ abstract class Annotation extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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 arguments, - Token rightParenthesis) = ArgumentListImpl; - /** * Return the expressions producing the values of the arguments. Although the * language requires that positional arguments appear before named arguments, @@ -283,13 +259,6 @@ abstract class ArgumentList extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -330,21 +299,7 @@ abstract class AsExpression extends Expression { * * Clients may not extend, implement or mix-in this class. */ -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); -} +abstract class AssertInitializer implements Assertion, ConstructorInitializer {} /** * An assertion, either in a block or in the initializer list of a constructor. @@ -427,21 +382,6 @@ abstract class Assertion implements AstNode { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -463,13 +403,6 @@ 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. */ @@ -855,12 +788,6 @@ abstract class AstVisitor { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -892,13 +819,6 @@ 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. */ @@ -941,13 +861,6 @@ abstract class BinaryExpression extends Expression * Clients may not extend, implement or mix-in this class. */ abstract class Block extends Statement { - /** - * Initialize a newly created block of code. - */ - factory Block( - Token leftBracket, List statements, Token rightBracket) => - new BlockImpl(leftBracket, statements, rightBracket); - /** * Return the left curly bracket. */ @@ -983,15 +896,6 @@ abstract class Block extends Statement { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -1022,11 +926,6 @@ abstract class BlockFunctionBody extends FunctionBody { * Clients may not extend, implement or mix-in this class. */ abstract class BooleanLiteral extends Literal { - /** - * Initialize a newly created boolean literal. - */ - factory BooleanLiteral(Token literal, bool value) = BooleanLiteralImpl; - /** * Return the token representing the literal. */ @@ -1052,14 +951,6 @@ abstract class BooleanLiteral extends Literal { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -1128,14 +1019,6 @@ abstract class BreakStatement extends Statement { * Clients may not extend, implement or mix-in this class. */ 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 cascadeSections) => - new CascadeExpressionImpl(target, cascadeSections); - /** * Return the cascade sections sharing the common target. */ @@ -1165,33 +1048,6 @@ abstract class CascadeExpression extends Expression { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -1305,43 +1161,6 @@ abstract class CatchClause extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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 metadata, - Token abstractKeyword, - Token classKeyword, - SimpleIdentifier name, - TypeParameterList typeParameters, - ExtendsClause extendsClause, - WithClause withClause, - ImplementsClause implementsClause, - Token leftBracket, - List 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. */ @@ -1489,39 +1308,6 @@ abstract class ClassMember extends Declaration {} * Clients may not extend, implement or mix-in this class. */ 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 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. @@ -1637,15 +1423,6 @@ abstract class Combinator extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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 tokens, CommentType type, - List references) = CommentImpl; - /** * Return `true` if this is a block comment. */ @@ -1670,32 +1447,6 @@ abstract class Comment extends AstNode { * Return the tokens representing the comment. */ List get tokens; - - /** - * Create a block comment consisting of the given [tokens]. - */ - static Comment createBlockComment(List tokens) => - CommentImpl.createBlockComment(tokens); - - /** - * Create a documentation comment consisting of the given [tokens]. - */ - static Comment createDocumentationComment(List 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 tokens, List references) => - CommentImpl.createDocumentationCommentWithReferences(tokens, references); - - /** - * Create an end-of-line comment consisting of the given [tokens]. - */ - static Comment createEndOfLineComment(List tokens) => - CommentImpl.createEndOfLineComment(tokens); } /** @@ -1707,13 +1458,6 @@ abstract class Comment extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -1762,22 +1506,6 @@ abstract class CommentReference extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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 directives, - List 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]. @@ -1866,14 +1594,6 @@ abstract class CompilationUnitMember extends Declaration {} * Clients may not extend, implement or mix-in this class. */ 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. @@ -1949,20 +1669,6 @@ abstract class ConditionalExpression extends Expression { * Clients may not extend, implement or mix-in this class. */ 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. @@ -2089,50 +1795,6 @@ abstract class Configuration extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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 metadata, - Token externalKeyword, - Token constKeyword, - Token factoryKeyword, - Identifier returnType, - Token period, - SimpleIdentifier name, - FormalParameterList parameters, - Token separator, - List 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. @@ -2270,16 +1932,6 @@ abstract class ConstructorDeclaration extends ClassMember { * Clients may not extend, implement or mix-in this class. */ 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. @@ -2359,13 +2011,6 @@ 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. @@ -2429,14 +2074,6 @@ abstract class ConstructorReferenceNode { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -2509,16 +2146,6 @@ 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 metadata, - Token keyword, TypeName type, SimpleIdentifier identifier) => - new DeclaredIdentifierImpl(comment, metadata, keyword, type, identifier); - @override LocalVariableElement get element; @@ -2582,14 +2209,6 @@ abstract class DeclaredIdentifier extends Declaration { * Clients may not extend, implement or mix-in this class. */ 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. @@ -2671,20 +2290,6 @@ abstract class Directive extends AnnotatedNode { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -2766,11 +2371,6 @@ abstract class DoStatement extends Statement { * Clients may not extend, implement or mix-in this class. */ abstract class DottedName extends AstNode { - /** - * Initialize a newly created dotted name. - */ - factory DottedName(List components) = DottedNameImpl; - /** * Return the components of the identifier. */ @@ -2790,11 +2390,6 @@ abstract class DottedName extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -2826,11 +2421,6 @@ abstract class DoubleLiteral extends Literal { * Clients may not extend, implement or mix-in this class. */ 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. @@ -2853,11 +2443,6 @@ abstract class EmptyFunctionBody extends FunctionBody { * Clients may not extend, implement or mix-in this class. */ abstract class EmptyStatement extends Statement { - /** - * Initialize a newly created empty statement. - */ - factory EmptyStatement(Token semicolon) = EmptyStatementImpl; - /** * Return the semicolon terminating the statement. */ @@ -2875,16 +2460,6 @@ abstract class EmptyStatement extends Statement { * Clients may not extend, implement or mix-in this class. */ 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 metadata, SimpleIdentifier name) => - new EnumConstantDeclarationImpl(comment, metadata, name); - /** * Return the name of the constant. */ @@ -2905,23 +2480,6 @@ abstract class EnumConstantDeclaration extends Declaration { * Clients may not extend, implement or mix-in this class. */ 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 metadata, - Token enumKeyword, - SimpleIdentifier name, - Token leftBracket, - List constants, - Token rightBracket) => - new EnumDeclarationImpl(comment, metadata, enumKeyword, name, leftBracket, - constants, rightBracket); - /** * Return the enumeration constants being declared. */ @@ -2969,24 +2527,7 @@ abstract class EnumDeclaration extends NamedCompilationUnitMember { * * Clients may not extend, implement or mix-in this class. */ -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 metadata, - Token keyword, - StringLiteral libraryUri, - List configurations, - List combinators, - Token semicolon) => - new ExportDirectiveImpl(comment, metadata, keyword, libraryUri, - configurations, combinators, semicolon); -} +abstract class ExportDirective extends NamespaceDirective {} /** * A node that represents an expression. @@ -3098,16 +2639,6 @@ abstract class Expression extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -3156,12 +2687,6 @@ abstract class ExpressionFunctionBody extends FunctionBody { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -3193,12 +2718,6 @@ abstract class ExpressionStatement extends Statement { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -3229,21 +2748,6 @@ abstract class ExtendsClause extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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 metadata, - Token staticKeyword, - VariableDeclarationList fieldList, - Token semicolon) => - new FieldDeclarationImpl( - comment, metadata, staticKeyword, fieldList, semicolon); - /** * Return the fields being declared. */ @@ -3291,28 +2795,6 @@ abstract class FieldDeclaration extends ClassMember { * Clients may not extend, implement or mix-in this class. */ 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 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. @@ -3393,54 +2875,6 @@ abstract class FieldFormalParameter extends NormalFormalParameter { * Clients may not extend, implement or mix-in this class. */ 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. @@ -3611,18 +3045,6 @@ abstract class FormalParameter extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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 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. @@ -3696,35 +3118,6 @@ abstract class FormalParameterList extends AstNode { * Clients may not extend, implement or mix-in this class. */ 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 updaters, - Token rightParenthesis, - Statement body) => - new ForStatementImpl( - forKeyword, - leftParenthesis, - variableList, - initialization, - leftSeparator, - condition, - rightSeparator, - updaters, - rightParenthesis, - body); - /** * Return the body of the loop. */ @@ -3905,25 +3298,6 @@ 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 metadata, - Token externalKeyword, - TypeName returnType, - Token propertyKeyword, - SimpleIdentifier name, - FunctionExpression functionExpression) => - new FunctionDeclarationImpl(comment, metadata, externalKeyword, - returnType, propertyKeyword, name, functionExpression); - @override ExecutableElement get element; @@ -3988,13 +3362,6 @@ abstract class FunctionDeclaration extends NamedCompilationUnitMember { * Clients may not extend, implement or mix-in this class. */ abstract class FunctionDeclarationStatement extends Statement { - /** - * Initialize a newly created function declaration statement. - */ - factory FunctionDeclarationStatement( - FunctionDeclaration functionDeclaration) = - FunctionDeclarationStatementImpl; - /** * Return the function declaration being wrapped. */ @@ -4016,13 +3383,6 @@ abstract class FunctionDeclarationStatement extends Statement { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -4080,14 +3440,6 @@ abstract class FunctionExpression extends Expression { * Clients may not extend, implement or mix-in this class. */ 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]. */ @@ -4159,25 +3511,6 @@ abstract class FunctionExpressionInvocation extends InvocationExpression { * Clients may not extend, implement or mix-in this class. */ 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 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. */ @@ -4223,23 +3556,6 @@ abstract class FunctionTypeAlias extends TypeAlias { * Clients may not extend, implement or mix-in this class. */ 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 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. */ @@ -4297,12 +3613,6 @@ abstract class FunctionTypedFormalParameter extends NormalFormalParameter { * Clients may not extend, implement or mix-in this class. */ abstract class HideCombinator extends Combinator { - /** - * Initialize a newly created import show combinator. - */ - factory HideCombinator(Token keyword, List hiddenNames) = - HideCombinatorImpl; - /** * Return the list of names from the library that are hidden by this * combinator. @@ -4367,21 +3677,6 @@ abstract class Identifier extends Expression { * Clients may not extend, implement or mix-in this class. */ 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. @@ -4468,12 +3763,6 @@ abstract class IfStatement extends Statement { * Clients may not extend, implement or mix-in this class. */ abstract class ImplementsClause extends AstNode { - /** - * Initialize a newly created implements clause. - */ - factory ImplementsClause(Token implementsKeyword, List interfaces) = - ImplementsClauseImpl; - /** * Return the token representing the 'implements' keyword. */ @@ -4605,38 +3894,6 @@ 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 metadata, - Token keyword, - StringLiteral libraryUri, - List configurations, - Token deferredKeyword, - Token asKeyword, - SimpleIdentifier prefix, - List 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. @@ -4681,22 +3938,6 @@ 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 @@ -4815,14 +4056,6 @@ 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. */ @@ -4879,11 +4112,6 @@ abstract class InstanceCreationExpression extends Expression * Clients may not extend, implement or mix-in this class. */ abstract class IntegerLiteral extends Literal { - /** - * Initialize a newly created integer literal. - */ - factory IntegerLiteral(Token literal, int value) = IntegerLiteralImpl; - /** * Return the token representing the literal. */ @@ -4926,13 +4154,6 @@ abstract class InterpolationElement extends AstNode {} * Clients may not extend, implement or mix-in this class. */ 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. @@ -4980,13 +4201,6 @@ abstract class InterpolationExpression extends InterpolationElement { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -5094,14 +4308,6 @@ abstract class InvocationExpression extends Expression { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -5153,12 +4359,6 @@ abstract class IsExpression extends Expression { * Clients may not extend, implement or mix-in this class. */ 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. */ @@ -5190,12 +4390,6 @@ abstract class Label extends AstNode { * Clients may not extend, implement or mix-in this class. */ abstract class LabeledStatement extends Statement { - /** - * Initialize a newly created labeled statement. - */ - factory LabeledStatement(List