blob: 044f2fbccb905c5f13e1aa3786a839a41e8aa5db [file] [log] [blame]
// This code was auto-generated, is not intended to be edited, and is subject to
// significant change. Please see the README file for more information.
library engine.ast;
import 'dart:collection';
import 'java_core.dart';
import 'java_engine.dart';
import 'error.dart';
import 'source.dart' show LineInfo;
import 'scanner.dart';
import 'engine.dart' show AnalysisEngine;
import 'utilities_dart.dart';
import 'element.dart' hide Annotation;
/**
* The abstract class {@code ASTNode} defines the behavior common to all nodes in the AST structure
* for a Dart program.
* @coverage dart.engine.ast
*/
abstract class ASTNode {
/**
* The parent of the node, or {@code null} if the node is the root of an AST structure.
*/
ASTNode _parent;
/**
* A table mapping the names of properties to their values, or {@code null} if this node does not
* have any properties associated with it.
*/
Map<String, Object> _propertyMap;
/**
* A comparator that can be used to sort AST nodes in lexical order. In other words,{@code compare} will return a negative value if the offset of the first node is less than the
* offset of the second node, zero (0) if the nodes have the same offset, and a positive value if
* if the offset of the first node is greater than the offset of the second node.
*/
static Comparator<ASTNode> LEXICAL_ORDER = (ASTNode first, ASTNode second) => second.offset - first.offset;
/**
* Use the given visitor to visit this node.
* @param visitor the visitor that will visit this node
* @return the value returned by the visitor as a result of visiting this node
*/
accept(ASTVisitor visitor);
/**
* @return the {@link ASTNode} of given {@link Class} which is {@link ASTNode} itself, or one of
* its parents.
*/
ASTNode getAncestor(Type enclosingClass) {
ASTNode node = this;
while (node != null && !isInstanceOf(node, enclosingClass)) {
node = node.parent;
}
;
return node as ASTNode;
}
/**
* Return the first token included in this node's source range.
* @return the first token included in this node's source range
*/
Token get beginToken;
/**
* Return the offset of the character immediately following the last character of this node's
* source range. This is equivalent to {@code node.getOffset() + node.getLength()}. For a
* compilation unit this will be equal to the length of the unit's source. For synthetic nodes
* this will be equivalent to the node's offset (because the length is zero (0) by definition).
* @return the offset of the character just past the node's source range
*/
int get end => offset + length;
/**
* Return the last token included in this node's source range.
* @return the last token included in this node's source range
*/
Token get endToken;
/**
* Return the number of characters in the node's source range.
* @return the number of characters in the node's source range
*/
int get length {
Token beginToken2 = beginToken;
Token endToken2 = endToken;
if (beginToken2 == null || endToken2 == null) {
return -1;
}
return endToken2.offset + endToken2.length - beginToken2.offset;
}
/**
* Return the offset from the beginning of the file to the first character in the node's source
* range.
* @return the offset from the beginning of the file to the first character in the node's source
* range
*/
int get offset {
Token beginToken2 = beginToken;
if (beginToken2 == null) {
return -1;
}
return beginToken.offset;
}
/**
* Return this node's parent node, or {@code null} if this node is the root of an AST structure.
* <p>
* Note that the relationship between an AST node and its parent node may change over the lifetime
* of a node.
* @return the parent of this node, or {@code null} if none
*/
ASTNode get parent => _parent;
/**
* Return the value of the property with the given name, or {@code null} if this node does not
* have a property with the given name.
* @return the value of the property with the given name
*/
Object getProperty(String propertyName) {
if (_propertyMap == null) {
return null;
}
return _propertyMap[propertyName];
}
/**
* Return the node at the root of this node's AST structure. Note that this method's performance
* is linear with respect to the depth of the node in the AST structure (O(depth)).
* @return the node at the root of this node's AST structure
*/
ASTNode get root {
ASTNode root = this;
ASTNode parent2 = parent;
while (parent2 != null) {
root = parent2;
parent2 = root.parent;
}
return root;
}
/**
* Return {@code true} if this node is a synthetic node. A synthetic node is a node that was
* introduced by the parser in order to recover from an error in the code. Synthetic nodes always
* have a length of zero ({@code 0}).
* @return {@code true} if this node is a synthetic node
*/
bool isSynthetic() => false;
/**
* Set the value of the property with the given name to the given value. If the value is{@code null}, the property will effectively be removed.
* @param propertyName the name of the property whose value is to be set
* @param propertyValue the new value of the property
*/
void setProperty(String propertyName, Object propertyValue) {
if (propertyValue == null) {
if (_propertyMap != null) {
_propertyMap.remove(propertyName);
if (_propertyMap.isEmpty) {
_propertyMap = null;
}
}
} else {
if (_propertyMap == null) {
_propertyMap = new Map<String, Object>();
}
_propertyMap[propertyName] = propertyValue;
}
}
/**
* Return a textual description of this node in a form approximating valid source. The returned
* string will not be valid source primarily in the case where the node itself is not well-formed.
* @return the source code equivalent of this node
*/
String toSource() {
PrintStringWriter writer = new PrintStringWriter();
accept(new ToSourceVisitor(writer));
return writer.toString();
}
String toString() => toSource();
/**
* Use the given visitor to visit all of the children of this node. The children will be visited
* in source order.
* @param visitor the visitor that will be used to visit the children of this node
*/
void visitChildren(ASTVisitor<Object> visitor);
/**
* Make this node the parent of the given child node.
* @param child the node that will become a child of this node
* @return the node that was made a child of this node
*/
ASTNode becomeParentOf(ASTNode child) {
if (child != null) {
ASTNode node = child;
node.parent = this;
}
return child;
}
/**
* If the given child is not {@code null}, use the given visitor to visit it.
* @param child the child to be visited
* @param visitor the visitor that will be used to visit the child
*/
void safelyVisitChild(ASTNode child, ASTVisitor<Object> visitor) {
if (child != null) {
child.accept(visitor);
}
}
/**
* Set the parent of this node to the given node.
* @param newParent the node that is to be made the parent of this node
*/
void set parent(ASTNode newParent) {
_parent = newParent;
}
static int _hashCodeGenerator = 0;
final int hashCode = ++_hashCodeGenerator;
}
/**
* The interface {@code ASTVisitor} defines the behavior of objects that can be used to visit an AST
* structure.
* @coverage dart.engine.ast
*/
abstract class ASTVisitor<R> {
R visitAdjacentStrings(AdjacentStrings node);
R visitAnnotation(Annotation node);
R visitArgumentDefinitionTest(ArgumentDefinitionTest node);
R visitArgumentList(ArgumentList node);
R visitAsExpression(AsExpression node);
R visitAssertStatement(AssertStatement assertStatement);
R visitAssignmentExpression(AssignmentExpression node);
R visitBinaryExpression(BinaryExpression node);
R visitBlock(Block node);
R visitBlockFunctionBody(BlockFunctionBody node);
R visitBooleanLiteral(BooleanLiteral node);
R visitBreakStatement(BreakStatement node);
R visitCascadeExpression(CascadeExpression node);
R visitCatchClause(CatchClause node);
R visitClassDeclaration(ClassDeclaration node);
R visitClassTypeAlias(ClassTypeAlias node);
R visitComment(Comment node);
R visitCommentReference(CommentReference node);
R visitCompilationUnit(CompilationUnit node);
R visitConditionalExpression(ConditionalExpression node);
R visitConstructorDeclaration(ConstructorDeclaration node);
R visitConstructorFieldInitializer(ConstructorFieldInitializer node);
R visitConstructorName(ConstructorName node);
R visitContinueStatement(ContinueStatement node);
R visitDeclaredIdentifier(DeclaredIdentifier node);
R visitDefaultFormalParameter(DefaultFormalParameter node);
R visitDoStatement(DoStatement node);
R visitDoubleLiteral(DoubleLiteral node);
R visitEmptyFunctionBody(EmptyFunctionBody node);
R visitEmptyStatement(EmptyStatement node);
R visitExportDirective(ExportDirective node);
R visitExpressionFunctionBody(ExpressionFunctionBody node);
R visitExpressionStatement(ExpressionStatement node);
R visitExtendsClause(ExtendsClause node);
R visitFieldDeclaration(FieldDeclaration node);
R visitFieldFormalParameter(FieldFormalParameter node);
R visitForEachStatement(ForEachStatement node);
R visitFormalParameterList(FormalParameterList node);
R visitForStatement(ForStatement node);
R visitFunctionDeclaration(FunctionDeclaration node);
R visitFunctionDeclarationStatement(FunctionDeclarationStatement node);
R visitFunctionExpression(FunctionExpression node);
R visitFunctionExpressionInvocation(FunctionExpressionInvocation node);
R visitFunctionTypeAlias(FunctionTypeAlias functionTypeAlias);
R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node);
R visitHideCombinator(HideCombinator node);
R visitIfStatement(IfStatement node);
R visitImplementsClause(ImplementsClause node);
R visitImportDirective(ImportDirective node);
R visitIndexExpression(IndexExpression node);
R visitInstanceCreationExpression(InstanceCreationExpression node);
R visitIntegerLiteral(IntegerLiteral node);
R visitInterpolationExpression(InterpolationExpression node);
R visitInterpolationString(InterpolationString node);
R visitIsExpression(IsExpression node);
R visitLabel(Label node);
R visitLabeledStatement(LabeledStatement node);
R visitLibraryDirective(LibraryDirective node);
R visitLibraryIdentifier(LibraryIdentifier node);
R visitListLiteral(ListLiteral node);
R visitMapLiteral(MapLiteral node);
R visitMapLiteralEntry(MapLiteralEntry node);
R visitMethodDeclaration(MethodDeclaration node);
R visitMethodInvocation(MethodInvocation node);
R visitNamedExpression(NamedExpression node);
R visitNativeFunctionBody(NativeFunctionBody node);
R visitNullLiteral(NullLiteral node);
R visitParenthesizedExpression(ParenthesizedExpression node);
R visitPartDirective(PartDirective node);
R visitPartOfDirective(PartOfDirective node);
R visitPostfixExpression(PostfixExpression node);
R visitPrefixedIdentifier(PrefixedIdentifier node);
R visitPrefixExpression(PrefixExpression node);
R visitPropertyAccess(PropertyAccess node);
R visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node);
R visitRethrowExpression(RethrowExpression node);
R visitReturnStatement(ReturnStatement node);
R visitScriptTag(ScriptTag node);
R visitShowCombinator(ShowCombinator node);
R visitSimpleFormalParameter(SimpleFormalParameter node);
R visitSimpleIdentifier(SimpleIdentifier node);
R visitSimpleStringLiteral(SimpleStringLiteral node);
R visitStringInterpolation(StringInterpolation node);
R visitSuperConstructorInvocation(SuperConstructorInvocation node);
R visitSuperExpression(SuperExpression node);
R visitSwitchCase(SwitchCase node);
R visitSwitchDefault(SwitchDefault node);
R visitSwitchStatement(SwitchStatement node);
R visitThisExpression(ThisExpression node);
R visitThrowExpression(ThrowExpression node);
R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node);
R visitTryStatement(TryStatement node);
R visitTypeArgumentList(TypeArgumentList node);
R visitTypeName(TypeName node);
R visitTypeParameter(TypeParameter node);
R visitTypeParameterList(TypeParameterList node);
R visitVariableDeclaration(VariableDeclaration node);
R visitVariableDeclarationList(VariableDeclarationList node);
R visitVariableDeclarationStatement(VariableDeclarationStatement node);
R visitWhileStatement(WhileStatement node);
R visitWithClause(WithClause node);
}
/**
* Instances of the class {@code AdjacentStrings} represents two or more string literals that are
* implicitly concatenated because of being adjacent (separated only by whitespace).
* <p>
* While the grammar only allows adjacent strings when all of the strings are of the same kind
* (single line or multi-line), this class doesn't enforce that restriction.
* <pre>
* adjacentStrings ::={@link StringLiteral string} {@link StringLiteral string}+
* </pre>
* @coverage dart.engine.ast
*/
class AdjacentStrings extends StringLiteral {
/**
* The strings that are implicitly concatenated.
*/
NodeList<StringLiteral> _strings;
/**
* Initialize a newly created list of adjacent strings.
* @param strings the strings that are implicitly concatenated
*/
AdjacentStrings.full(List<StringLiteral> strings) {
this._strings = new NodeList<StringLiteral>(this);
this._strings.addAll(strings);
}
/**
* Initialize a newly created list of adjacent strings.
* @param strings the strings that are implicitly concatenated
*/
AdjacentStrings({List<StringLiteral> strings}) : this.full(strings);
accept(ASTVisitor visitor) => visitor.visitAdjacentStrings(this);
Token get beginToken => _strings.beginToken;
Token get endToken => _strings.endToken;
/**
* Return the strings that are implicitly concatenated.
* @return the strings that are implicitly concatenated
*/
NodeList<StringLiteral> get strings => _strings;
void visitChildren(ASTVisitor<Object> visitor) {
_strings.accept(visitor);
}
}
/**
* The abstract class {@code AnnotatedNode} defines the behavior of nodes that can be annotated with
* both a comment and metadata.
* @coverage dart.engine.ast
*/
abstract class AnnotatedNode extends ASTNode {
/**
* The documentation comment associated with this node, or {@code null} if this node does not have
* a documentation comment associated with it.
*/
Comment _comment;
/**
* The annotations associated with this node.
*/
NodeList<Annotation> _metadata;
/**
* Initialize a newly created node.
* @param comment the documentation comment associated with this node
* @param metadata the annotations associated with this node
*/
AnnotatedNode.full(Comment comment, List<Annotation> metadata) {
this._metadata = new NodeList<Annotation>(this);
this._comment = becomeParentOf(comment);
this._metadata.addAll(metadata);
}
/**
* Initialize a newly created node.
* @param comment the documentation comment associated with this node
* @param metadata the annotations associated with this node
*/
AnnotatedNode({Comment comment, List<Annotation> metadata}) : this.full(comment, metadata);
Token get beginToken {
if (_comment == null) {
if (_metadata.isEmpty) {
return firstTokenAfterCommentAndMetadata;
} else {
return _metadata.beginToken;
}
} else if (_metadata.isEmpty) {
return _comment.beginToken;
}
Token commentToken = _comment.beginToken;
Token metadataToken = _metadata.beginToken;
if (commentToken.offset < metadataToken.offset) {
return commentToken;
}
return metadataToken;
}
/**
* Return the documentation comment associated with this node, or {@code null} if this node does
* not have a documentation comment associated with it.
* @return the documentation comment associated with this node
*/
Comment get documentationComment => _comment;
/**
* Return the annotations associated with this node.
* @return the annotations associated with this node
*/
NodeList<Annotation> get metadata => _metadata;
/**
* Set the documentation comment associated with this node to the given comment.
* @param comment the documentation comment to be associated with this node
*/
void set documentationComment(Comment comment2) {
this._comment = becomeParentOf(comment2);
}
/**
* Set the metadata associated with this node to the given metadata.
* @param metadata the metadata to be associated with this node
*/
void set metadata(List<Annotation> metadata2) {
this._metadata.clear();
this._metadata.addAll(metadata2);
}
void visitChildren(ASTVisitor<Object> visitor) {
if (commentIsBeforeAnnotations()) {
safelyVisitChild(_comment, visitor);
_metadata.accept(visitor);
} else {
for (ASTNode child in sortedCommentAndAnnotations) {
child.accept(visitor);
}
}
}
/**
* Return the first token following the comment and metadata.
* @return the first token following the comment and metadata
*/
Token get firstTokenAfterCommentAndMetadata;
/**
* Return {@code true} if the comment is lexically before any annotations.
* @return {@code true} if the comment is lexically before any annotations
*/
bool commentIsBeforeAnnotations() {
if (_comment == null || _metadata.isEmpty) {
return true;
}
Annotation firstAnnotation = _metadata[0];
return _comment.offset < firstAnnotation.offset;
}
/**
* Return an array containing the comment and annotations associated with this node, sorted in
* lexical order.
* @return the comment and annotations associated with this node in the order in which they
* appeared in the original source
*/
List<ASTNode> get sortedCommentAndAnnotations {
List<ASTNode> childList = new List<ASTNode>();
childList.add(_comment);
childList.addAll(_metadata);
List<ASTNode> children = new List.from(childList);
children.sort();
return children;
}
}
/**
* Instances of the class {@code Annotation} represent an annotation that can be associated with an
* AST node.
* <pre>
* metadata ::=
* annotation
* annotation ::=
* '@' {@link Identifier qualified} ('.' {@link SimpleIdentifier identifier})? {@link ArgumentList arguments}?
* </pre>
* @coverage dart.engine.ast
*/
class Annotation extends ASTNode {
/**
* The at sign that introduced the annotation.
*/
Token _atSign;
/**
* The name of the class defining the constructor that is being invoked or the name of the field
* that is being referenced.
*/
Identifier _name;
/**
* The period before the constructor name, or {@code null} if this annotation is not the
* invocation of a named constructor.
*/
Token _period;
/**
* The name of the constructor being invoked, or {@code null} if this annotation is not the
* invocation of a named constructor.
*/
SimpleIdentifier _constructorName;
/**
* The arguments to the constructor being invoked, or {@code null} if this annotation is not the
* invocation of a constructor.
*/
ArgumentList _arguments;
/**
* Initialize a newly created annotation.
* @param atSign the at sign that introduced the annotation
* @param name the name of the class defining the constructor that is being invoked or the name of
* the field that is being referenced
* @param period the period before the constructor name, or {@code null} if this annotation is not
* the invocation of a named constructor
* @param constructorName the name of the constructor being invoked, or {@code null} if this
* annotation is not the invocation of a named constructor
* @param arguments the arguments to the constructor being invoked, or {@code null} if this
* annotation is not the invocation of a constructor
*/
Annotation.full(Token atSign, Identifier name, Token period, SimpleIdentifier constructorName, ArgumentList arguments) {
this._atSign = atSign;
this._name = becomeParentOf(name);
this._period = period;
this._constructorName = becomeParentOf(constructorName);
this._arguments = becomeParentOf(arguments);
}
/**
* Initialize a newly created annotation.
* @param atSign the at sign that introduced the annotation
* @param name the name of the class defining the constructor that is being invoked or the name of
* the field that is being referenced
* @param period the period before the constructor name, or {@code null} if this annotation is not
* the invocation of a named constructor
* @param constructorName the name of the constructor being invoked, or {@code null} if this
* annotation is not the invocation of a named constructor
* @param arguments the arguments to the constructor being invoked, or {@code null} if this
* annotation is not the invocation of a constructor
*/
Annotation({Token atSign, Identifier name, Token period, SimpleIdentifier constructorName, ArgumentList arguments}) : this.full(atSign, name, period, constructorName, arguments);
accept(ASTVisitor visitor) => visitor.visitAnnotation(this);
/**
* Return the arguments to the constructor being invoked, or {@code null} if this annotation is
* not the invocation of a constructor.
* @return the arguments to the constructor being invoked
*/
ArgumentList get arguments => _arguments;
/**
* Return the at sign that introduced the annotation.
* @return the at sign that introduced the annotation
*/
Token get atSign => _atSign;
Token get beginToken => _atSign;
/**
* Return the name of the constructor being invoked, or {@code null} if this annotation is not the
* invocation of a named constructor.
* @return the name of the constructor being invoked
*/
SimpleIdentifier get constructorName => _constructorName;
Token get endToken {
if (_arguments != null) {
return _arguments.endToken;
} else if (_constructorName != null) {
return _constructorName.endToken;
}
return _name.endToken;
}
/**
* Return the name of the class defining the constructor that is being invoked or the name of the
* field that is being referenced.
* @return the name of the constructor being invoked or the name of the field being referenced
*/
Identifier get name => _name;
/**
* Return the period before the constructor name, or {@code null} if this annotation is not the
* invocation of a named constructor.
* @return the period before the constructor name
*/
Token get period => _period;
/**
* Set the arguments to the constructor being invoked to the given arguments.
* @param arguments the arguments to the constructor being invoked
*/
void set arguments(ArgumentList arguments2) {
this._arguments = becomeParentOf(arguments2);
}
/**
* Set the at sign that introduced the annotation to the given token.
* @param atSign the at sign that introduced the annotation
*/
void set atSign(Token atSign2) {
this._atSign = atSign2;
}
/**
* Set the name of the constructor being invoked to the given name.
* @param constructorName the name of the constructor being invoked
*/
void set constructorName(SimpleIdentifier constructorName2) {
this._constructorName = becomeParentOf(constructorName2);
}
/**
* Set the name of the class defining the constructor that is being invoked or the name of the
* field that is being referenced to the given name.
* @param name the name of the constructor being invoked or the name of the field being referenced
*/
void set name(Identifier name2) {
this._name = becomeParentOf(name2);
}
/**
* Set the period before the constructor name to the given token.
* @param period the period before the constructor name
*/
void set period(Token period2) {
this._period = period2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_name, visitor);
safelyVisitChild(_constructorName, visitor);
safelyVisitChild(_arguments, visitor);
}
}
/**
* Instances of the class {@code ArgumentDefinitionTest} represent an argument definition test.
* <pre>
* argumentDefinitionTest ::=
* '?' {@link SimpleIdentifier identifier}</pre>
* @coverage dart.engine.ast
*/
class ArgumentDefinitionTest extends Expression {
/**
* The token representing the question mark.
*/
Token _question;
/**
* The identifier representing the argument being tested.
*/
SimpleIdentifier _identifier;
/**
* Initialize a newly created argument definition test.
* @param question the token representing the question mark
* @param identifier the identifier representing the argument being tested
*/
ArgumentDefinitionTest.full(Token question, SimpleIdentifier identifier) {
this._question = question;
this._identifier = becomeParentOf(identifier);
}
/**
* Initialize a newly created argument definition test.
* @param question the token representing the question mark
* @param identifier the identifier representing the argument being tested
*/
ArgumentDefinitionTest({Token question, SimpleIdentifier identifier}) : this.full(question, identifier);
accept(ASTVisitor visitor) => visitor.visitArgumentDefinitionTest(this);
Token get beginToken => _question;
Token get endToken => _identifier.endToken;
/**
* Return the identifier representing the argument being tested.
* @return the identifier representing the argument being tested
*/
SimpleIdentifier get identifier => _identifier;
/**
* Return the token representing the question mark.
* @return the token representing the question mark
*/
Token get question => _question;
/**
* Set the identifier representing the argument being tested to the given identifier.
* @param identifier the identifier representing the argument being tested
*/
void set identifier(SimpleIdentifier identifier2) {
this._identifier = becomeParentOf(identifier2);
}
/**
* Set the token representing the question mark to the given token.
* @param question the token representing the question mark
*/
void set question(Token question2) {
this._question = question2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_identifier, visitor);
}
}
/**
* Instances of the class {@code ArgumentList} represent a list of arguments in the invocation of a
* executable element: a function, method, or constructor.
* <pre>
* argumentList ::=
* '(' arguments? ')'
* arguments ::={@link NamedExpression namedArgument} (',' {@link NamedExpression namedArgument})
* | {@link Expression expressionList} (',' {@link NamedExpression namedArgument})
* </pre>
* @coverage dart.engine.ast
*/
class ArgumentList extends ASTNode {
/**
* The left parenthesis.
*/
Token _leftParenthesis;
/**
* The expressions producing the values of the arguments.
*/
NodeList<Expression> _arguments;
/**
* The right parenthesis.
*/
Token _rightParenthesis;
/**
* An array containing the elements representing the parameters corresponding to each of the
* arguments in this list, or {@code null} if the AST has not been resolved or if the function or
* method being invoked could not be determined. The array must be the same length as the number
* of arguments, but can contain {@code null} entries if a given argument does not correspond to a
* formal parameter.
*/
List<ParameterElement> _correspondingParameters;
/**
* Initialize a newly created list of arguments.
* @param leftParenthesis the left parenthesis
* @param arguments the expressions producing the values of the arguments
* @param rightParenthesis the right parenthesis
*/
ArgumentList.full(Token leftParenthesis, List<Expression> arguments, Token rightParenthesis) {
this._arguments = new NodeList<Expression>(this);
this._leftParenthesis = leftParenthesis;
this._arguments.addAll(arguments);
this._rightParenthesis = rightParenthesis;
}
/**
* Initialize a newly created list of arguments.
* @param leftParenthesis the left parenthesis
* @param arguments the expressions producing the values of the arguments
* @param rightParenthesis the right parenthesis
*/
ArgumentList({Token leftParenthesis, List<Expression> arguments, Token rightParenthesis}) : this.full(leftParenthesis, arguments, rightParenthesis);
accept(ASTVisitor visitor) => visitor.visitArgumentList(this);
/**
* 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.
* @return the expressions producing the values of the arguments
*/
NodeList<Expression> get arguments => _arguments;
Token get beginToken => _leftParenthesis;
Token get endToken => _rightParenthesis;
/**
* Return the left parenthesis.
* @return the left parenthesis
*/
Token get leftParenthesis => _leftParenthesis;
/**
* Return the right parenthesis.
* @return the right parenthesis
*/
Token get rightParenthesis => _rightParenthesis;
/**
* Set the parameter elements corresponding to each of the arguments in this list to the given
* array of parameters. The array of parameters must be the same length as the number of
* arguments, but can contain {@code null} entries if a given argument does not correspond to a
* formal parameter.
* @param parameters the parameter elements corresponding to the arguments
*/
void set correspondingParameters(List<ParameterElement> parameters) {
if (parameters.length != _arguments.length) {
throw new IllegalArgumentException("Expected ${_arguments.length} parameters, not ${parameters.length}");
}
_correspondingParameters = parameters;
}
/**
* Set the left parenthesis to the given token.
* @param parenthesis the left parenthesis
*/
void set leftParenthesis(Token parenthesis) {
_leftParenthesis = parenthesis;
}
/**
* Set the right parenthesis to the given token.
* @param parenthesis the right parenthesis
*/
void set rightParenthesis(Token parenthesis) {
_rightParenthesis = parenthesis;
}
void visitChildren(ASTVisitor<Object> visitor) {
_arguments.accept(visitor);
}
/**
* If the given expression is a child of this list, and the AST structure has been resolved, and
* the function being invoked is known, and the expression corresponds to one of the parameters of
* the function being invoked, then return the parameter element representing the parameter to
* which the value of the given expression will be bound. Otherwise, return {@code null}.
* <p>
* This method is only intended to be used by {@link Expression#getParameterElement()}.
* @param expression the expression corresponding to the parameter to be returned
* @return the parameter element representing the parameter to which the value of the expression
* will be bound
*/
ParameterElement getParameterElementFor(Expression expression) {
if (_correspondingParameters == null) {
return null;
}
int index = _arguments.indexOf(expression);
if (index < 0) {
return null;
}
return _correspondingParameters[index];
}
}
/**
* Instances of the class {@code AsExpression} represent an 'as' expression.
* <pre>
* asExpression ::={@link Expression expression} 'as' {@link TypeName type}</pre>
* @coverage dart.engine.ast
*/
class AsExpression extends Expression {
/**
* The expression used to compute the value being cast.
*/
Expression _expression;
/**
* The as operator.
*/
Token _asOperator;
/**
* The name of the type being cast to.
*/
TypeName _type;
/**
* Initialize a newly created as expression.
* @param expression the expression used to compute the value being cast
* @param isOperator the is operator
* @param type the name of the type being cast to
*/
AsExpression.full(Expression expression, Token isOperator, TypeName type) {
this._expression = becomeParentOf(expression);
this._asOperator = isOperator;
this._type = becomeParentOf(type);
}
/**
* Initialize a newly created as expression.
* @param expression the expression used to compute the value being cast
* @param isOperator the is operator
* @param type the name of the type being cast to
*/
AsExpression({Expression expression, Token isOperator, TypeName type}) : this.full(expression, isOperator, type);
accept(ASTVisitor visitor) => visitor.visitAsExpression(this);
/**
* Return the is operator being applied.
* @return the is operator being applied
*/
Token get asOperator => _asOperator;
Token get beginToken => _expression.beginToken;
Token get endToken => _type.endToken;
/**
* Return the expression used to compute the value being cast.
* @return the expression used to compute the value being cast
*/
Expression get expression => _expression;
/**
* Return the name of the type being cast to.
* @return the name of the type being cast to
*/
TypeName get type => _type;
/**
* Set the is operator being applied to the given operator.
* @param asOperator the is operator being applied
*/
void set asOperator(Token asOperator2) {
this._asOperator = asOperator2;
}
/**
* Set the expression used to compute the value being cast to the given expression.
* @param expression the expression used to compute the value being cast
*/
void set expression(Expression expression2) {
this._expression = becomeParentOf(expression2);
}
/**
* Set the name of the type being cast to to the given name.
* @param name the name of the type being cast to
*/
void set type(TypeName name) {
this._type = becomeParentOf(name);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_expression, visitor);
safelyVisitChild(_type, visitor);
}
}
/**
* Instances of the class {@code AssertStatement} represent an assert statement.
* <pre>
* assertStatement ::=
* 'assert' '(' {@link Expression conditionalExpression} ')' ';'
* </pre>
* @coverage dart.engine.ast
*/
class AssertStatement extends Statement {
/**
* The token representing the 'assert' keyword.
*/
Token _keyword;
/**
* The left parenthesis.
*/
Token _leftParenthesis;
/**
* The condition that is being asserted to be {@code true}.
*/
Expression _condition;
/**
* The right parenthesis.
*/
Token _rightParenthesis;
/**
* The semicolon terminating the statement.
*/
Token _semicolon;
/**
* Initialize a newly created assert statement.
* @param keyword the token representing the 'assert' keyword
* @param leftParenthesis the left parenthesis
* @param condition the condition that is being asserted to be {@code true}
* @param rightParenthesis the right parenthesis
* @param semicolon the semicolon terminating the statement
*/
AssertStatement.full(Token keyword, Token leftParenthesis, Expression condition, Token rightParenthesis, Token semicolon) {
this._keyword = keyword;
this._leftParenthesis = leftParenthesis;
this._condition = becomeParentOf(condition);
this._rightParenthesis = rightParenthesis;
this._semicolon = semicolon;
}
/**
* Initialize a newly created assert statement.
* @param keyword the token representing the 'assert' keyword
* @param leftParenthesis the left parenthesis
* @param condition the condition that is being asserted to be {@code true}
* @param rightParenthesis the right parenthesis
* @param semicolon the semicolon terminating the statement
*/
AssertStatement({Token keyword, Token leftParenthesis, Expression condition, Token rightParenthesis, Token semicolon}) : this.full(keyword, leftParenthesis, condition, rightParenthesis, semicolon);
accept(ASTVisitor visitor) => visitor.visitAssertStatement(this);
Token get beginToken => _keyword;
/**
* Return the condition that is being asserted to be {@code true}.
* @return the condition that is being asserted to be {@code true}
*/
Expression get condition => _condition;
Token get endToken => _semicolon;
/**
* Return the token representing the 'assert' keyword.
* @return the token representing the 'assert' keyword
*/
Token get keyword => _keyword;
/**
* Return the left parenthesis.
* @return the left parenthesis
*/
Token get leftParenthesis => _leftParenthesis;
/**
* Return the right parenthesis.
* @return the right parenthesis
*/
Token get rightParenthesis => _rightParenthesis;
/**
* Return the semicolon terminating the statement.
* @return the semicolon terminating the statement
*/
Token get semicolon => _semicolon;
/**
* Set the condition that is being asserted to be {@code true} to the given expression.
* @param the condition that is being asserted to be {@code true}
*/
void set condition(Expression condition2) {
this._condition = becomeParentOf(condition2);
}
/**
* Set the token representing the 'assert' keyword to the given token.
* @param keyword the token representing the 'assert' keyword
*/
void set keyword(Token keyword2) {
this._keyword = keyword2;
}
/**
* Set the left parenthesis to the given token.
* @param the left parenthesis
*/
void set leftParenthesis(Token leftParenthesis2) {
this._leftParenthesis = leftParenthesis2;
}
/**
* Set the right parenthesis to the given token.
* @param rightParenthesis the right parenthesis
*/
void set rightParenthesis(Token rightParenthesis2) {
this._rightParenthesis = rightParenthesis2;
}
/**
* Set the semicolon terminating the statement to the given token.
* @param semicolon the semicolon terminating the statement
*/
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_condition, visitor);
}
}
/**
* Instances of the class {@code AssignmentExpression} represent an assignment expression.
* <pre>
* assignmentExpression ::={@link Expression leftHandSide} {@link Token operator} {@link Expression rightHandSide}</pre>
* @coverage dart.engine.ast
*/
class AssignmentExpression extends Expression {
/**
* The expression used to compute the left hand side.
*/
Expression _leftHandSide;
/**
* The assignment operator being applied.
*/
Token _operator;
/**
* The expression used to compute the right hand side.
*/
Expression _rightHandSide;
/**
* The element associated with the operator, or {@code null} if the AST structure has not been
* resolved, if the operator is not a compound operator, or if the operator could not be resolved.
*/
MethodElement _element;
/**
* Initialize a newly created assignment expression.
* @param leftHandSide the expression used to compute the left hand side
* @param operator the assignment operator being applied
* @param rightHandSide the expression used to compute the right hand side
*/
AssignmentExpression.full(Expression leftHandSide, Token operator, Expression rightHandSide) {
this._leftHandSide = becomeParentOf(leftHandSide);
this._operator = operator;
this._rightHandSide = becomeParentOf(rightHandSide);
}
/**
* Initialize a newly created assignment expression.
* @param leftHandSide the expression used to compute the left hand side
* @param operator the assignment operator being applied
* @param rightHandSide the expression used to compute the right hand side
*/
AssignmentExpression({Expression leftHandSide, Token operator, Expression rightHandSide}) : this.full(leftHandSide, operator, rightHandSide);
accept(ASTVisitor visitor) => visitor.visitAssignmentExpression(this);
Token get beginToken => _leftHandSide.beginToken;
/**
* Return the element associated with the operator, or {@code null} if the AST structure has not
* been resolved, if the operator is not a compound operator, or if the operator could not be
* resolved. One example of the latter case is an operator that is not defined for the type of the
* left-hand operand.
* @return the element associated with the operator
*/
MethodElement get element => _element;
Token get endToken => _rightHandSide.endToken;
/**
* Set the expression used to compute the left hand side to the given expression.
* @return the expression used to compute the left hand side
*/
Expression get leftHandSide => _leftHandSide;
/**
* Return the assignment operator being applied.
* @return the assignment operator being applied
*/
Token get operator => _operator;
/**
* Return the expression used to compute the right hand side.
* @return the expression used to compute the right hand side
*/
Expression get rightHandSide => _rightHandSide;
/**
* Set the element associated with the operator to the given element.
* @param element the element associated with the operator
*/
void set element(MethodElement element2) {
this._element = element2;
}
/**
* Return the expression used to compute the left hand side.
* @param expression the expression used to compute the left hand side
*/
void set leftHandSide(Expression expression) {
_leftHandSide = becomeParentOf(expression);
}
/**
* Set the assignment operator being applied to the given operator.
* @param operator the assignment operator being applied
*/
void set operator(Token operator2) {
this._operator = operator2;
}
/**
* Set the expression used to compute the left hand side to the given expression.
* @param expression the expression used to compute the left hand side
*/
void set rightHandSide(Expression expression) {
_rightHandSide = becomeParentOf(expression);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_leftHandSide, visitor);
safelyVisitChild(_rightHandSide, visitor);
}
}
/**
* Instances of the class {@code BinaryExpression} represent a binary (infix) expression.
* <pre>
* binaryExpression ::={@link Expression leftOperand} {@link Token operator} {@link Expression rightOperand}</pre>
* @coverage dart.engine.ast
*/
class BinaryExpression extends Expression {
/**
* The expression used to compute the left operand.
*/
Expression _leftOperand;
/**
* The binary operator being applied.
*/
Token _operator;
/**
* The expression used to compute the right operand.
*/
Expression _rightOperand;
/**
* The element associated with the operator, or {@code null} if the AST structure has not been
* resolved, if the operator is not user definable, or if the operator could not be resolved.
*/
MethodElement _element;
/**
* Initialize a newly created binary expression.
* @param leftOperand the expression used to compute the left operand
* @param operator the binary operator being applied
* @param rightOperand the expression used to compute the right operand
*/
BinaryExpression.full(Expression leftOperand, Token operator, Expression rightOperand) {
this._leftOperand = becomeParentOf(leftOperand);
this._operator = operator;
this._rightOperand = becomeParentOf(rightOperand);
}
/**
* Initialize a newly created binary expression.
* @param leftOperand the expression used to compute the left operand
* @param operator the binary operator being applied
* @param rightOperand the expression used to compute the right operand
*/
BinaryExpression({Expression leftOperand, Token operator, Expression rightOperand}) : this.full(leftOperand, operator, rightOperand);
accept(ASTVisitor visitor) => visitor.visitBinaryExpression(this);
Token get beginToken => _leftOperand.beginToken;
/**
* Return the element associated with the operator, or {@code null} if the AST structure has not
* been resolved, if the operator is not user definable, or if the operator could not be resolved.
* One example of the latter case is an operator that is not defined for the type of the left-hand
* operand.
* @return the element associated with the operator
*/
MethodElement get element => _element;
Token get endToken => _rightOperand.endToken;
/**
* Return the expression used to compute the left operand.
* @return the expression used to compute the left operand
*/
Expression get leftOperand => _leftOperand;
/**
* Return the binary operator being applied.
* @return the binary operator being applied
*/
Token get operator => _operator;
/**
* Return the expression used to compute the right operand.
* @return the expression used to compute the right operand
*/
Expression get rightOperand => _rightOperand;
/**
* Set the element associated with the operator to the given element.
* @param element the element associated with the operator
*/
void set element(MethodElement element2) {
this._element = element2;
}
/**
* Set the expression used to compute the left operand to the given expression.
* @param expression the expression used to compute the left operand
*/
void set leftOperand(Expression expression) {
_leftOperand = becomeParentOf(expression);
}
/**
* Set the binary operator being applied to the given operator.
* @return the binary operator being applied
*/
void set operator(Token operator2) {
this._operator = operator2;
}
/**
* Set the expression used to compute the right operand to the given expression.
* @param expression the expression used to compute the right operand
*/
void set rightOperand(Expression expression) {
_rightOperand = becomeParentOf(expression);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_leftOperand, visitor);
safelyVisitChild(_rightOperand, visitor);
}
}
/**
* Instances of the class {@code Block} represent a sequence of statements.
* <pre>
* block ::=
* '{' statement* '}'
* </pre>
* @coverage dart.engine.ast
*/
class Block extends Statement {
/**
* The left curly bracket.
*/
Token _leftBracket;
/**
* The statements contained in the block.
*/
NodeList<Statement> _statements;
/**
* The right curly bracket.
*/
Token _rightBracket;
/**
* Initialize a newly created block of code.
* @param leftBracket the left curly bracket
* @param statements the statements contained in the block
* @param rightBracket the right curly bracket
*/
Block.full(Token leftBracket, List<Statement> statements, Token rightBracket) {
this._statements = new NodeList<Statement>(this);
this._leftBracket = leftBracket;
this._statements.addAll(statements);
this._rightBracket = rightBracket;
}
/**
* Initialize a newly created block of code.
* @param leftBracket the left curly bracket
* @param statements the statements contained in the block
* @param rightBracket the right curly bracket
*/
Block({Token leftBracket, List<Statement> statements, Token rightBracket}) : this.full(leftBracket, statements, rightBracket);
accept(ASTVisitor visitor) => visitor.visitBlock(this);
Token get beginToken => _leftBracket;
Token get endToken => _rightBracket;
/**
* Return the left curly bracket.
* @return the left curly bracket
*/
Token get leftBracket => _leftBracket;
/**
* Return the right curly bracket.
* @return the right curly bracket
*/
Token get rightBracket => _rightBracket;
/**
* Return the statements contained in the block.
* @return the statements contained in the block
*/
NodeList<Statement> get statements => _statements;
/**
* Set the left curly bracket to the given token.
* @param leftBracket the left curly bracket
*/
void set leftBracket(Token leftBracket2) {
this._leftBracket = leftBracket2;
}
/**
* Set the right curly bracket to the given token.
* @param rightBracket the right curly bracket
*/
void set rightBracket(Token rightBracket2) {
this._rightBracket = rightBracket2;
}
void visitChildren(ASTVisitor<Object> visitor) {
_statements.accept(visitor);
}
}
/**
* Instances of the class {@code BlockFunctionBody} represent a function body that consists of a
* block of statements.
* <pre>
* blockFunctionBody ::={@link Block block}</pre>
* @coverage dart.engine.ast
*/
class BlockFunctionBody extends FunctionBody {
/**
* The block representing the body of the function.
*/
Block _block;
/**
* Initialize a newly created function body consisting of a block of statements.
* @param block the block representing the body of the function
*/
BlockFunctionBody.full(Block block) {
this._block = becomeParentOf(block);
}
/**
* Initialize a newly created function body consisting of a block of statements.
* @param block the block representing the body of the function
*/
BlockFunctionBody({Block block}) : this.full(block);
accept(ASTVisitor visitor) => visitor.visitBlockFunctionBody(this);
Token get beginToken => _block.beginToken;
/**
* Return the block representing the body of the function.
* @return the block representing the body of the function
*/
Block get block => _block;
Token get endToken => _block.endToken;
/**
* Set the block representing the body of the function to the given block.
* @param block the block representing the body of the function
*/
void set block(Block block2) {
this._block = becomeParentOf(block2);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_block, visitor);
}
}
/**
* Instances of the class {@code BooleanLiteral} represent a boolean literal expression.
* <pre>
* booleanLiteral ::=
* 'false' | 'true'
* </pre>
* @coverage dart.engine.ast
*/
class BooleanLiteral extends Literal {
/**
* The token representing the literal.
*/
Token _literal;
/**
* The value of the literal.
*/
bool _value = false;
/**
* Initialize a newly created boolean literal.
* @param literal the token representing the literal
* @param value the value of the literal
*/
BooleanLiteral.full(Token literal, bool value) {
this._literal = literal;
this._value = value;
}
/**
* Initialize a newly created boolean literal.
* @param literal the token representing the literal
* @param value the value of the literal
*/
BooleanLiteral({Token literal, bool value}) : this.full(literal, value);
accept(ASTVisitor visitor) => visitor.visitBooleanLiteral(this);
Token get beginToken => _literal;
Token get endToken => _literal;
/**
* Return the token representing the literal.
* @return the token representing the literal
*/
Token get literal => _literal;
/**
* Return the value of the literal.
* @return the value of the literal
*/
bool get value => _value;
bool isSynthetic() => _literal.isSynthetic();
/**
* Set the token representing the literal to the given token.
* @param literal the token representing the literal
*/
void set literal(Token literal2) {
this._literal = literal2;
}
/**
* Set the value of the literal to the given value.
* @param value the value of the literal
*/
void set value(bool value2) {
this._value = value2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
}
/**
* Instances of the class {@code BreakStatement} represent a break statement.
* <pre>
* breakStatement ::=
* 'break' {@link SimpleIdentifier label}? ';'
* </pre>
* @coverage dart.engine.ast
*/
class BreakStatement extends Statement {
/**
* The token representing the 'break' keyword.
*/
Token _keyword;
/**
* The label associated with the statement, or {@code null} if there is no label.
*/
SimpleIdentifier _label;
/**
* The semicolon terminating the statement.
*/
Token _semicolon;
/**
* Initialize a newly created break statement.
* @param keyword the token representing the 'break' keyword
* @param label the label associated with the statement
* @param semicolon the semicolon terminating the statement
*/
BreakStatement.full(Token keyword, SimpleIdentifier label, Token semicolon) {
this._keyword = keyword;
this._label = becomeParentOf(label);
this._semicolon = semicolon;
}
/**
* Initialize a newly created break statement.
* @param keyword the token representing the 'break' keyword
* @param label the label associated with the statement
* @param semicolon the semicolon terminating the statement
*/
BreakStatement({Token keyword, SimpleIdentifier label, Token semicolon}) : this.full(keyword, label, semicolon);
accept(ASTVisitor visitor) => visitor.visitBreakStatement(this);
Token get beginToken => _keyword;
Token get endToken => _semicolon;
/**
* Return the token representing the 'break' keyword.
* @return the token representing the 'break' keyword
*/
Token get keyword => _keyword;
/**
* Return the label associated with the statement, or {@code null} if there is no label.
* @return the label associated with the statement
*/
SimpleIdentifier get label => _label;
/**
* Return the semicolon terminating the statement.
* @return the semicolon terminating the statement
*/
Token get semicolon => _semicolon;
/**
* Set the token representing the 'break' keyword to the given token.
* @param keyword the token representing the 'break' keyword
*/
void set keyword(Token keyword2) {
this._keyword = keyword2;
}
/**
* Set the label associated with the statement to the given identifier.
* @param identifier the label associated with the statement
*/
void set label(SimpleIdentifier identifier) {
_label = becomeParentOf(identifier);
}
/**
* Set the semicolon terminating the statement to the given token.
* @param semicolon the semicolon terminating the statement
*/
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_label, visitor);
}
}
/**
* Instances of the class {@code CascadeExpression} represent a sequence of cascaded expressions:
* expressions that share a common target. There are three kinds of expressions that can be used in
* a cascade expression: {@link IndexExpression}, {@link MethodInvocation} and{@link PropertyAccess}.
* <pre>
* cascadeExpression ::={@link Expression conditionalExpression} cascadeSection
* cascadeSection ::=
* '..' (cascadeSelector arguments*) (assignableSelector arguments*)* (assignmentOperator expressionWithoutCascade)?
* cascadeSelector ::=
* '\[ ' expression '\] '
* | identifier
* </pre>
* @coverage dart.engine.ast
*/
class CascadeExpression extends Expression {
/**
* The target of the cascade sections.
*/
Expression _target;
/**
* The cascade sections sharing the common target.
*/
NodeList<Expression> _cascadeSections;
/**
* Initialize a newly created cascade expression.
* @param target the target of the cascade sections
* @param cascadeSections the cascade sections sharing the common target
*/
CascadeExpression.full(Expression target, List<Expression> cascadeSections) {
this._cascadeSections = new NodeList<Expression>(this);
this._target = becomeParentOf(target);
this._cascadeSections.addAll(cascadeSections);
}
/**
* Initialize a newly created cascade expression.
* @param target the target of the cascade sections
* @param cascadeSections the cascade sections sharing the common target
*/
CascadeExpression({Expression target, List<Expression> cascadeSections}) : this.full(target, cascadeSections);
accept(ASTVisitor visitor) => visitor.visitCascadeExpression(this);
Token get beginToken => _target.beginToken;
/**
* Return the cascade sections sharing the common target.
* @return the cascade sections sharing the common target
*/
NodeList<Expression> get cascadeSections => _cascadeSections;
Token get endToken => _cascadeSections.endToken;
/**
* Return the target of the cascade sections.
* @return the target of the cascade sections
*/
Expression get target => _target;
/**
* Set the target of the cascade sections to the given expression.
* @param target the target of the cascade sections
*/
void set target(Expression target2) {
this._target = becomeParentOf(target2);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_target, visitor);
_cascadeSections.accept(visitor);
}
}
/**
* Instances of the class {@code CatchClause} represent a catch clause within a try statement.
* <pre>
* onPart ::=
* catchPart {@link Block block}| 'on' type catchPart? {@link Block block}catchPart ::=
* 'catch' '(' {@link SimpleIdentifier exceptionParameter} (',' {@link SimpleIdentifier stackTraceParameter})? ')'
* </pre>
* @coverage dart.engine.ast
*/
class CatchClause extends ASTNode {
/**
* The token representing the 'on' keyword, or {@code null} if there is no 'on' keyword.
*/
Token _onKeyword;
/**
* The type of exceptions caught by this catch clause, or {@code null} if this catch clause
* catches every type of exception.
*/
TypeName _exceptionType;
/**
* The token representing the 'catch' keyword, or {@code null} if there is no 'catch' keyword.
*/
Token _catchKeyword;
/**
* The left parenthesis.
*/
Token _leftParenthesis;
/**
* The parameter whose value will be the exception that was thrown.
*/
SimpleIdentifier _exceptionParameter;
/**
* The comma separating the exception parameter from the stack trace parameter.
*/
Token _comma;
/**
* The parameter whose value will be the stack trace associated with the exception.
*/
SimpleIdentifier _stackTraceParameter;
/**
* The right parenthesis.
*/
Token _rightParenthesis;
/**
* The body of the catch block.
*/
Block _body;
/**
* Initialize a newly created catch clause.
* @param onKeyword the token representing the 'on' keyword
* @param exceptionType the type of exceptions caught by this catch clause
* @param leftParenthesis the left parenthesis
* @param exceptionParameter the parameter whose value will be the exception that was thrown
* @param comma the comma separating the exception parameter from the stack trace parameter
* @param stackTraceParameter the parameter whose value will be the stack trace associated with
* the exception
* @param rightParenthesis the right parenthesis
* @param body the body of the catch block
*/
CatchClause.full(Token onKeyword, TypeName exceptionType, Token catchKeyword, Token leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleIdentifier stackTraceParameter, Token rightParenthesis, Block body) {
this._onKeyword = onKeyword;
this._exceptionType = becomeParentOf(exceptionType);
this._catchKeyword = catchKeyword;
this._leftParenthesis = leftParenthesis;
this._exceptionParameter = becomeParentOf(exceptionParameter);
this._comma = comma;
this._stackTraceParameter = becomeParentOf(stackTraceParameter);
this._rightParenthesis = rightParenthesis;
this._body = becomeParentOf(body);
}
/**
* Initialize a newly created catch clause.
* @param onKeyword the token representing the 'on' keyword
* @param exceptionType the type of exceptions caught by this catch clause
* @param leftParenthesis the left parenthesis
* @param exceptionParameter the parameter whose value will be the exception that was thrown
* @param comma the comma separating the exception parameter from the stack trace parameter
* @param stackTraceParameter the parameter whose value will be the stack trace associated with
* the exception
* @param rightParenthesis the right parenthesis
* @param body the body of the catch block
*/
CatchClause({Token onKeyword, TypeName exceptionType, Token catchKeyword, Token leftParenthesis, SimpleIdentifier exceptionParameter, Token comma, SimpleIdentifier stackTraceParameter, Token rightParenthesis, Block body}) : this.full(onKeyword, exceptionType, catchKeyword, leftParenthesis, exceptionParameter, comma, stackTraceParameter, rightParenthesis, body);
accept(ASTVisitor visitor) => visitor.visitCatchClause(this);
Token get beginToken {
if (_onKeyword != null) {
return _onKeyword;
}
return _catchKeyword;
}
/**
* Return the body of the catch block.
* @return the body of the catch block
*/
Block get body => _body;
/**
* Return the token representing the 'catch' keyword, or {@code null} if there is no 'catch'
* keyword.
* @return the token representing the 'catch' keyword
*/
Token get catchKeyword => _catchKeyword;
/**
* Return the comma.
* @return the comma
*/
Token get comma => _comma;
Token get endToken => _body.endToken;
/**
* Return the parameter whose value will be the exception that was thrown.
* @return the parameter whose value will be the exception that was thrown
*/
SimpleIdentifier get exceptionParameter => _exceptionParameter;
/**
* Return the type of exceptions caught by this catch clause, or {@code null} if this catch clause
* catches every type of exception.
* @return the type of exceptions caught by this catch clause
*/
TypeName get exceptionType => _exceptionType;
/**
* Return the left parenthesis.
* @return the left parenthesis
*/
Token get leftParenthesis => _leftParenthesis;
/**
* Return the token representing the 'on' keyword, or {@code null} if there is no 'on' keyword.
* @return the token representing the 'on' keyword
*/
Token get onKeyword => _onKeyword;
/**
* Return the right parenthesis.
* @return the right parenthesis
*/
Token get rightParenthesis => _rightParenthesis;
/**
* Return the parameter whose value will be the stack trace associated with the exception.
* @return the parameter whose value will be the stack trace associated with the exception
*/
SimpleIdentifier get stackTraceParameter => _stackTraceParameter;
/**
* Set the body of the catch block to the given block.
* @param block the body of the catch block
*/
void set body(Block block) {
_body = becomeParentOf(block);
}
/**
* Set the token representing the 'catch' keyword to the given token.
* @param catchKeyword the token representing the 'catch' keyword
*/
void set catchKeyword(Token catchKeyword2) {
this._catchKeyword = catchKeyword2;
}
/**
* Set the comma to the given token.
* @param comma the comma
*/
void set comma(Token comma2) {
this._comma = comma2;
}
/**
* Set the parameter whose value will be the exception that was thrown to the given parameter.
* @param parameter the parameter whose value will be the exception that was thrown
*/
void set exceptionParameter(SimpleIdentifier parameter) {
_exceptionParameter = becomeParentOf(parameter);
}
/**
* Set the type of exceptions caught by this catch clause to the given type.
* @param exceptionType the type of exceptions caught by this catch clause
*/
void set exceptionType(TypeName exceptionType2) {
this._exceptionType = exceptionType2;
}
/**
* Set the left parenthesis to the given token.
* @param parenthesis the left parenthesis
*/
void set leftParenthesis(Token parenthesis) {
_leftParenthesis = parenthesis;
}
/**
* Set the token representing the 'on' keyword to the given keyword.
* @param onKeyword the token representing the 'on' keyword
*/
void set onKeyword(Token onKeyword2) {
this._onKeyword = onKeyword2;
}
/**
* Set the right parenthesis to the given token.
* @param parenthesis the right parenthesis
*/
void set rightParenthesis(Token parenthesis) {
_rightParenthesis = parenthesis;
}
/**
* Set the parameter whose value will be the stack trace associated with the exception to the
* given parameter.
* @param parameter the parameter whose value will be the stack trace associated with the
* exception
*/
void set stackTraceParameter(SimpleIdentifier parameter) {
_stackTraceParameter = becomeParentOf(parameter);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_exceptionType, visitor);
safelyVisitChild(_exceptionParameter, visitor);
safelyVisitChild(_stackTraceParameter, visitor);
safelyVisitChild(_body, visitor);
}
}
/**
* Instances of the class {@code ClassDeclaration} represent the declaration of a class.
* <pre>
* classDeclaration ::=
* 'abstract'? 'class' {@link SimpleIdentifier name} {@link TypeParameterList typeParameterList}?
* ({@link ExtendsClause extendsClause} {@link WithClause withClause}?)?{@link ImplementsClause implementsClause}?
* '{' {@link ClassMember classMember}* '}'
* </pre>
* @coverage dart.engine.ast
*/
class ClassDeclaration extends CompilationUnitMember {
/**
* The 'abstract' keyword, or {@code null} if the keyword was absent.
*/
Token _abstractKeyword;
/**
* The token representing the 'class' keyword.
*/
Token _classKeyword;
/**
* The name of the class being declared.
*/
SimpleIdentifier _name;
/**
* The type parameters for the class, or {@code null} if the class does not have any type
* parameters.
*/
TypeParameterList _typeParameters;
/**
* The extends clause for the class, or {@code null} if the class does not extend any other class.
*/
ExtendsClause _extendsClause;
/**
* The with clause for the class, or {@code null} if the class does not have a with clause.
*/
WithClause _withClause;
/**
* The implements clause for the class, or {@code null} if the class does not implement any
* interfaces.
*/
ImplementsClause _implementsClause;
/**
* The left curly bracket.
*/
Token _leftBracket;
/**
* The members defined by the class.
*/
NodeList<ClassMember> _members;
/**
* The right curly bracket.
*/
Token _rightBracket;
/**
* Initialize a newly created class declaration.
* @param comment the documentation comment associated with this class
* @param metadata the annotations associated with this class
* @param abstractKeyword the 'abstract' keyword, or {@code null} if the keyword was absent
* @param classKeyword the token representing the 'class' keyword
* @param name the name of the class being declared
* @param typeParameters the type parameters for the class
* @param extendsClause the extends clause for the class
* @param withClause the with clause for the class
* @param implementsClause the implements clause for the class
* @param leftBracket the left curly bracket
* @param members the members defined by the class
* @param rightBracket the right curly bracket
*/
ClassDeclaration.full(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) : super.full(comment, metadata) {
this._members = new NodeList<ClassMember>(this);
this._abstractKeyword = abstractKeyword;
this._classKeyword = classKeyword;
this._name = becomeParentOf(name);
this._typeParameters = becomeParentOf(typeParameters);
this._extendsClause = becomeParentOf(extendsClause);
this._withClause = becomeParentOf(withClause);
this._implementsClause = becomeParentOf(implementsClause);
this._leftBracket = leftBracket;
this._members.addAll(members);
this._rightBracket = rightBracket;
}
/**
* Initialize a newly created class declaration.
* @param comment the documentation comment associated with this class
* @param metadata the annotations associated with this class
* @param abstractKeyword the 'abstract' keyword, or {@code null} if the keyword was absent
* @param classKeyword the token representing the 'class' keyword
* @param name the name of the class being declared
* @param typeParameters the type parameters for the class
* @param extendsClause the extends clause for the class
* @param withClause the with clause for the class
* @param implementsClause the implements clause for the class
* @param leftBracket the left curly bracket
* @param members the members defined by the class
* @param rightBracket the right curly bracket
*/
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}) : this.full(comment, metadata, abstractKeyword, classKeyword, name, typeParameters, extendsClause, withClause, implementsClause, leftBracket, members, rightBracket);
accept(ASTVisitor visitor) => visitor.visitClassDeclaration(this);
/**
* Return the 'abstract' keyword, or {@code null} if the keyword was absent.
* @return the 'abstract' keyword
*/
Token get abstractKeyword => _abstractKeyword;
/**
* Return the token representing the 'class' keyword.
* @return the token representing the 'class' keyword
*/
Token get classKeyword => _classKeyword;
ClassElement get element => _name != null ? (_name.element as ClassElement) : null;
Token get endToken => _rightBracket;
/**
* Return the extends clause for this class, or {@code null} if the class does not extend any
* other class.
* @return the extends clause for this class
*/
ExtendsClause get extendsClause => _extendsClause;
/**
* Return the implements clause for the class, or {@code null} if the class does not implement any
* interfaces.
* @return the implements clause for the class
*/
ImplementsClause get implementsClause => _implementsClause;
/**
* Return the left curly bracket.
* @return the left curly bracket
*/
Token get leftBracket => _leftBracket;
/**
* Return the members defined by the class.
* @return the members defined by the class
*/
NodeList<ClassMember> get members => _members;
/**
* Return the name of the class being declared.
* @return the name of the class being declared
*/
SimpleIdentifier get name => _name;
/**
* Return the right curly bracket.
* @return the right curly bracket
*/
Token get rightBracket => _rightBracket;
/**
* Return the type parameters for the class, or {@code null} if the class does not have any type
* parameters.
* @return the type parameters for the class
*/
TypeParameterList get typeParameters => _typeParameters;
/**
* Return the with clause for the class, or {@code null} if the class does not have a with clause.
* @return the with clause for the class
*/
WithClause get withClause => _withClause;
/**
* Set the 'abstract' keyword to the given keyword.
* @param abstractKeyword the 'abstract' keyword
*/
void set abstractKeyword(Token abstractKeyword2) {
this._abstractKeyword = abstractKeyword2;
}
/**
* Set the token representing the 'class' keyword to the given token.
* @param classKeyword the token representing the 'class' keyword
*/
void set classKeyword(Token classKeyword2) {
this._classKeyword = classKeyword2;
}
/**
* Set the extends clause for this class to the given clause.
* @param extendsClause the extends clause for this class
*/
void set extendsClause(ExtendsClause extendsClause2) {
this._extendsClause = becomeParentOf(extendsClause2);
}
/**
* Set the implements clause for the class to the given clause.
* @param implementsClause the implements clause for the class
*/
void set implementsClause(ImplementsClause implementsClause2) {
this._implementsClause = becomeParentOf(implementsClause2);
}
/**
* Set the left curly bracket to the given token.
* @param leftBracket the left curly bracket
*/
void set leftBracket(Token leftBracket2) {
this._leftBracket = leftBracket2;
}
/**
* Set the name of the class being declared to the given identifier.
* @param identifier the name of the class being declared
*/
void set name(SimpleIdentifier identifier) {
_name = becomeParentOf(identifier);
}
/**
* Set the right curly bracket to the given token.
* @param rightBracket the right curly bracket
*/
void set rightBracket(Token rightBracket2) {
this._rightBracket = rightBracket2;
}
/**
* Set the type parameters for the class to the given list of type parameters.
* @param typeParameters the type parameters for the class
*/
void set typeParameters(TypeParameterList typeParameters2) {
this._typeParameters = typeParameters2;
}
/**
* Set the with clause for the class to the given clause.
* @param withClause the with clause for the class
*/
void set withClause(WithClause withClause2) {
this._withClause = becomeParentOf(withClause2);
}
void visitChildren(ASTVisitor<Object> visitor) {
super.visitChildren(visitor);
safelyVisitChild(_name, visitor);
safelyVisitChild(_typeParameters, visitor);
safelyVisitChild(_extendsClause, visitor);
safelyVisitChild(_withClause, visitor);
safelyVisitChild(_implementsClause, visitor);
members.accept(visitor);
}
Token get firstTokenAfterCommentAndMetadata {
if (_abstractKeyword != null) {
return _abstractKeyword;
}
return _classKeyword;
}
}
/**
* The abstract class {@code ClassMember} defines the behavior common to nodes that declare a name
* within the scope of a class.
* @coverage dart.engine.ast
*/
abstract class ClassMember extends Declaration {
/**
* Initialize a newly created member of a class.
* @param comment the documentation comment associated with this member
* @param metadata the annotations associated with this member
*/
ClassMember.full(Comment comment, List<Annotation> metadata) : super.full(comment, metadata) {
}
/**
* Initialize a newly created member of a class.
* @param comment the documentation comment associated with this member
* @param metadata the annotations associated with this member
*/
ClassMember({Comment comment, List<Annotation> metadata}) : this.full(comment, metadata);
}
/**
* Instances of the class {@code ClassTypeAlias} represent a class type alias.
* <pre>
* classTypeAlias ::={@link SimpleIdentifier identifier} {@link TypeParameterList typeParameters}? '=' 'abstract'? mixinApplication
* mixinApplication ::={@link TypeName superclass} {@link WithClause withClause} {@link ImplementsClause implementsClause}? ';'
* </pre>
* @coverage dart.engine.ast
*/
class ClassTypeAlias extends TypeAlias {
/**
* The name of the class being declared.
*/
SimpleIdentifier _name;
/**
* The type parameters for the class, or {@code null} if the class does not have any type
* parameters.
*/
TypeParameterList _typeParameters;
/**
* The token for the '=' separating the name from the definition.
*/
Token _equals;
/**
* The token for the 'abstract' keyword, or {@code null} if this is not defining an abstract
* class.
*/
Token _abstractKeyword;
/**
* The name of the superclass of the class being declared.
*/
TypeName _superclass;
/**
* The with clause for this class.
*/
WithClause _withClause;
/**
* The implements clause for this class, or {@code null} if there is no implements clause.
*/
ImplementsClause _implementsClause;
/**
* Initialize a newly created class type alias.
* @param comment the documentation comment associated with this type alias
* @param metadata the annotations associated with this type alias
* @param keyword the token representing the 'typedef' keyword
* @param name the name of the class being declared
* @param typeParameters the type parameters for the class
* @param equals the token for the '=' separating the name from the definition
* @param abstractKeyword the token for the 'abstract' keyword
* @param superclass the name of the superclass of the class being declared
* @param withClause the with clause for this class
* @param implementsClause the implements clause for this class
* @param semicolon the semicolon terminating the declaration
*/
ClassTypeAlias.full(Comment comment, List<Annotation> metadata, Token keyword, SimpleIdentifier name, TypeParameterList typeParameters, Token equals, Token abstractKeyword, TypeName superclass, WithClause withClause, ImplementsClause implementsClause, Token semicolon) : super.full(comment, metadata, keyword, semicolon) {
this._name = becomeParentOf(name);
this._typeParameters = becomeParentOf(typeParameters);
this._equals = equals;
this._abstractKeyword = abstractKeyword;
this._superclass = becomeParentOf(superclass);
this._withClause = becomeParentOf(withClause);
this._implementsClause = becomeParentOf(implementsClause);
}
/**
* Initialize a newly created class type alias.
* @param comment the documentation comment associated with this type alias
* @param metadata the annotations associated with this type alias
* @param keyword the token representing the 'typedef' keyword
* @param name the name of the class being declared
* @param typeParameters the type parameters for the class
* @param equals the token for the '=' separating the name from the definition
* @param abstractKeyword the token for the 'abstract' keyword
* @param superclass the name of the superclass of the class being declared
* @param withClause the with clause for this class
* @param implementsClause the implements clause for this class
* @param semicolon the semicolon terminating the declaration
*/
ClassTypeAlias({Comment comment, List<Annotation> metadata, Token keyword, SimpleIdentifier name, TypeParameterList typeParameters, Token equals, Token abstractKeyword, TypeName superclass, WithClause withClause, ImplementsClause implementsClause, Token semicolon}) : this.full(comment, metadata, keyword, name, typeParameters, equals, abstractKeyword, superclass, withClause, implementsClause, semicolon);
accept(ASTVisitor visitor) => visitor.visitClassTypeAlias(this);
/**
* Return the token for the 'abstract' keyword, or {@code null} if this is not defining an
* abstract class.
* @return the token for the 'abstract' keyword
*/
Token get abstractKeyword => _abstractKeyword;
ClassElement get element => _name != null ? (_name.element as ClassElement) : null;
/**
* Return the token for the '=' separating the name from the definition.
* @return the token for the '=' separating the name from the definition
*/
Token get equals => _equals;
/**
* Return the implements clause for this class, or {@code null} if there is no implements clause.
* @return the implements clause for this class
*/
ImplementsClause get implementsClause => _implementsClause;
/**
* Return the name of the class being declared.
* @return the name of the class being declared
*/
SimpleIdentifier get name => _name;
/**
* Return the name of the superclass of the class being declared.
* @return the name of the superclass of the class being declared
*/
TypeName get superclass => _superclass;
/**
* Return the type parameters for the class, or {@code null} if the class does not have any type
* parameters.
* @return the type parameters for the class
*/
TypeParameterList get typeParameters => _typeParameters;
/**
* Return the with clause for this class.
* @return the with clause for this class
*/
WithClause get withClause => _withClause;
/**
* Set the token for the 'abstract' keyword to the given token.
* @param abstractKeyword the token for the 'abstract' keyword
*/
void set abstractKeyword(Token abstractKeyword2) {
this._abstractKeyword = abstractKeyword2;
}
/**
* Set the token for the '=' separating the name from the definition to the given token.
* @param equals the token for the '=' separating the name from the definition
*/
void set equals(Token equals2) {
this._equals = equals2;
}
/**
* Set the implements clause for this class to the given implements clause.
* @param implementsClause the implements clause for this class
*/
void set implementsClause(ImplementsClause implementsClause2) {
this._implementsClause = becomeParentOf(implementsClause2);
}
/**
* Set the name of the class being declared to the given identifier.
* @param name the name of the class being declared
*/
void set name(SimpleIdentifier name2) {
this._name = becomeParentOf(name2);
}
/**
* Set the name of the superclass of the class being declared to the given name.
* @param superclass the name of the superclass of the class being declared
*/
void set superclass(TypeName superclass2) {
this._superclass = becomeParentOf(superclass2);
}
/**
* Set the type parameters for the class to the given list of parameters.
* @param typeParameters the type parameters for the class
*/
void set typeParameters(TypeParameterList typeParameters2) {
this._typeParameters = becomeParentOf(typeParameters2);
}
/**
* Set the with clause for this class to the given with clause.
* @param withClause the with clause for this class
*/
void set withClause(WithClause withClause2) {
this._withClause = becomeParentOf(withClause2);
}
void visitChildren(ASTVisitor<Object> visitor) {
super.visitChildren(visitor);
safelyVisitChild(_name, visitor);
safelyVisitChild(_typeParameters, visitor);
safelyVisitChild(_superclass, visitor);
safelyVisitChild(_withClause, visitor);
safelyVisitChild(_implementsClause, visitor);
}
}
/**
* Instances of the class {@code Combinator} represent the combinator associated with an import
* directive.
* <pre>
* combinator ::={@link HideCombinator hideCombinator}| {@link ShowCombinator showCombinator}</pre>
* @coverage dart.engine.ast
*/
abstract class Combinator extends ASTNode {
/**
* The keyword specifying what kind of processing is to be done on the imported names.
*/
Token _keyword;
/**
* Initialize a newly created import combinator.
* @param keyword the keyword specifying what kind of processing is to be done on the imported
* names
*/
Combinator.full(Token keyword) {
this._keyword = keyword;
}
/**
* Initialize a newly created import combinator.
* @param keyword the keyword specifying what kind of processing is to be done on the imported
* names
*/
Combinator({Token keyword}) : this.full(keyword);
Token get beginToken => _keyword;
/**
* Return the keyword specifying what kind of processing is to be done on the imported names.
* @return the keyword specifying what kind of processing is to be done on the imported names
*/
Token get keyword => _keyword;
/**
* Set the keyword specifying what kind of processing is to be done on the imported names to the
* given token.
* @param keyword the keyword specifying what kind of processing is to be done on the imported
* names
*/
void set keyword(Token keyword2) {
this._keyword = keyword2;
}
}
/**
* Instances of the class {@code Comment} represent a comment within the source code.
* <pre>
* comment ::=
* endOfLineComment
* | blockComment
* | documentationComment
* endOfLineComment ::=
* '//' (CHARACTER - EOL)* EOL
* blockComment ::=
* '/ *' CHARACTER* '&#42;/'
* documentationComment ::=
* '/ **' (CHARACTER | {@link CommentReference commentReference})* '&#42;/'
* | ('///' (CHARACTER - EOL)* EOL)+
* </pre>
* @coverage dart.engine.ast
*/
class Comment extends ASTNode {
/**
* Create a block comment.
* @param tokens the tokens representing the comment
* @return the block comment that was created
*/
static Comment createBlockComment(List<Token> tokens) => new Comment.full(tokens, CommentType.BLOCK, null);
/**
* Create a documentation comment.
* @param tokens the tokens representing the comment
* @return the documentation comment that was created
*/
static Comment createDocumentationComment(List<Token> tokens) => new Comment.full(tokens, CommentType.DOCUMENTATION, new List<CommentReference>());
/**
* Create a documentation comment.
* @param tokens the tokens representing the comment
* @param references the references embedded within the documentation comment
* @return the documentation comment that was created
*/
static Comment createDocumentationComment2(List<Token> tokens, List<CommentReference> references) => new Comment.full(tokens, CommentType.DOCUMENTATION, references);
/**
* Create an end-of-line comment.
* @param tokens the tokens representing the comment
* @return the end-of-line comment that was created
*/
static Comment createEndOfLineComment(List<Token> tokens) => new Comment.full(tokens, CommentType.END_OF_LINE, null);
/**
* The tokens representing the comment.
*/
List<Token> _tokens;
/**
* The type of the comment.
*/
CommentType _type;
/**
* The references embedded within the documentation comment. This list will be empty unless this
* is a documentation comment that has references embedded within it.
*/
NodeList<CommentReference> _references;
/**
* Initialize a newly created comment.
* @param tokens the tokens representing the comment
* @param type the type of the comment
* @param references the references embedded within the documentation comment
*/
Comment.full(List<Token> tokens, CommentType type, List<CommentReference> references) {
this._references = new NodeList<CommentReference>(this);
this._tokens = tokens;
this._type = type;
this._references.addAll(references);
}
/**
* Initialize a newly created comment.
* @param tokens the tokens representing the comment
* @param type the type of the comment
* @param references the references embedded within the documentation comment
*/
Comment({List<Token> tokens, CommentType type, List<CommentReference> references}) : this.full(tokens, type, references);
accept(ASTVisitor visitor) => visitor.visitComment(this);
Token get beginToken => _tokens[0];
Token get endToken => _tokens[_tokens.length - 1];
/**
* Return the references embedded within the documentation comment.
* @return the references embedded within the documentation comment
*/
NodeList<CommentReference> get references => _references;
/**
* Return the tokens representing the comment.
* @return the tokens representing the comment
*/
List<Token> get tokens => _tokens;
/**
* Return {@code true} if this is a block comment.
* @return {@code true} if this is a block comment
*/
bool isBlock() => identical(_type, CommentType.BLOCK);
/**
* Return {@code true} if this is a documentation comment.
* @return {@code true} if this is a documentation comment
*/
bool isDocumentation() => identical(_type, CommentType.DOCUMENTATION);
/**
* Return {@code true} if this is an end-of-line comment.
* @return {@code true} if this is an end-of-line comment
*/
bool isEndOfLine() => identical(_type, CommentType.END_OF_LINE);
void visitChildren(ASTVisitor<Object> visitor) {
_references.accept(visitor);
}
}
/**
* The enumeration {@code CommentType} encodes all the different types of comments that are
* recognized by the parser.
*/
class CommentType implements Comparable<CommentType> {
/**
* An end-of-line comment.
*/
static final CommentType END_OF_LINE = new CommentType('END_OF_LINE', 0);
/**
* A block comment.
*/
static final CommentType BLOCK = new CommentType('BLOCK', 1);
/**
* A documentation comment.
*/
static final CommentType DOCUMENTATION = new CommentType('DOCUMENTATION', 2);
static final List<CommentType> values = [END_OF_LINE, BLOCK, DOCUMENTATION];
final String __name;
final int __ordinal;
int get ordinal => __ordinal;
CommentType(this.__name, this.__ordinal) {
}
int compareTo(CommentType other) => __ordinal - other.__ordinal;
String toString() => __name;
}
/**
* Instances of the class {@code CommentReference} represent a reference to a Dart element that is
* found within a documentation comment.
* <pre>
* commentReference ::=
* '\[' 'new'? {@link Identifier identifier} '\]'
* </pre>
* @coverage dart.engine.ast
*/
class CommentReference extends ASTNode {
/**
* The token representing the 'new' keyword, or {@code null} if there was no 'new' keyword.
*/
Token _newKeyword;
/**
* The identifier being referenced.
*/
Identifier _identifier;
/**
* Initialize a newly created reference to a Dart element.
* @param newKeyword the token representing the 'new' keyword
* @param identifier the identifier being referenced
*/
CommentReference.full(Token newKeyword, Identifier identifier) {
this._newKeyword = newKeyword;
this._identifier = becomeParentOf(identifier);
}
/**
* Initialize a newly created reference to a Dart element.
* @param newKeyword the token representing the 'new' keyword
* @param identifier the identifier being referenced
*/
CommentReference({Token newKeyword, Identifier identifier}) : this.full(newKeyword, identifier);
accept(ASTVisitor visitor) => visitor.visitCommentReference(this);
Token get beginToken => _identifier.beginToken;
Token get endToken => _identifier.endToken;
/**
* Return the identifier being referenced.
* @return the identifier being referenced
*/
Identifier get identifier => _identifier;
/**
* Return the token representing the 'new' keyword, or {@code null} if there was no 'new' keyword.
* @return the token representing the 'new' keyword
*/
Token get newKeyword => _newKeyword;
/**
* Set the identifier being referenced to the given identifier.
* @param identifier the identifier being referenced
*/
void set identifier(Identifier identifier2) {
identifier2 = becomeParentOf(identifier2);
}
/**
* Set the token representing the 'new' keyword to the given token.
* @param newKeyword the token representing the 'new' keyword
*/
void set newKeyword(Token newKeyword2) {
this._newKeyword = newKeyword2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_identifier, visitor);
}
}
/**
* Instances of the class {@code CompilationUnit} represent a compilation unit.
* <p>
* While the grammar restricts the order of the directives and declarations within a compilation
* unit, this class does not enforce those restrictions. In particular, the children of a
* compilation unit will be visited in lexical order even if lexical order does not conform to the
* restrictions of the grammar.
* <pre>
* compilationUnit ::=
* directives declarations
* directives ::={@link ScriptTag scriptTag}? {@link LibraryDirective libraryDirective}? namespaceDirective* {@link PartDirective partDirective}| {@link PartOfDirective partOfDirective}namespaceDirective ::={@link ImportDirective importDirective}| {@link ExportDirective exportDirective}declarations ::={@link CompilationUnitMember compilationUnitMember}</pre>
* @coverage dart.engine.ast
*/
class CompilationUnit extends ASTNode {
/**
* The first token in the token stream that was parsed to form this compilation unit.
*/
Token _beginToken;
/**
* The script tag at the beginning of the compilation unit, or {@code null} if there is no script
* tag in this compilation unit.
*/
ScriptTag _scriptTag;
/**
* The directives contained in this compilation unit.
*/
NodeList<Directive> _directives;
/**
* The declarations contained in this compilation unit.
*/
NodeList<CompilationUnitMember> _declarations;
/**
* The last token in the token stream that was parsed to form this compilation unit. This token
* should always have a type of {@link TokenType.EOF}.
*/
Token _endToken;
/**
* The element associated with this compilation unit, or {@code null} if the AST structure has not
* been resolved.
*/
CompilationUnitElement _element;
/**
* The {@link LineInfo} for this {@link CompilationUnit}.
*/
LineInfo _lineInfo;
/**
* The parsing errors encountered when the receiver was parsed.
*/
List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS;
/**
* The resolution errors encountered when the receiver was resolved.
*/
List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS;
/**
* Initialize a newly created compilation unit to have the given directives and declarations.
* @param beginToken the first token in the token stream
* @param scriptTag the script tag at the beginning of the compilation unit
* @param directives the directives contained in this compilation unit
* @param declarations the declarations contained in this compilation unit
* @param endToken the last token in the token stream
*/
CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> directives, List<CompilationUnitMember> declarations, Token endToken) {
this._directives = new NodeList<Directive>(this);
this._declarations = new NodeList<CompilationUnitMember>(this);
this._beginToken = beginToken;
this._scriptTag = becomeParentOf(scriptTag);
this._directives.addAll(directives);
this._declarations.addAll(declarations);
this._endToken = endToken;
}
/**
* Initialize a newly created compilation unit to have the given directives and declarations.
* @param beginToken the first token in the token stream
* @param scriptTag the script tag at the beginning of the compilation unit
* @param directives the directives contained in this compilation unit
* @param declarations the declarations contained in this compilation unit
* @param endToken the last token in the token stream
*/
CompilationUnit({Token beginToken, ScriptTag scriptTag, List<Directive> directives, List<CompilationUnitMember> declarations, Token endToken}) : this.full(beginToken, scriptTag, directives, declarations, endToken);
accept(ASTVisitor visitor) => visitor.visitCompilationUnit(this);
Token get beginToken => _beginToken;
/**
* Return the declarations contained in this compilation unit.
* @return the declarations contained in this compilation unit
*/
NodeList<CompilationUnitMember> get declarations => _declarations;
/**
* Return the directives contained in this compilation unit.
* @return the directives contained in this compilation unit
*/
NodeList<Directive> get directives => _directives;
/**
* Return the element associated with this compilation unit, or {@code null} if the AST structure
* has not been resolved.
* @return the element associated with this compilation unit
*/
CompilationUnitElement get element => _element;
Token get endToken => _endToken;
/**
* Return an array containing all of the errors associated with the receiver. If the receiver has
* not been resolved, then return {@code null}.
* @return an array of errors (contains no {@code null}s) or {@code null} if the receiver has not
* been resolved
*/
List<AnalysisError> get errors {
List<AnalysisError> parserErrors = parsingErrors;
List<AnalysisError> resolverErrors = resolutionErrors;
if (resolverErrors.length == 0) {
return parserErrors;
} else if (parserErrors.length == 0) {
return resolverErrors;
} else {
List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.length + resolverErrors.length);
JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length);
JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, resolverErrors.length);
return allErrors;
}
}
int get length {
Token endToken2 = endToken;
if (endToken2 == null) {
return 0;
}
return endToken2.offset + endToken2.length;
}
/**
* Get the {@link LineInfo} object for this compilation unit.
* @return the associated {@link LineInfo}
*/
LineInfo get lineInfo => _lineInfo;
int get offset => 0;
/**
* Return an array containing all of the parsing errors associated with the receiver.
* @return an array of errors (not {@code null}, contains no {@code null}s).
*/
List<AnalysisError> get parsingErrors => _parsingErrors;
/**
* Return an array containing all of the resolution errors associated with the receiver. If the
* receiver has not been resolved, then return {@code null}.
* @return an array of errors (contains no {@code null}s) or {@code null} if the receiver has not
* been resolved
*/
List<AnalysisError> get resolutionErrors => _resolutionErrors;
/**
* Return the script tag at the beginning of the compilation unit, or {@code null} if there is no
* script tag in this compilation unit.
* @return the script tag at the beginning of the compilation unit
*/
ScriptTag get scriptTag => _scriptTag;
/**
* Set the element associated with this compilation unit to the given element.
* @param element the element associated with this compilation unit
*/
void set element(CompilationUnitElement element2) {
this._element = element2;
}
/**
* Set the {@link LineInfo} object for this compilation unit.
* @param errors LineInfo to associate with this compilation unit
*/
void set lineInfo(LineInfo lineInfo2) {
this._lineInfo = lineInfo2;
}
/**
* Called to cache the parsing errors when the unit is parsed.
* @param errors an array of parsing errors, if {@code null} is passed, the error array is set to
* an empty array, {@link AnalysisError#NO_ERRORS}
*/
void set parsingErrors(List<AnalysisError> errors) {
_parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
}
/**
* Called to cache the resolution errors when the unit is resolved.
* @param errors an array of resolution errors, if {@code null} is passed, the error array is set
* to an empty array, {@link AnalysisError#NO_ERRORS}
*/
void set resolutionErrors(List<AnalysisError> errors) {
_resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
}
/**
* Set the script tag at the beginning of the compilation unit to the given script tag.
* @param scriptTag the script tag at the beginning of the compilation unit
*/
void set scriptTag(ScriptTag scriptTag2) {
this._scriptTag = becomeParentOf(scriptTag2);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_scriptTag, visitor);
if (directivesAreBeforeDeclarations()) {
_directives.accept(visitor);
_declarations.accept(visitor);
} else {
for (ASTNode child in sortedDirectivesAndDeclarations) {
child.accept(visitor);
}
}
}
/**
* Return {@code true} if all of the directives are lexically before any declarations.
* @return {@code true} if all of the directives are lexically before any declarations
*/
bool directivesAreBeforeDeclarations() {
if (_directives.isEmpty || _declarations.isEmpty) {
return true;
}
Directive lastDirective = _directives[_directives.length - 1];
CompilationUnitMember firstDeclaration = _declarations[0];
return lastDirective.offset < firstDeclaration.offset;
}
/**
* Return an array containing all of the directives and declarations in this compilation unit,
* sorted in lexical order.
* @return the directives and declarations in this compilation unit in the order in which they
* appeared in the original source
*/
List<ASTNode> get sortedDirectivesAndDeclarations {
List<ASTNode> childList = new List<ASTNode>();
childList.addAll(_directives);
childList.addAll(_declarations);
List<ASTNode> children = new List.from(childList);
children.sort();
return children;
}
}
/**
* Instances of the class {@code CompilationUnitMember} defines the behavior common to nodes that
* declare a name within the scope of a compilation unit.
* <pre>
* compilationUnitMember ::={@link ClassDeclaration classDeclaration}| {@link TypeAlias typeAlias}| {@link FunctionDeclaration functionDeclaration}| {@link MethodDeclaration getOrSetDeclaration}| {@link VariableDeclaration constantsDeclaration}| {@link VariableDeclaration variablesDeclaration}</pre>
* @coverage dart.engine.ast
*/
abstract class CompilationUnitMember extends Declaration {
/**
* Initialize a newly created generic compilation unit member.
* @param comment the documentation comment associated with this member
* @param metadata the annotations associated with this member
*/
CompilationUnitMember.full(Comment comment, List<Annotation> metadata) : super.full(comment, metadata) {
}
/**
* Initialize a newly created generic compilation unit member.
* @param comment the documentation comment associated with this member
* @param metadata the annotations associated with this member
*/
CompilationUnitMember({Comment comment, List<Annotation> metadata}) : this.full(comment, metadata);
}
/**
* Instances of the class {@code ConditionalExpression} represent a conditional expression.
* <pre>
* conditionalExpression ::={@link Expression condition} '?' {@link Expression thenExpression} ':' {@link Expression elseExpression}</pre>
* @coverage dart.engine.ast
*/
class ConditionalExpression extends Expression {
/**
* The condition used to determine which of the expressions is executed next.
*/
Expression _condition;
/**
* The token used to separate the condition from the then expression.
*/
Token _question;
/**
* The expression that is executed if the condition evaluates to {@code true}.
*/
Expression _thenExpression;
/**
* The token used to separate the then expression from the else expression.
*/
Token _colon;
/**
* The expression that is executed if the condition evaluates to {@code false}.
*/
Expression _elseExpression;
/**
* Initialize a newly created conditional expression.
* @param condition the condition used to determine which expression is executed next
* @param question the token used to separate the condition from the then expression
* @param thenExpression the expression that is executed if the condition evaluates to{@code true}
* @param colon the token used to separate the then expression from the else expression
* @param elseExpression the expression that is executed if the condition evaluates to{@code false}
*/
ConditionalExpression.full(Expression condition, Token question, Expression thenExpression, Token colon, Expression elseExpression) {
this._condition = becomeParentOf(condition);
this._question = question;
this._thenExpression = becomeParentOf(thenExpression);
this._colon = colon;
this._elseExpression = becomeParentOf(elseExpression);
}
/**
* Initialize a newly created conditional expression.
* @param condition the condition used to determine which expression is executed next
* @param question the token used to separate the condition from the then expression
* @param thenExpression the expression that is executed if the condition evaluates to{@code true}
* @param colon the token used to separate the then expression from the else expression
* @param elseExpression the expression that is executed if the condition evaluates to{@code false}
*/
ConditionalExpression({Expression condition, Token question, Expression thenExpression, Token colon, Expression elseExpression}) : this.full(condition, question, thenExpression, colon, elseExpression);
accept(ASTVisitor visitor) => visitor.visitConditionalExpression(this);
Token get beginToken => _condition.beginToken;
/**
* Return the token used to separate the then expression from the else expression.
* @return the token used to separate the then expression from the else expression
*/
Token get colon => _colon;
/**
* Return the condition used to determine which of the expressions is executed next.
* @return the condition used to determine which expression is executed next
*/
Expression get condition => _condition;
/**
* Return the expression that is executed if the condition evaluates to {@code false}.
* @return the expression that is executed if the condition evaluates to {@code false}
*/
Expression get elseExpression => _elseExpression;
Token get endToken => _elseExpression.endToken;
/**
* Return the token used to separate the condition from the then expression.
* @return the token used to separate the condition from the then expression
*/
Token get question => _question;
/**
* Return the expression that is executed if the condition evaluates to {@code true}.
* @return the expression that is executed if the condition evaluates to {@code true}
*/
Expression get thenExpression => _thenExpression;
/**
* Set the token used to separate the then expression from the else expression to the given token.
* @param colon the token used to separate the then expression from the else expression
*/
void set colon(Token colon2) {
this._colon = colon2;
}
/**
* Set the condition used to determine which of the expressions is executed next to the given
* expression.
* @param expression the condition used to determine which expression is executed next
*/
void set condition(Expression expression) {
_condition = becomeParentOf(expression);
}
/**
* Set the expression that is executed if the condition evaluates to {@code false} to the given
* expression.
* @param expression the expression that is executed if the condition evaluates to {@code false}
*/
void set elseExpression(Expression expression) {
_elseExpression = becomeParentOf(expression);
}
/**
* Set the token used to separate the condition from the then expression to the given token.
* @param question the token used to separate the condition from the then expression
*/
void set question(Token question2) {
this._question = question2;
}
/**
* Set the expression that is executed if the condition evaluates to {@code true} to the given
* expression.
* @param expression the expression that is executed if the condition evaluates to {@code true}
*/
void set thenExpression(Expression expression) {
_thenExpression = becomeParentOf(expression);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_condition, visitor);
safelyVisitChild(_thenExpression, visitor);
safelyVisitChild(_elseExpression, visitor);
}
}
/**
* Instances of the class {@code ConstructorDeclaration} represent a constructor declaration.
* <pre>
* constructorDeclaration ::=
* constructorSignature {@link FunctionBody body}?
* | constructorName formalParameterList ':' 'this' ('.' {@link SimpleIdentifier name})? arguments
* constructorSignature ::=
* 'external'? constructorName formalParameterList initializerList?
* | 'external'? 'factory' factoryName formalParameterList initializerList?
* | 'external'? 'const' constructorName formalParameterList initializerList?
* constructorName ::={@link SimpleIdentifier returnType} ('.' {@link SimpleIdentifier name})?
* factoryName ::={@link Identifier returnType} ('.' {@link SimpleIdentifier name})?
* initializerList ::=
* ':' {@link ConstructorInitializer initializer} (',' {@link ConstructorInitializer initializer})
* </pre>
* @coverage dart.engine.ast
*/
class ConstructorDeclaration extends ClassMember {
/**
* The token for the 'external' keyword, or {@code null} if the constructor is not external.
*/
Token _externalKeyword;
/**
* The token for the 'const' keyword, or {@code null} if the constructor is not a const
* constructor.
*/
Token _constKeyword;
/**
* The token for the 'factory' keyword, or {@code null} if the constructor is not a factory
* constructor.
*/
Token _factoryKeyword;
/**
* The type of object being created. This can be different than the type in which the constructor
* is being declared if the constructor is the implementation of a factory constructor.
*/
Identifier _returnType;
/**
* The token for the period before the constructor name, or {@code null} if the constructor being
* declared is unnamed.
*/
Token _period;
/**
* The name of the constructor, or {@code null} if the constructor being declared is unnamed.
*/
SimpleIdentifier _name;
/**
* The element associated with this constructor, or {@code null} if the AST structure has not been
* resolved or if this constructor could not be resolved.
*/
ConstructorElement _element;
/**
* The parameters associated with the constructor.
*/
FormalParameterList _parameters;
/**
* The token for the separator (colon or equals) before the initializers, or {@code null} if there
* are no initializers.
*/
Token _separator;
/**
* The initializers associated with the constructor.
*/
NodeList<ConstructorInitializer> _initializers;
/**
* The name of the constructor to which this constructor will be redirected, or {@code null} if
* this is not a redirecting factory constructor.
*/
ConstructorName _redirectedConstructor;
/**
* The body of the constructor, or {@code null} if the constructor does not have a body.
*/
FunctionBody _body;
/**
* Initialize a newly created constructor declaration.
* @param externalKeyword the token for the 'external' keyword
* @param comment the documentation comment associated with this constructor
* @param metadata the annotations associated with this constructor
* @param constKeyword the token for the 'const' keyword
* @param factoryKeyword the token for the 'factory' keyword
* @param returnType the return type of the constructor
* @param period the token for the period before the constructor name
* @param name the name of the constructor
* @param parameters the parameters associated with the constructor
* @param separator the token for the colon or equals before the initializers
* @param initializers the initializers associated with the constructor
* @param redirectedConstructor the name of the constructor to which this constructor will be
* redirected
* @param body the body of the constructor
*/
ConstructorDeclaration.full(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) : super.full(comment, metadata) {
this._initializers = new NodeList<ConstructorInitializer>(this);
this._externalKeyword = externalKeyword;
this._constKeyword = constKeyword;
this._factoryKeyword = factoryKeyword;
this._returnType = becomeParentOf(returnType);
this._period = period;
this._name = becomeParentOf(name);
this._parameters = becomeParentOf(parameters);
this._separator = separator;
this._initializers.addAll(initializers);
this._redirectedConstructor = becomeParentOf(redirectedConstructor);
this._body = becomeParentOf(body);
}
/**
* Initialize a newly created constructor declaration.
* @param externalKeyword the token for the 'external' keyword
* @param comment the documentation comment associated with this constructor
* @param metadata the annotations associated with this constructor
* @param constKeyword the token for the 'const' keyword
* @param factoryKeyword the token for the 'factory' keyword
* @param returnType the return type of the constructor
* @param period the token for the period before the constructor name
* @param name the name of the constructor
* @param parameters the parameters associated with the constructor
* @param separator the token for the colon or equals before the initializers
* @param initializers the initializers associated with the constructor
* @param redirectedConstructor the name of the constructor to which this constructor will be
* redirected
* @param body the body of the constructor
*/
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}) : this.full(comment, metadata, externalKeyword, constKeyword, factoryKeyword, returnType, period, name, parameters, separator, initializers, redirectedConstructor, body);
accept(ASTVisitor visitor) => visitor.visitConstructorDeclaration(this);
/**
* Return the body of the constructor, or {@code null} if the constructor does not have a body.
* @return the body of the constructor
*/
FunctionBody get body => _body;
/**
* Return the token for the 'const' keyword.
* @return the token for the 'const' keyword
*/
Token get constKeyword => _constKeyword;
ConstructorElement get element => _element;
Token get endToken {
if (_body != null) {
return _body.endToken;
} else if (!_initializers.isEmpty) {
return _initializers.endToken;
}
return _parameters.endToken;
}
/**
* Return the token for the 'external' keyword, or {@code null} if the constructor is not
* external.
* @return the token for the 'external' keyword
*/
Token get externalKeyword => _externalKeyword;
/**
* Return the token for the 'factory' keyword.
* @return the token for the 'factory' keyword
*/
Token get factoryKeyword => _factoryKeyword;
/**
* Return the initializers associated with the constructor.
* @return the initializers associated with the constructor
*/
NodeList<ConstructorInitializer> get initializers => _initializers;
/**
* Return the name of the constructor, or {@code null} if the constructor being declared is
* unnamed.
* @return the name of the constructor
*/
SimpleIdentifier get name => _name;
/**
* Return the parameters associated with the constructor.
* @return the parameters associated with the constructor
*/
FormalParameterList get parameters => _parameters;
/**
* Return the token for the period before the constructor name, or {@code null} if the constructor
* being declared is unnamed.
* @return the token for the period before the constructor name
*/
Token get period => _period;
/**
* Return the name of the constructor to which this constructor will be redirected, or{@code null} if this is not a redirecting factory constructor.
* @return the name of the constructor to which this constructor will be redirected
*/
ConstructorName get redirectedConstructor => _redirectedConstructor;
/**
* Return the type of object being created. This can be different than the type in which the
* constructor is being declared if the constructor is the implementation of a factory
* constructor.
* @return the type of object being created
*/
Identifier get returnType => _returnType;
/**
* Return the token for the separator (colon or equals) before the initializers, or {@code null}if there are no initializers.
* @return the token for the separator (colon or equals) before the initializers
*/
Token get separator => _separator;
/**
* Set the body of the constructor to the given function body.
* @param functionBody the body of the constructor
*/
void set body(FunctionBody functionBody) {
_body = becomeParentOf(functionBody);
}
/**
* Set the token for the 'const' keyword to the given token.
* @param constKeyword the token for the 'const' keyword
*/
void set constKeyword(Token constKeyword2) {
this._constKeyword = constKeyword2;
}
/**
* Set the element associated with this constructor to the given element.
* @param element the element associated with this constructor
*/
void set element(ConstructorElement element2) {
this._element = element2;
}
/**
* Set the token for the 'external' keyword to the given token.
* @param externalKeyword the token for the 'external' keyword
*/
void set externalKeyword(Token externalKeyword2) {
this._externalKeyword = externalKeyword2;
}
/**
* Set the token for the 'factory' keyword to the given token.
* @param factoryKeyword the token for the 'factory' keyword
*/
void set factoryKeyword(Token factoryKeyword2) {
this._factoryKeyword = factoryKeyword2;
}
/**
* Set the name of the constructor to the given identifier.
* @param identifier the name of the constructor
*/
void set name(SimpleIdentifier identifier) {
_name = becomeParentOf(identifier);
}
/**
* Set the parameters associated with the constructor to the given list of parameters.
* @param parameters the parameters associated with the constructor
*/
void set parameters(FormalParameterList parameters2) {
this._parameters = becomeParentOf(parameters2);
}
/**
* Set the token for the period before the constructor name to the given token.
* @param period the token for the period before the constructor name
*/
void set period(Token period2) {
this._period = period2;
}
/**
* Set the name of the constructor to which this constructor will be redirected to the given
* constructor name.
* @param redirectedConstructor the name of the constructor to which this constructor will be
* redirected
*/
void set redirectedConstructor(ConstructorName redirectedConstructor2) {
this._redirectedConstructor = becomeParentOf(redirectedConstructor2);
}
/**
* Set the type of object being created to the given type name.
* @param typeName the type of object being created
*/
void set returnType(Identifier typeName) {
_returnType = becomeParentOf(typeName);
}
/**
* Set the token for the separator (colon or equals) before the initializers to the given token.
* @param separator the token for the separator (colon or equals) before the initializers
*/
void set separator(Token separator2) {
this._separator = separator2;
}
void visitChildren(ASTVisitor<Object> visitor) {
super.visitChildren(visitor);
safelyVisitChild(_returnType, visitor);
safelyVisitChild(_name, visitor);
safelyVisitChild(_parameters, visitor);
_initializers.accept(visitor);
safelyVisitChild(_redirectedConstructor, visitor);
safelyVisitChild(_body, visitor);
}
Token get firstTokenAfterCommentAndMetadata {
Token leftMost2 = leftMost([_externalKeyword, _constKeyword, _factoryKeyword]);
if (leftMost2 != null) {
return leftMost2;
}
return _returnType.beginToken;
}
/**
* Return the left-most of the given tokens, or {@code null} if there are no tokens given or if
* all of the given tokens are {@code null}.
* @param tokens the tokens being compared to find the left-most token
* @return the left-most of the given tokens
*/
Token leftMost(List<Token> tokens) {
Token leftMost = null;
int offset = 2147483647;
for (Token token in tokens) {
if (token != null && token.offset < offset) {
leftMost = token;
}
}
return leftMost;
}
}
/**
* Instances of the class {@code ConstructorFieldInitializer} represent the initialization of a
* field within a constructor's initialization list.
* <pre>
* fieldInitializer ::=
* ('this' '.')? {@link SimpleIdentifier fieldName} '=' {@link Expression conditionalExpression cascadeSection*}</pre>
* @coverage dart.engine.ast
*/
class ConstructorFieldInitializer extends ConstructorInitializer {
/**
* The token for the 'this' keyword, or {@code null} if there is no 'this' keyword.
*/
Token _keyword;
/**
* The token for the period after the 'this' keyword, or {@code null} if there is no 'this'
* keyword.
*/
Token _period;
/**
* The name of the field being initialized.
*/
SimpleIdentifier _fieldName;
/**
* The token for the equal sign between the field name and the expression.
*/
Token _equals;
/**
* The expression computing the value to which the field will be initialized.
*/
Expression _expression;
/**
* Initialize a newly created field initializer to initialize the field with the given name to the
* value of the given expression.
* @param keyword the token for the 'this' keyword
* @param period the token for the period after the 'this' keyword
* @param fieldName the name of the field being initialized
* @param equals the token for the equal sign between the field name and the expression
* @param expression the expression computing the value to which the field will be initialized
*/
ConstructorFieldInitializer.full(Token keyword, Token period, SimpleIdentifier fieldName, Token equals, Expression expression) {
this._keyword = keyword;
this._period = period;
this._fieldName = becomeParentOf(fieldName);
this._equals = equals;
this._expression = becomeParentOf(expression);
}
/**
* Initialize a newly created field initializer to initialize the field with the given name to the
* value of the given expression.
* @param keyword the token for the 'this' keyword
* @param period the token for the period after the 'this' keyword
* @param fieldName the name of the field being initialized
* @param equals the token for the equal sign between the field name and the expression
* @param expression the expression computing the value to which the field will be initialized
*/
ConstructorFieldInitializer({Token keyword, Token period, SimpleIdentifier fieldName, Token equals, Expression expression}) : this.full(keyword, period, fieldName, equals, expression);
accept(ASTVisitor visitor) => visitor.visitConstructorFieldInitializer(this);
Token get beginToken {
if (_keyword != null) {
return _keyword;
}
return _fieldName.beginToken;
}
Token get endToken => _expression.endToken;
/**
* Return the token for the equal sign between the field name and the expression.
* @return the token for the equal sign between the field name and the expression
*/
Token get equals => _equals;
/**
* Return the expression computing the value to which the field will be initialized.
* @return the expression computing the value to which the field will be initialized
*/
Expression get expression => _expression;
/**
* Return the name of the field being initialized.
* @return the name of the field being initialized
*/
SimpleIdentifier get fieldName => _fieldName;
/**
* Return the token for the 'this' keyword, or {@code null} if there is no 'this' keyword.
* @return the token for the 'this' keyword
*/
Token get keyword => _keyword;
/**
* Return the token for the period after the 'this' keyword, or {@code null} if there is no 'this'
* keyword.
* @return the token for the period after the 'this' keyword
*/
Token get period => _period;
/**
* Set the token for the equal sign between the field name and the expression to the given token.
* @param equals the token for the equal sign between the field name and the expression
*/
void set equals(Token equals2) {
this._equals = equals2;
}
/**
* Set the expression computing the value to which the field will be initialized to the given
* expression.
* @param expression the expression computing the value to which the field will be initialized
*/
void set expression(Expression expression2) {
this._expression = becomeParentOf(expression2);
}
/**
* Set the name of the field being initialized to the given identifier.
* @param identifier the name of the field being initialized
*/
void set fieldName(SimpleIdentifier identifier) {
_fieldName = becomeParentOf(identifier);
}
/**
* Set the token for the 'this' keyword to the given token.
* @param keyword the token for the 'this' keyword
*/
void set keyword(Token keyword2) {
this._keyword = keyword2;
}
/**
* Set the token for the period after the 'this' keyword to the given token.
* @param period the token for the period after the 'this' keyword
*/
void set period(Token period2) {
this._period = period2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_fieldName, visitor);
safelyVisitChild(_expression, visitor);
}
}
/**
* Instances of the class {@code ConstructorInitializer} defines the behavior of nodes that can
* occur in the initializer list of a constructor declaration.
* <pre>
* constructorInitializer ::={@link SuperConstructorInvocation superInvocation}| {@link ConstructorFieldInitializer fieldInitializer}</pre>
* @coverage dart.engine.ast
*/
abstract class ConstructorInitializer extends ASTNode {
}
/**
* Instances of the class {@code ConstructorName} represent the name of the constructor.
* <pre>
* constructorName:
* type ('.' identifier)?
* </pre>
* @coverage dart.engine.ast
*/
class ConstructorName extends ASTNode {
/**
* The name of the type defining the constructor.
*/
TypeName _type;
/**
* The token for the period before the constructor name, or {@code null} if the specified
* constructor is the unnamed constructor.
*/
Token _period;
/**
* The name of the constructor, or {@code null} if the specified constructor is the unnamed
* constructor.
*/
SimpleIdentifier _name;
/**
* The element associated with this constructor name, or {@code null} if the AST structure has not
* been resolved or if this constructor name could not be resolved.
*/
ConstructorElement _element;
/**
* Initialize a newly created constructor name.
* @param type the name of the type defining the constructor
* @param period the token for the period before the constructor name
* @param name the name of the constructor
*/
ConstructorName.full(TypeName type, Token period, SimpleIdentifier name) {
this._type = becomeParentOf(type);
this._period = period;
this._name = becomeParentOf(name);
}
/**
* Initialize a newly created constructor name.
* @param type the name of the type defining the constructor
* @param period the token for the period before the constructor name
* @param name the name of the constructor
*/
ConstructorName({TypeName type, Token period, SimpleIdentifier name}) : this.full(type, period, name);
accept(ASTVisitor visitor) => visitor.visitConstructorName(this);
Token get beginToken => _type.beginToken;
/**
* Return the element associated with this constructor name, or {@code null} if the AST structure
* has not been resolved or if this constructor name could not be resolved.
* @return the element associated with this constructor name
*/
ConstructorElement get element => _element;
Token get endToken {
if (_name != null) {
return _name.endToken;
}
return _type.endToken;
}
/**
* Return the name of the constructor, or {@code null} if the specified constructor is the unnamed
* constructor.
* @return the name of the constructor
*/
SimpleIdentifier get name => _name;
/**
* Return the token for the period before the constructor name, or {@code null} if the specified
* constructor is the unnamed constructor.
* @return the token for the period before the constructor name
*/
Token get period => _period;
/**
* Return the name of the type defining the constructor.
* @return the name of the type defining the constructor
*/
TypeName get type => _type;
/**
* Set the element associated with this constructor name to the given element.
* @param element the element associated with this constructor name
*/
void set element(ConstructorElement element2) {
this._element = element2;
}
/**
* Set the name of the constructor to the given name.
* @param name the name of the constructor
*/
void set name(SimpleIdentifier name2) {
this._name = becomeParentOf(name2);
}
/**
* Return the token for the period before the constructor name to the given token.
* @param period the token for the period before the constructor name
*/
void set period(Token period2) {
this._period = period2;
}
/**
* Set the name of the type defining the constructor to the given type name.
* @param type the name of the type defining the constructor
*/
void set type(TypeName type2) {
this._type = becomeParentOf(type2);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_type, visitor);
safelyVisitChild(_name, visitor);
}
}
/**
* Instances of the class {@code ContinueStatement} represent a continue statement.
* <pre>
* continueStatement ::=
* 'continue' {@link SimpleIdentifier label}? ';'
* </pre>
* @coverage dart.engine.ast
*/
class ContinueStatement extends Statement {
/**
* The token representing the 'continue' keyword.
*/
Token _keyword;
/**
* The label associated with the statement, or {@code null} if there is no label.
*/
SimpleIdentifier _label;
/**
* The semicolon terminating the statement.
*/
Token _semicolon;
/**
* Initialize a newly created continue statement.
* @param keyword the token representing the 'continue' keyword
* @param label the label associated with the statement
* @param semicolon the semicolon terminating the statement
*/
ContinueStatement.full(Token keyword