Non-breaking changes to add code-as-ui support
Change-Id: I8a2f0fe4e8e732f866d16e7d349fb21b8dd46194
Reviewed-on: https://dart-review.googlesource.com/c/89923
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 2378850..5fb2d22 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -1308,6 +1308,8 @@
/**
* The declaration of a class or mixin.
+ *
+ * Clients may not extend, implement or mix-in this class.
*/
abstract class ClassOrMixinDeclaration extends NamedCompilationUnitMember {
@override
@@ -1437,6 +1439,42 @@
}
/**
+ * An element in a literal list or literal set.
+ *
+ * collectionElement ::=
+ * [Expression]
+ * | [IfElement<CollectionElement>]
+ * | [ForElement<CollectionElement>]
+ * | [SpreadElement]
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class CollectionElement implements AstNode {}
+
+/**
+ * A for element in a literal list or literal set.
+ *
+ * forElement ::=
+ * 'await'? 'for' '(' [ForLoopParts] ')' [CollectionElement | MapElement]
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class CollectionForElement
+ implements CollectionElement, ForElement<CollectionElement> {}
+
+/**
+ * An if element in a literal list or literal set.
+ *
+ * ifElement ::=
+ * 'if' '(' [Expression] ')' [CollectionElement]
+ * ( 'else' [CollectionElement] )?
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class CollectionIfElement
+ implements CollectionElement, IfElement<CollectionElement> {}
+
+/**
* A combinator associated with an import or export directive.
*
* combinator ::=
@@ -2118,7 +2156,7 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class ConstructorReferenceNode {
+abstract class ConstructorReferenceNode implements AstNode {
/**
* Return the element associated with the referenced constructor based on
* static type information, or `null` if the AST structure has not been
@@ -2623,7 +2661,7 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class Expression extends AstNode {
+abstract class Expression implements CollectionElement {
/**
* An empty list of expressions.
*/
@@ -2981,12 +3019,66 @@
}
/**
+ * The parts of a for-each loop that control the iteration.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ForEachParts implements ForLoopParts {
+ /**
+ * Return the token representing the 'in' keyword.
+ */
+ Token get inKeyword;
+
+ /**
+ * Return the expression evaluated to produce the iterator.
+ */
+ Expression get iterable;
+}
+
+/**
+ * The parts of a for-each loop that control the iteration when the loop
+ * variable is declared as part of the for loop.
+ *
+ * forLoopParts ::=
+ * [DeclaredIdentifier] 'in' [Expression]
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ForEachPartsWithDeclaration implements ForEachParts {
+ /**
+ * Return the declaration of the loop variable.
+ */
+ DeclaredIdentifier get loopVariable;
+}
+
+/**
+ * The parts of a for-each loop that control the iteration when the loop
+ * variable is declared outside of the for loop.
+ *
+ * forLoopParts ::=
+ * [SimpleIdentifier] 'in' [Expression]
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ForEachPartsWithIdentifier implements ForEachParts {
+ /**
+ * Return the loop variable.
+ */
+ SimpleIdentifier get identifier;
+}
+
+/**
* A for-each statement.
*
* forEachStatement ::=
* 'await'? 'for' '(' [DeclaredIdentifier] 'in' [Expression] ')' [Block]
* | 'await'? 'for' '(' [SimpleIdentifier] 'in' [Expression] ')' [Block]
*
+ * This is the class that is used to represent a for-each loop when neither the
+ * 'control-flow-collections' nor 'spread-collections' experiments are enabled.
+ * If either of those experiments are enabled, then [ForStatement2] will be
+ * used.
+ *
* Clients may not extend, implement or mix-in this class.
*/
abstract class ForEachStatement extends Statement {
@@ -3086,6 +3178,60 @@
}
/**
+ * The basic structure of a for element.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ForElement<E> implements AstNode {
+ /**
+ * Return the token representing the 'await' keyword, or `null` if there was
+ * no 'await' keyword.
+ */
+ Token get awaitKeyword;
+
+ /**
+ * Return the body of the loop.
+ */
+ E get body;
+
+ /**
+ * Return the token representing the 'for' keyword.
+ */
+ Token get forKeyword;
+
+ /**
+ * Return the parts of the for element that control the iteration.
+ */
+ ForLoopParts get forLoopParts;
+
+ /**
+ * Return the left parenthesis.
+ */
+ Token get leftParenthesis;
+
+ /**
+ * Return the right parenthesis.
+ */
+ Token get rightParenthesis;
+}
+
+/**
+ * The parts of a for or for-each loop that control the iteration.
+ *
+ * forLoopParts ::=
+ * [VariableDeclaration] ';' [Expression]? ';' expressionList?
+ * | [Expression]? ';' [Expression]? ';' expressionList?
+ * | [DeclaredIdentifier] 'in' [Expression]
+ * | [SimpleIdentifier] 'in' [Expression]
+ *
+ * expressionList ::=
+ * [Expression] (',' [Expression])*
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ForLoopParts implements AstNode {}
+
+/**
* A node representing a parameter to a function.
*
* formalParameter ::=
@@ -3265,6 +3411,71 @@
}
/**
+ * The parts of a for loop that control the iteration.
+ *
+ * forLoopParts ::=
+ * [VariableDeclaration] ';' [Expression]? ';' expressionList?
+ * | [Expression]? ';' [Expression]? ';' expressionList?
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ForParts implements ForLoopParts {
+ /**
+ * Return the condition used to determine when to terminate the loop, or
+ * `null` if there is no condition.
+ */
+ Expression get condition;
+
+ /**
+ * Return the semicolon separating the initializer and the condition.
+ */
+ Token get leftSeparator;
+
+ /**
+ * Return the semicolon separating the condition and the updater.
+ */
+ Token get rightSeparator;
+
+ /**
+ * Return the list of expressions run after each execution of the loop body.
+ */
+ NodeList<Expression> get updaters;
+}
+
+/**
+ * The parts of a for loop that control the iteration when there are one or more
+ * variable declarations as part of the for loop.
+ *
+ * forLoopParts ::=
+ * [VariableDeclarationList] ';' [Expression]? ';' expressionList?
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ForPartsWithDeclarations implements ForParts {
+ /**
+ * Return the declaration of the loop variables.
+ */
+ VariableDeclarationList get variables;
+}
+
+/**
+ * The parts of a for loop that control the iteration when there are no variable
+ * declarations as part of the for loop.
+ *
+ * forLoopParts ::=
+ * [Expression]? ';' [Expression]? ';' expressionList?
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ForPartsWithExpression implements ForParts {
+ /**
+ * Return the initialization expression, or `null` if there is no
+ * initialization expression.
+ */
+ Expression get initialization;
+}
+
+/**
* A for statement.
*
* forStatement ::=
@@ -3277,6 +3488,11 @@
* [DefaultFormalParameter]
* | [Expression]?
*
+ * This is the class that is used to represent a for loop when neither the
+ * 'control-flow-collections' nor 'spread-collections' experiments are enabled.
+ * If either of those experiments are enabled, then [ForStatement2] will be
+ * used.
+ *
* Clients may not extend, implement or mix-in this class.
*/
abstract class ForStatement extends Statement {
@@ -3383,6 +3599,58 @@
}
/**
+ * A for or for-each statement.
+ *
+ * forStatement ::=
+ * 'for' '(' forLoopParts ')' [Statement]
+ *
+ * forLoopParts ::=
+ * [VariableDeclaration] ';' [Expression]? ';' expressionList?
+ * | [Expression]? ';' [Expression]? ';' expressionList?
+ * | [DeclaredIdentifier] 'in' [Expression]
+ * | [SimpleIdentifier] 'in' [Expression]
+ *
+ * This is the class that is used to represent a for loop when either the
+ * 'control-flow-collections' or 'spread-collections' experiments are enabled.
+ * If neither of those experiments are enabled, then either [ForStatement] or
+ * [ForEachStatement] will be used.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ForStatement2 extends Statement {
+ /**
+ * Return the token representing the 'await' keyword, or `null` if there is no
+ * 'await' keyword.
+ */
+ Token get awaitKeyword;
+
+ /**
+ * Return the body of the loop.
+ */
+ Statement get body;
+
+ /**
+ * Return the token representing the 'for' keyword.
+ */
+ Token get forKeyword;
+
+ /**
+ * Return the parts of the for element that control the iteration.
+ */
+ ForLoopParts get forLoopParts;
+
+ /**
+ * Return the left parenthesis.
+ */
+ Token get leftParenthesis;
+
+ /**
+ * Return the right parenthesis.
+ */
+ Token get rightParenthesis;
+}
+
+/**
* A node representing the body of a function or method.
*
* functionBody ::=
@@ -3984,6 +4252,51 @@
}
/**
+ * The basic structure of an if element.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class IfElement<E> implements AstNode {
+ /**
+ * Return the condition used to determine which of the statements is executed
+ * next.
+ */
+ Expression get condition;
+
+ /**
+ * Return the statement that is executed if the condition evaluates to
+ * `false`, or `null` if there is no else statement.
+ */
+ E get elseElement;
+
+ /**
+ * Return the token representing the 'else' keyword, or `null` if there is no
+ * else statement.
+ */
+ Token get elseKeyword;
+
+ /**
+ * Return the token representing the 'if' keyword.
+ */
+ Token get ifKeyword;
+
+ /**
+ * Return the left parenthesis.
+ */
+ Token get leftParenthesis;
+
+ /**
+ * Return the right parenthesis.
+ */
+ Token get rightParenthesis;
+
+ /**
+ * Return the statement that is executed if the condition evaluates to `true`.
+ */
+ E get thenElement;
+}
+
+/**
* An if statement.
*
* ifStatement ::=
@@ -4791,6 +5104,10 @@
* listLiteral ::=
* 'const'? ('<' [TypeAnnotation] '>')? '[' ([Expression] ','?)? ']'
*
+ * This is the class that is used to represent a list literal when neither the
+ * 'control-flow-collections' nor 'spread-collections' experiments are enabled.
+ * If either of those experiments are enabled, then [ListLiteral2] will be used.
+ *
* Clients may not extend, implement or mix-in this class.
*/
abstract class ListLiteral extends TypedLiteral {
@@ -4821,6 +5138,46 @@
}
/**
+ * A list literal.
+ *
+ * listLiteral ::=
+ * 'const'? ('<' [TypeAnnotation] '>')?
+ * '[' ([CollectionLiteralElement] ','?)? ']'
+ *
+ * This is the class that is used to represent a list literal when either the
+ * 'control-flow-collections' or 'spread-collections' experiments are enabled.
+ * If neither of those experiments are enabled, then [ListLiteral] will be used.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ListLiteral2 extends TypedLiteral {
+ /**
+ * Return the expressions used to compute the elements of the list.
+ */
+ NodeList<CollectionElement> get elements;
+
+ /**
+ * Return the left square bracket.
+ */
+ Token get leftBracket;
+
+ /**
+ * Set the left square bracket to the given [token].
+ */
+ void set leftBracket(Token token);
+
+ /**
+ * Return the right square bracket.
+ */
+ Token get rightBracket;
+
+ /**
+ * Set the right square bracket to the given [token].
+ */
+ void set rightBracket(Token token);
+}
+
+/**
* A node that represents a literal expression.
*
* literal ::=
@@ -4837,12 +5194,49 @@
abstract class Literal extends Expression {}
/**
+ * An element in a literal map.
+ *
+ * mapElement ::=
+ * [Expression]
+ * | [IfElement<MapElement>]
+ * | [ForElement<MapElement>]
+ * | [SpreadElement]
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class MapElement implements AstNode {}
+
+/**
+ * A for element in a literal map.
+ *
+ * forElement ::=
+ * 'await'? 'for' '(' [ForLoopParts] ')' [CollectionElement | MapElement]
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class MapForElement implements ForElement<MapElement>, MapElement {}
+
+/**
+ * An if element in a map in a literal map.
+ *
+ * ifElement ::=
+ * 'if' '(' [Expression] ')' [MapElement] ( 'else' [MapElement] )?
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class MapIfElement implements IfElement<MapElement>, MapElement {}
+
+/**
* A literal map.
*
* mapLiteral ::=
* 'const'? ('<' [TypeAnnotation] (',' [TypeAnnotation])* '>')?
* '{' ([MapLiteralEntry] (',' [MapLiteralEntry])* ','?)? '}'
*
+ * This is the class that is used to represent a map literal when neither the
+ * 'control-flow-collections' nor 'spread-collections' experiments are enabled.
+ * If either of those experiments are enabled, then [MapLiteral2] will be used.
+ *
* Clients may not extend, implement or mix-in this class.
*/
abstract class MapLiteral extends TypedLiteral {
@@ -4873,6 +5267,46 @@
}
/**
+ * A literal map.
+ *
+ * mapLiteral ::=
+ * 'const'? ('<' [TypeAnnotation] (',' [TypeAnnotation])* '>')?
+ * '{' ([MapElement] (',' [MapElement])* ','?)? '}'
+ *
+ * This is the class that is used to represent a map literal when either the
+ * 'control-flow-collections' or 'spread-collections' experiments are enabled.
+ * If neither of those experiments are enabled, then [MapLiteral] will be used.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class MapLiteral2 extends TypedLiteral {
+ /**
+ * Return the entries in the map.
+ */
+ NodeList<MapElement> get entries;
+
+ /**
+ * Return the left curly bracket.
+ */
+ Token get leftBracket;
+
+ /**
+ * Set the left curly bracket to the given [token].
+ */
+ void set leftBracket(Token token);
+
+ /**
+ * Return the right curly bracket.
+ */
+ Token get rightBracket;
+
+ /**
+ * Set the right curly bracket to the given [token].
+ */
+ void set rightBracket(Token token);
+}
+
+/**
* A single key/value pair in a map literal.
*
* mapLiteralEntry ::=
@@ -4880,7 +5314,7 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class MapLiteralEntry extends AstNode {
+abstract class MapLiteralEntry implements MapElement {
/**
* Return the expression computing the key with which the value will be
* associated.
@@ -5150,7 +5584,7 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class MethodReferenceExpression {
+abstract class MethodReferenceExpression implements AstNode {
/**
* Return the best element available for this expression. If resolution was
* able to find a better element based on type propagation, that element will
@@ -6067,6 +6501,10 @@
* '{' [Expression] (',' [Expression])* ','? '}'
* | 'const'? ('<' [TypeAnnotation] '>')? '{' '}'
*
+ * This is the class that is used to represent a set literal when neither the
+ * 'control-flow-collections' nor 'spread-collections' experiments are enabled.
+ * If either of those experiments are enabled, then [SetLiteral2] will be used.
+ *
* Clients may not extend, implement or mix-in this class.
*/
abstract class SetLiteral extends TypedLiteral {
@@ -6097,6 +6535,47 @@
}
/**
+ * A literal set.
+ *
+ * setLiteral ::=
+ * 'const'? ('<' [TypeAnnotation] '>')?
+ * '{' [CollectionElement] (',' [CollectionElement])* ','? '}'
+ * | 'const'? ('<' [TypeAnnotation] '>')? '{' '}'
+ *
+ * This is the class that is used to represent a set literal when either the
+ * 'control-flow-collections' or 'spread-collections' experiments are enabled.
+ * If neither of those experiments are enabled, then [SetLiteral] will be used.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class SetLiteral2 extends TypedLiteral {
+ /**
+ * Return the expressions used to compute the elements of the set.
+ */
+ NodeList<CollectionElement> get elements;
+
+ /**
+ * Return the left curly bracket.
+ */
+ Token get leftBracket;
+
+ /**
+ * Set the left curly bracket to the given [token].
+ */
+ void set leftBracket(Token token);
+
+ /**
+ * Return the right curly bracket.
+ */
+ Token get rightBracket;
+
+ /**
+ * Set the right curly bracket to the given [token].
+ */
+ void set rightBracket(Token token);
+}
+
+/**
* A combinator that restricts the names being imported to those in a given list.
*
* showCombinator ::=
@@ -6319,6 +6798,26 @@
}
/**
+ * A spread element.
+ *
+ * spreadElement:
+ * ( '...' | '...?' ) [Expression]
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class SpreadElement implements CollectionElement, MapElement {
+ /**
+ * The expression used to compute the collection being spread.
+ */
+ Expression get expression;
+
+ /**
+ * The spread operator, either '...' or '...?'.
+ */
+ Token get spreadOperator;
+}
+
+/**
* A node that represents a statement.
*
* statement ::=
diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart
index 1a49333..3c4473f 100644
--- a/pkg/analyzer/lib/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/dart/ast/ast_factory.dart
@@ -185,6 +185,30 @@
Token semicolon);
/**
+ * Returns a newly created for element that can be part of a list or set
+ * literal.
+ */
+ CollectionForElement collectionForElement(
+ {Token forKeyword,
+ Token leftParenthesis,
+ ForLoopParts forLoopParts,
+ Token rightParenthesis,
+ CollectionElement body});
+
+ /**
+ * Returns a newly created if element that can be part of a list or set
+ * literal.
+ */
+ CollectionIfElement collectionIfElement(
+ {Token ifKeyword,
+ Token leftParenthesis,
+ Expression condition,
+ Token rightParenthesis,
+ CollectionElement thenElement,
+ Token elseKeyword,
+ CollectionElement elseElement});
+
+ /**
* Returns a newly created reference to a Dart element. The [newKeyword]
* can be `null` if the reference is not to a constructor.
*/
@@ -384,6 +408,7 @@
List<Configuration> configurations,
List<Combinator> combinators,
Token semicolon);
+
/**
* Returns a newly created function body consisting of a block of
* statements. The [keyword] can be `null` if the function body is not an
@@ -474,6 +499,19 @@
FormalParameterList parameters});
/**
+ * Returns a newly created for each part that includes a declaration.
+ */
+ ForEachPartsWithDeclaration forEachPartsWithDeclaration(
+ {DeclaredIdentifier loopVariable, Token inKeyword, Expression iterable});
+
+ /**
+ * Returns a newly created for each part that includes an identifier that is
+ * declared outside of the loop.
+ */
+ ForEachPartsWithIdentifier forEachPartsWithIdentifier(
+ {SimpleIdentifier identifier, Token inKeyword, Expression iterable});
+
+ /**
* Returns a newly created for-each statement whose loop control variable
* is declared internally (in the for-loop part). The [awaitKeyword] can be
* `null` if this is not an asynchronous for loop.
@@ -516,6 +554,26 @@
Token rightParenthesis);
/**
+ * Returns a newly created for part that includes a declaration.
+ */
+ ForPartsWithDeclarations forPartsWithDeclarations(
+ {VariableDeclarationList variables,
+ Token leftSeparator,
+ Expression condition,
+ Token rightSeparator,
+ List<Expression> updaters});
+
+ /**
+ * Returns a newly created for part that includes an expression.
+ */
+ ForPartsWithExpression forPartsWithExpression(
+ {Expression initialization,
+ Token leftSeparator,
+ Expression condition,
+ Token rightSeparator,
+ List<Expression> updaters});
+
+ /**
* Returns a newly created for statement. Either the [variableList] or the
* [initialization] must be `null`. Either the [condition] and the list of
* [updaters] can be `null` if the loop does not have the corresponding
@@ -534,6 +592,16 @@
Statement body);
/**
+ * Returns a newly created for statement.
+ */
+ ForStatement2 forStatement2(
+ {Token forKeyword,
+ Token leftParenthesis,
+ ForLoopParts forLoopParts,
+ Token rightParenthesis,
+ Statement body});
+
+ /**
* Returns a newly created function declaration. Either or both of the
* [comment] and [metadata] can be `null` if the function does not have the
* corresponding attribute. The [externalKeyword] can be `null` if the
@@ -764,6 +832,38 @@
Token leftBracket, List<Expression> elements, Token rightBracket);
/**
+ * Returns a newly created list literal.
+ */
+ ListLiteral2 listLiteral2(
+ {Token constKeyword,
+ TypeArgumentList typeArguments,
+ Token leftBracket,
+ List<CollectionElement> elements,
+ Token rightBracket});
+
+ /**
+ * Returns a newly created for element that can be part of a map literal.
+ */
+ MapForElement mapForElement(
+ {Token forKeyword,
+ Token leftParenthesis,
+ ForLoopParts forLoopParts,
+ Token rightParenthesis,
+ MapElement body});
+
+ /**
+ * Returns a newly created if element that can be part of a map literal.
+ */
+ MapIfElement mapIfElement(
+ {Token ifKeyword,
+ Token leftParenthesis,
+ Expression condition,
+ Token rightParenthesis,
+ MapElement thenElement,
+ Token elseKeyword,
+ MapElement elseElement});
+
+ /**
* Returns a newly created map literal. The [constKeyword] can be `null` if
* the literal is not a constant. The [typeArguments] can be `null` if no type
* arguments were declared. The [entries] can be `null` if the map is empty.
@@ -772,6 +872,16 @@
Token leftBracket, List<MapLiteralEntry> entries, Token rightBracket);
/**
+ * Returns a newly created map literal.
+ */
+ MapLiteral2 mapLiteral2(
+ {Token constKeyword,
+ TypeArgumentList typeArguments,
+ Token leftBracket,
+ List<MapElement> entries,
+ Token rightBracket});
+
+ /**
* Returns a newly created map literal entry.
*/
MapLiteralEntry mapLiteralEntry(
@@ -949,6 +1059,16 @@
Token leftBracket, List<Expression> elements, Token rightBracket);
/**
+ * Returns a newly created set literal.
+ */
+ SetLiteral2 setLiteral2(
+ {Token constKeyword,
+ TypeArgumentList typeArguments,
+ Token leftBracket,
+ List<CollectionElement> elements,
+ Token rightBracket});
+
+ /**
* Returns a newly created import show combinator.
*/
ShowCombinator showCombinator(
@@ -995,6 +1115,11 @@
SimpleStringLiteral simpleStringLiteral(Token literal, String value);
/**
+ * Returns a newly created spread element.
+ */
+ SpreadElement spreadElement({Token spreadOperator, Expression expression});
+
+ /**
* Returns a newly created string interpolation expression.
*/
StringInterpolation stringInterpolation(List<InterpolationElement> elements);
diff --git a/pkg/analyzer/lib/dart/ast/visitor.dart b/pkg/analyzer/lib/dart/ast/visitor.dart
index 53ff333..8812091 100644
--- a/pkg/analyzer/lib/dart/ast/visitor.dart
+++ b/pkg/analyzer/lib/dart/ast/visitor.dart
@@ -205,6 +205,14 @@
@override
R visitClassTypeAlias(ClassTypeAlias node) => visitTypeAlias(node);
+// @override
+ R visitCollectionForElement(CollectionForElement node) =>
+ visitForElement<CollectionElement>(node);
+
+// @override
+ R visitCollectionIfElement(CollectionIfElement node) =>
+ visitIfElement<CollectionElement>(node);
+
R visitCombinator(Combinator node) => visitNode(node);
@override
@@ -298,17 +306,42 @@
R visitFieldFormalParameter(FieldFormalParameter node) =>
visitNormalFormalParameter(node);
+ R visitForEachParts(ForEachParts node) => visitNode(node);
+
+// @override
+ R visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) =>
+ visitForEachParts(node);
+
+// @override
+ R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) =>
+ visitForEachParts(node);
+
@override
R visitForEachStatement(ForEachStatement node) => visitStatement(node);
+ R visitForElement<E>(ForElement<E> node) => visitNode(node);
+
R visitFormalParameter(FormalParameter node) => visitNode(node);
@override
R visitFormalParameterList(FormalParameterList node) => visitNode(node);
+ R visitForParts(ForParts node) => visitNode(node);
+
+// @override
+ R visitForPartsWithDeclarations(ForPartsWithDeclarations node) =>
+ visitForParts(node);
+
+// @override
+ R visitForPartsWithExpression(ForPartsWithExpression node) =>
+ visitForParts(node);
+
@override
R visitForStatement(ForStatement node) => visitStatement(node);
+// @override
+ R visitForStatement2(ForStatement2 node) => visitStatement(node);
+
R visitFunctionBody(FunctionBody node) => visitNode(node);
@override
@@ -345,6 +378,8 @@
R visitIdentifier(Identifier node) => visitExpression(node);
+ R visitIfElement<E>(IfElement<E> node) => visitNode(node);
+
@override
R visitIfStatement(IfStatement node) => visitStatement(node);
@@ -395,11 +430,23 @@
@override
R visitListLiteral(ListLiteral node) => visitTypedLiteral(node);
+// @override
+ R visitListLiteral2(ListLiteral2 node) => visitTypedLiteral(node);
+
R visitLiteral(Literal node) => visitExpression(node);
+// @override
+ R visitMapForElement(MapForElement node) => visitForElement<MapElement>(node);
+
+// @override
+ R visitMapIfElement(MapIfElement node) => visitIfElement<MapElement>(node);
+
@override
R visitMapLiteral(MapLiteral node) => visitTypedLiteral(node);
+// @override
+ R visitMapLiteral2(MapLiteral2 node) => visitTypedLiteral(node);
+
@override
R visitMapLiteralEntry(MapLiteralEntry node) => visitNode(node);
@@ -482,6 +529,9 @@
@override
R visitSetLiteral(SetLiteral node) => visitTypedLiteral(node);
+// @override
+ R visitSetLiteral2(SetLiteral2 node) => visitTypedLiteral(node);
+
@override
R visitShowCombinator(ShowCombinator node) => visitCombinator(node);
@@ -499,6 +549,9 @@
R visitSingleStringLiteral(SingleStringLiteral node) =>
visitStringLiteral(node);
+// @override
+ R visitSpreadElement(SpreadElement node) => visitNode(node);
+
R visitStatement(Statement node) => visitNode(node);
@override
@@ -698,6 +751,18 @@
return null;
}
+// @override
+ R visitCollectionForElement(CollectionForElement node) {
+ node.visitChildren(this);
+ return null;
+ }
+
+// @override
+ R visitCollectionIfElement(CollectionIfElement node) {
+ node.visitChildren(this);
+ return null;
+ }
+
@override
R visitComment(Comment node) {
node.visitChildren(this);
@@ -842,6 +907,18 @@
return null;
}
+// @override
+ R visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) {
+ node.visitChildren(this);
+ return null;
+ }
+
+// @override
+ R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) {
+ node.visitChildren(this);
+ return null;
+ }
+
@override
R visitForEachStatement(ForEachStatement node) {
node.visitChildren(this);
@@ -854,12 +931,30 @@
return null;
}
+// @override
+ R visitForPartsWithDeclarations(ForPartsWithDeclarations node) {
+ node.visitChildren(this);
+ return null;
+ }
+
+// @override
+ R visitForPartsWithExpression(ForPartsWithExpression node) {
+ node.visitChildren(this);
+ return null;
+ }
+
@override
R visitForStatement(ForStatement node) {
node.visitChildren(this);
return null;
}
+// @override
+ R visitForStatement2(ForStatement2 node) {
+ node.visitChildren(this);
+ return null;
+ }
+
@override
R visitFunctionDeclaration(FunctionDeclaration node) {
node.visitChildren(this);
@@ -998,12 +1093,36 @@
return null;
}
+// @override
+ R visitListLiteral2(ListLiteral2 node) {
+ node.visitChildren(this);
+ return null;
+ }
+
+// @override
+ R visitMapForElement(MapForElement node) {
+ node.visitChildren(this);
+ return null;
+ }
+
+// @override
+ R visitMapIfElement(MapIfElement node) {
+ node.visitChildren(this);
+ return null;
+ }
+
@override
R visitMapLiteral(MapLiteral node) {
node.visitChildren(this);
return null;
}
+// @override
+ R visitMapLiteral2(MapLiteral2 node) {
+ node.visitChildren(this);
+ return null;
+ }
+
@override
R visitMapLiteralEntry(MapLiteralEntry node) {
node.visitChildren(this);
@@ -1131,6 +1250,12 @@
return null;
}
+// @override
+ R visitSetLiteral2(SetLiteral2 node) {
+ node.visitChildren(this);
+ return null;
+ }
+
@override
R visitShowCombinator(ShowCombinator node) {
node.visitChildren(this);
@@ -1155,6 +1280,12 @@
return null;
}
+// @override
+ R visitSpreadElement(SpreadElement node) {
+ node.visitChildren(this);
+ return null;
+ }
+
@override
R visitStringInterpolation(StringInterpolation node) {
node.visitChildren(this);
@@ -1342,6 +1473,12 @@
@override
R visitClassTypeAlias(ClassTypeAlias node) => null;
+// @override
+ R visitCollectionForElement(CollectionForElement node) => null;
+
+// @override
+ R visitCollectionIfElement(CollectionIfElement node) => null;
+
@override
R visitComment(Comment node) => null;
@@ -1414,15 +1551,30 @@
@override
R visitFieldFormalParameter(FieldFormalParameter node) => null;
+// @override
+ R visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) => null;
+
+// @override
+ R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) => null;
+
@override
R visitForEachStatement(ForEachStatement node) => null;
@override
R visitFormalParameterList(FormalParameterList node) => null;
+// @override
+ R visitForPartsWithDeclarations(ForPartsWithDeclarations node) => null;
+
+// @override
+ R visitForPartsWithExpression(ForPartsWithExpression node) => null;
+
@override
R visitForStatement(ForStatement node) => null;
+// @override
+ R visitForStatement2(ForStatement2 node) => null;
+
@override
R visitFunctionDeclaration(FunctionDeclaration node) => null;
@@ -1495,9 +1647,21 @@
@override
R visitListLiteral(ListLiteral node) => null;
+// @override
+ R visitListLiteral2(ListLiteral2 node) => null;
+
+// @override
+ R visitMapForElement(MapForElement node) => null;
+
+// @override
+ R visitMapIfElement(MapIfElement node) => null;
+
@override
R visitMapLiteral(MapLiteral node) => null;
+// @override
+ R visitMapLiteral2(MapLiteral2 node) => null;
+
@override
R visitMapLiteralEntry(MapLiteralEntry node) => null;
@@ -1563,6 +1727,9 @@
@override
R visitSetLiteral(SetLiteral node) => null;
+// @override
+ R visitSetLiteral2(SetLiteral2 node) => null;
+
@override
R visitShowCombinator(ShowCombinator node) => null;
@@ -1575,6 +1742,9 @@
@override
R visitSimpleStringLiteral(SimpleStringLiteral node) => null;
+// @override
+ R visitSpreadElement(SpreadElement node) => null;
+
@override
R visitStringInterpolation(StringInterpolation node) => null;
@@ -1701,6 +1871,12 @@
@override
R visitClassTypeAlias(ClassTypeAlias node) => _throw(node);
+// @override
+ R visitCollectionForElement(CollectionForElement node) => _throw(node);
+
+// @override
+ R visitCollectionIfElement(CollectionIfElement node) => _throw(node);
+
@override
R visitComment(Comment node) => _throw(node);
@@ -1774,15 +1950,33 @@
@override
R visitFieldFormalParameter(FieldFormalParameter node) => _throw(node);
+// @override
+ R visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) =>
+ _throw(node);
+
+// @override
+ R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) =>
+ _throw(node);
+
@override
R visitForEachStatement(ForEachStatement node) => _throw(node);
@override
R visitFormalParameterList(FormalParameterList node) => _throw(node);
+// @override
+ R visitForPartsWithDeclarations(ForPartsWithDeclarations node) =>
+ _throw(node);
+
+// @override
+ R visitForPartsWithExpression(ForPartsWithExpression node) => _throw(node);
+
@override
R visitForStatement(ForStatement node) => _throw(node);
+// @override
+ R visitForStatement2(ForStatement2 node) => _throw(node);
+
@override
R visitFunctionDeclaration(FunctionDeclaration node) => _throw(node);
@@ -1856,9 +2050,21 @@
@override
R visitListLiteral(ListLiteral node) => _throw(node);
+// @override
+ R visitListLiteral2(ListLiteral2 node) => _throw(node);
+
+// @override
+ R visitMapForElement(MapForElement node) => _throw(node);
+
+// @override
+ R visitMapIfElement(MapIfElement node) => _throw(node);
+
@override
R visitMapLiteral(MapLiteral node) => _throw(node);
+// @override
+ R visitMapLiteral2(MapLiteral2 node) => _throw(node);
+
@override
R visitMapLiteralEntry(MapLiteralEntry node) => _throw(node);
@@ -1924,6 +2130,9 @@
@override
R visitSetLiteral(SetLiteral node) => _throw(node);
+// @override
+ R visitSetLiteral2(SetLiteral2 node) => _throw(node);
+
@override
R visitShowCombinator(ShowCombinator node) => _throw(node);
@@ -1936,6 +2145,9 @@
@override
R visitSimpleStringLiteral(SimpleStringLiteral node) => _throw(node);
+// @override
+ R visitSpreadElement(SpreadElement node) => _throw(node);
+
@override
R visitStringInterpolation(StringInterpolation node) => _throw(node);
@@ -3007,6 +3219,12 @@
@override
R visitClassTypeAlias(ClassTypeAlias node) => visitNode(node);
+// @override
+ R visitCollectionForElement(CollectionForElement node) => visitNode(node);
+
+// @override
+ R visitCollectionIfElement(CollectionIfElement node) => visitNode(node);
+
@override
R visitComment(Comment node) => visitNode(node);
@@ -3081,15 +3299,33 @@
@override
R visitFieldFormalParameter(FieldFormalParameter node) => visitNode(node);
+// @override
+ R visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) =>
+ visitNode(node);
+
+// @override
+ R visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) =>
+ visitNode(node);
+
@override
R visitForEachStatement(ForEachStatement node) => visitNode(node);
@override
R visitFormalParameterList(FormalParameterList node) => visitNode(node);
+// @override
+ R visitForPartsWithDeclarations(ForPartsWithDeclarations node) =>
+ visitNode(node);
+
+// @override
+ R visitForPartsWithExpression(ForPartsWithExpression node) => visitNode(node);
+
@override
R visitForStatement(ForStatement node) => visitNode(node);
+// @override
+ R visitForStatement2(ForStatement2 node) => visitNode(node);
+
@override
R visitFunctionDeclaration(FunctionDeclaration node) => visitNode(node);
@@ -3164,9 +3400,21 @@
@override
R visitListLiteral(ListLiteral node) => visitNode(node);
+// @override
+ R visitListLiteral2(ListLiteral2 node) => visitNode(node);
+
+// @override
+ R visitMapForElement(MapForElement node) => visitNode(node);
+
+// @override
+ R visitMapIfElement(MapIfElement node) => visitNode(node);
+
@override
R visitMapLiteral(MapLiteral node) => visitNode(node);
+// @override
+ R visitMapLiteral2(MapLiteral2 node) => visitNode(node);
+
@override
R visitMapLiteralEntry(MapLiteralEntry node) => visitNode(node);
@@ -3238,6 +3486,9 @@
@override
R visitSetLiteral(SetLiteral node) => visitNode(node);
+// @override
+ R visitSetLiteral2(SetLiteral2 node) => visitNode(node);
+
@override
R visitShowCombinator(ShowCombinator node) => visitNode(node);
@@ -3250,6 +3501,9 @@
@override
R visitSimpleStringLiteral(SimpleStringLiteral node) => visitNode(node);
+// @override
+ R visitSpreadElement(SpreadElement node) => visitNode(node);
+
@override
R visitStringInterpolation(StringInterpolation node) => visitNode(node);
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 749f864..7fd1355 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -2056,6 +2056,130 @@
}
}
+abstract class CollectionElementImpl extends AstNodeImpl
+ implements CollectionElement {}
+
+class CollectionForElementImpl extends CollectionElementImpl
+ with ForMixin
+ implements CollectionForElement {
+ /**
+ * The body of the loop.
+ */
+ CollectionElementImpl _body;
+
+ /**
+ * Initialize a newly created for element.
+ */
+ CollectionForElementImpl(
+ Token awaitKeyword,
+ Token forKeyword,
+ Token leftParenthesis,
+ ForLoopPartsImpl forLoopParts,
+ Token rightParenthesis,
+ CollectionElementImpl body) {
+ this.awaitKeyword = awaitKeyword;
+ this.forKeyword = forKeyword;
+ this.leftParenthesis = leftParenthesis;
+ _forLoopParts = _becomeParentOf(forLoopParts);
+ this.rightParenthesis = rightParenthesis;
+ _body = _becomeParentOf(body);
+ }
+
+ @override
+ CollectionElement get body => _body;
+
+ void set body(CollectionElement statement) {
+ _body = _becomeParentOf(statement as CollectionElementImpl);
+ }
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..addAll(super.childEntities)
+ ..add(_body);
+
+ @override
+ Token get endToken => _body.endToken;
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) => visitor.visitCollectionForElement(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _forLoopParts?.accept(visitor);
+ _body?.accept(visitor);
+ }
+}
+
+class CollectionIfElementImpl extends CollectionElementImpl
+ with IfMixin
+ implements CollectionIfElement {
+ /**
+ * The element to be executed if the condition is `true`.
+ */
+ CollectionElementImpl _thenElement;
+
+ /**
+ * The element to be executed if the condition is `false`, or `null` if there
+ * is no such element.
+ */
+ CollectionElementImpl _elseElement;
+
+ /**
+ * Initialize a newly created for element.
+ */
+ CollectionIfElementImpl(
+ Token ifKeyword,
+ Token leftParenthesis,
+ ExpressionImpl condition,
+ Token rightParenthesis,
+ CollectionElementImpl thenElement,
+ Token elseKeyword,
+ CollectionElementImpl elseElement) {
+ this.ifKeyword = ifKeyword;
+ this.leftParenthesis = leftParenthesis;
+ _condition = _becomeParentOf(condition);
+ this.rightParenthesis = rightParenthesis;
+ _thenElement = _becomeParentOf(thenElement);
+ this.elseKeyword = elseKeyword;
+ _elseElement = _becomeParentOf(elseElement);
+ }
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..addAll(super.childEntities)
+ ..add(_thenElement)
+ ..add(_elseElement);
+
+ @override
+ CollectionElement get elseElement => _elseElement;
+
+ set elseElement(CollectionElement element) {
+ _elseElement = _becomeParentOf(element as CollectionElementImpl);
+ }
+
+ @override
+ Token get endToken => _elseElement?.endToken ?? _thenElement.endToken;
+
+ @override
+ CollectionElement get thenElement => _thenElement;
+
+ set thenElement(CollectionElement element) {
+ _thenElement = _becomeParentOf(element as CollectionElementImpl);
+ }
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) => visitor.visitCollectionIfElement(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ super.visitChildren(visitor);
+ _thenElement?.accept(visitor);
+ _elseElement?.accept(visitor);
+ }
+}
+
/**
* A combinator associated with an import or export directive.
*
@@ -4074,7 +4198,8 @@
* | [ConditionalExpression] cascadeSection*
* | [ThrowExpression]
*/
-abstract class ExpressionImpl extends AstNodeImpl implements Expression {
+abstract class ExpressionImpl extends AstNodeImpl
+ implements CollectionElementImpl, Expression {
/**
* The static type of this expression, or `null` if the AST structure has not
* been resolved.
@@ -4549,6 +4674,136 @@
}
}
+abstract class ForEachPartsImpl extends ForLoopPartsImpl
+ implements ForEachParts {
+ @override
+ Token inKeyword;
+
+ /**
+ * The expression evaluated to produce the iterator.
+ */
+ ExpressionImpl _iterable;
+
+ /**
+ * Initialize a newly created for-each statement whose loop control variable
+ * is declared internally (in the for-loop part). The [awaitKeyword] can be
+ * `null` if this is not an asynchronous for loop.
+ */
+ ForEachPartsImpl(this.inKeyword, ExpressionImpl iterator) {
+ _iterable = _becomeParentOf(iterator);
+ }
+
+ @override
+ Token get beginToken => inKeyword;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities =>
+ new ChildEntities()..add(inKeyword)..add(_iterable);
+
+ @override
+ Token get endToken => _iterable.endToken;
+
+ @override
+ Expression get iterable => _iterable;
+
+ void set iterable(Expression expression) {
+ _iterable = _becomeParentOf(expression as ExpressionImpl);
+ }
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _iterable?.accept(visitor);
+ }
+}
+
+class ForEachPartsWithDeclarationImpl extends ForEachPartsImpl
+ implements ForEachPartsWithDeclaration {
+ /**
+ * The declaration of the loop variable.
+ */
+ DeclaredIdentifierImpl _loopVariable;
+
+ /**
+ * Initialize a newly created for-each statement whose loop control variable
+ * is declared internally (inside the for-loop part).
+ */
+ ForEachPartsWithDeclarationImpl(DeclaredIdentifierImpl loopVariable,
+ Token inKeyword, ExpressionImpl iterator)
+ : super(inKeyword, iterator) {
+ _loopVariable = _becomeParentOf(loopVariable);
+ }
+
+ @override
+ Token get beginToken => _loopVariable.beginToken;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..add(_loopVariable)
+ ..addAll(super.childEntities);
+
+ @override
+ DeclaredIdentifier get loopVariable => _loopVariable;
+
+ void set loopVariable(DeclaredIdentifier variable) {
+ _loopVariable = _becomeParentOf(variable as DeclaredIdentifierImpl);
+ }
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) =>
+// visitor.visitForEachPartsWithDeclaration(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _loopVariable?.accept(visitor);
+ super.visitChildren(visitor);
+ }
+}
+
+class ForEachPartsWithIdentifierImpl extends ForEachPartsImpl
+ implements ForEachPartsWithIdentifier {
+ /**
+ * The loop variable.
+ */
+ SimpleIdentifierImpl _identifier;
+
+ /**
+ * Initialize a newly created for-each statement whose loop control variable
+ * is declared externally (outside the for-loop part).
+ */
+ ForEachPartsWithIdentifierImpl(
+ SimpleIdentifierImpl identifier, Token inKeyword, ExpressionImpl iterator)
+ : super(inKeyword, iterator) {
+ _identifier = _becomeParentOf(identifier);
+ }
+
+ @override
+ Token get beginToken => _identifier.beginToken;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..add(_identifier)
+ ..addAll(super.childEntities);
+
+ @override
+ SimpleIdentifier get identifier => _identifier;
+
+ void set identifier(SimpleIdentifier identifier) {
+ _identifier = _becomeParentOf(identifier as SimpleIdentifierImpl);
+ }
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) =>
+// visitor.visitForEachPartsWithIdentifier(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _identifier?.accept(visitor);
+ _iterable?.accept(visitor);
+ }
+}
+
/**
* A for-each statement.
*
@@ -4709,6 +4964,8 @@
}
}
+abstract class ForLoopPartsImpl extends AstNodeImpl implements ForLoopParts {}
+
/**
* A node representing a parameter to a function.
*
@@ -4873,6 +5130,246 @@
}
}
+mixin ForMixin on AstNodeImpl {
+ Token awaitKeyword;
+
+ Token forKeyword;
+
+ Token leftParenthesis;
+
+ ForLoopPartsImpl _forLoopParts;
+
+ Token rightParenthesis;
+
+ @override
+ Token get beginToken => awaitKeyword ?? forKeyword;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..add(awaitKeyword)
+ ..add(forKeyword)
+ ..add(leftParenthesis)
+ ..add(_forLoopParts)
+ ..add(rightParenthesis);
+
+ ForLoopParts get forLoopParts => _forLoopParts;
+
+ void set forLoopParts(ForLoopParts forLoopParts) {
+ _forLoopParts = _becomeParentOf(forLoopParts as ForLoopPartsImpl);
+ }
+}
+
+abstract class ForPartsImpl extends ForLoopPartsImpl implements ForParts {
+ @override
+ Token leftSeparator;
+
+ /**
+ * The condition used to determine when to terminate the loop, or `null` if
+ * there is no condition.
+ */
+ ExpressionImpl _condition;
+
+ @override
+ Token rightSeparator;
+
+ /**
+ * The list of expressions run after each execution of the loop body.
+ */
+ NodeList<Expression> _updaters;
+
+ /**
+ * Initialize a newly created for statement. Either the [variableList] or the
+ * [initialization] must be `null`. Either the [condition] and the list of
+ * [updaters] can be `null` if the loop does not have the corresponding
+ * attribute.
+ */
+ ForPartsImpl(this.leftSeparator, ExpressionImpl condition,
+ this.rightSeparator, List<Expression> updaters) {
+ _condition = _becomeParentOf(condition);
+ _updaters = new NodeListImpl<Expression>(this, updaters);
+ }
+
+ @override
+ Token get beginToken => leftSeparator;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..add(leftSeparator)
+ ..add(_condition)
+ ..add(rightSeparator)
+ ..addAll(_updaters);
+
+ @override
+ Expression get condition => _condition;
+
+ void set condition(Expression expression) {
+ _condition = _becomeParentOf(expression as ExpressionImpl);
+ }
+
+ @override
+ Token get endToken => _updaters?.endToken ?? rightSeparator;
+
+ @override
+ NodeList<Expression> get updaters => _updaters;
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _condition?.accept(visitor);
+ _updaters.accept(visitor);
+ }
+}
+
+class ForPartsWithDeclarationsImpl extends ForPartsImpl
+ implements ForPartsWithDeclarations {
+ /**
+ * The declaration of the loop variables, or `null` if there are no variables.
+ * Note that a for statement cannot have both a variable list and an
+ * initialization expression, but can validly have neither.
+ */
+ VariableDeclarationListImpl _variableList;
+
+ /**
+ * Initialize a newly created for statement. Both the [condition] and the list
+ * of [updaters] can be `null` if the loop does not have the corresponding
+ * attribute.
+ */
+ ForPartsWithDeclarationsImpl(
+ VariableDeclarationListImpl variableList,
+ Token leftSeparator,
+ ExpressionImpl condition,
+ Token rightSeparator,
+ List<Expression> updaters)
+ : super(leftSeparator, condition, rightSeparator, updaters) {
+ _variableList = _becomeParentOf(variableList);
+ }
+
+ @override
+ Token get beginToken => _variableList?.beginToken ?? super.beginToken;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..add(_variableList)
+ ..addAll(super.childEntities);
+
+ @override
+ VariableDeclarationList get variables => _variableList;
+
+ void set variables(VariableDeclarationList variableList) {
+ _variableList =
+ _becomeParentOf(variableList as VariableDeclarationListImpl);
+ }
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) =>
+// visitor.visitForPartsWithDeclarations(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _variableList?.accept(visitor);
+ super.visitChildren(visitor);
+ }
+}
+
+class ForPartsWithExpressionImpl extends ForPartsImpl
+ implements ForPartsWithExpression {
+ /**
+ * The initialization expression, or `null` if there is no initialization
+ * expression. Note that a for statement cannot have both a variable list and
+ * an initialization expression, but can validly have neither.
+ */
+ ExpressionImpl _initialization;
+
+ /**
+ * Initialize a newly created for statement. Both the [condition] and the list
+ * of [updaters] can be `null` if the loop does not have the corresponding
+ * attribute.
+ */
+ ForPartsWithExpressionImpl(ExpressionImpl initialization, Token leftSeparator,
+ ExpressionImpl condition, Token rightSeparator, List<Expression> updaters)
+ : super(leftSeparator, condition, rightSeparator, updaters) {
+ _initialization = _becomeParentOf(initialization);
+ }
+
+ @override
+ Token get beginToken => initialization?.beginToken ?? super.beginToken;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..add(_initialization)
+ ..addAll(super.childEntities);
+
+ @override
+ Expression get initialization => _initialization;
+
+ void set initialization(Expression initialization) {
+ _initialization = _becomeParentOf(initialization as ExpressionImpl);
+ }
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) =>
+// visitor.visitForPartsWithExpression(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _initialization?.accept(visitor);
+ super.visitChildren(visitor);
+ }
+}
+
+class ForStatement2Impl extends StatementImpl
+ with ForMixin
+ implements ForStatement2 {
+ /**
+ * The body of the loop.
+ */
+ StatementImpl _body;
+
+ /**
+ * Initialize a newly created for statement.
+ */
+ ForStatement2Impl(
+ Token awaitKeyword,
+ Token forKeyword,
+ Token leftParenthesis,
+ ForLoopPartsImpl forLoopParts,
+ Token rightParenthesis,
+ StatementImpl body) {
+ this.awaitKeyword = awaitKeyword;
+ this.forKeyword = forKeyword;
+ this.leftParenthesis = leftParenthesis;
+ _forLoopParts = _becomeParentOf(forLoopParts);
+ this.rightParenthesis = rightParenthesis;
+ _body = _becomeParentOf(body);
+ }
+
+ @override
+ Statement get body => _body;
+
+ void set body(Statement statement) {
+ _body = _becomeParentOf(statement as StatementImpl);
+ }
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..addAll(super.childEntities)
+ ..add(_body);
+
+ @override
+ Token get endToken => _body.endToken;
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) => visitor.visitForStatement2(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _forLoopParts?.accept(visitor);
+ _body?.accept(visitor);
+ }
+}
+
/**
* A for statement.
*
@@ -5952,6 +6449,43 @@
bool get isAssignable => true;
}
+mixin IfMixin on AstNodeImpl {
+ Token ifKeyword;
+
+ Token leftParenthesis;
+
+ /**
+ * The condition used to determine which of the branches is executed next.
+ */
+ ExpressionImpl _condition;
+
+ Token rightParenthesis;
+
+ Token elseKeyword;
+
+ @override
+ Token get beginToken => ifKeyword;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..add(ifKeyword)
+ ..add(leftParenthesis)
+ ..add(_condition)
+ ..add(rightParenthesis)
+ ..add(elseKeyword);
+
+ Expression get condition => _condition;
+
+ void set condition(Expression expression) {
+ _condition = _becomeParentOf(expression as ExpressionImpl);
+ }
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _condition?.accept(visitor);
+ }
+}
+
/**
* An if statement.
*
@@ -7277,7 +7811,82 @@
* A list literal.
*
* listLiteral ::=
+ * 'const'? ('<' [TypeAnnotation] '>')?
+ * '[' ([CollectionLiteralElement] ','?)? ']'
+ *
+ * This is the class that is used to represent a list literal when either the
+ * 'control-flow-collections' or 'spread-collections' experiments are enabled.
+ * If neither of those experiments are enabled, then [ListLiteral] will be used.
+ */
+class ListLiteral2Impl extends TypedLiteralImpl implements ListLiteral2 {
+ @override
+ Token leftBracket;
+
+ /**
+ * The elements used to compute the elements of the list.
+ */
+ NodeList<CollectionElement> _elements;
+
+ @override
+ Token rightBracket;
+
+ /**
+ * Initialize a newly created list literal. The [constKeyword] can be `null`
+ * if the literal is not a constant. The [typeArguments] can be `null` if no
+ * type arguments were declared. The list of [elements] can be `null` if the
+ * list is empty.
+ */
+ ListLiteral2Impl(Token constKeyword, TypeArgumentListImpl typeArguments,
+ this.leftBracket, List<CollectionElement> elements, this.rightBracket)
+ : super(constKeyword, typeArguments) {
+ _elements = new NodeListImpl<CollectionElement>(this, elements);
+ }
+
+ @override
+ Token get beginToken {
+ if (constKeyword != null) {
+ return constKeyword;
+ }
+ TypeArgumentList typeArguments = this.typeArguments;
+ if (typeArguments != null) {
+ return typeArguments.beginToken;
+ }
+ return leftBracket;
+ }
+
+ @override
+ // TODO(paulberry): add commas.
+ Iterable<SyntacticEntity> get childEntities => super._childEntities
+ ..add(leftBracket)
+ ..addAll(_elements)
+ ..add(rightBracket);
+
+ @override
+ NodeList<CollectionElement> get elements => _elements;
+
+ @override
+ Token get endToken => rightBracket;
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) => visitor.visitListLiteral2(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ super.visitChildren(visitor);
+ _elements.accept(visitor);
+ }
+}
+
+/**
+ * A list literal.
+ *
+ * listLiteral ::=
* 'const'? ('<' [TypeName] '>')? '[' ([Expression] ','?)? ']'
+ *
+ * This is the class that is used to represent a list literal when neither the
+ * 'control-flow-collections' nor 'spread-collections' experiments are enabled.
+ * If either of those experiments are enabled, then [ListLiteral2] will be used.
*/
class ListLiteralImpl extends TypedLiteralImpl implements ListLiteral {
/**
@@ -7381,13 +7990,206 @@
new Set<VariableElement>();
}
+abstract class MapElementImpl extends AstNodeImpl implements MapElement {}
+
+class MapForElementImpl extends CollectionElementImpl
+ with ForMixin
+ implements MapForElement {
+ /**
+ * The body of the loop.
+ */
+ MapElementImpl _body;
+
+ /**
+ * Initialize a newly created for element.
+ */
+ MapForElementImpl(
+ Token awaitKeyword,
+ Token forKeyword,
+ Token leftParenthesis,
+ ForLoopPartsImpl forLoopParts,
+ Token rightParenthesis,
+ MapElementImpl body) {
+ this.awaitKeyword = awaitKeyword;
+ this.forKeyword = forKeyword;
+ this.leftParenthesis = leftParenthesis;
+ _forLoopParts = _becomeParentOf(forLoopParts);
+ this.rightParenthesis = rightParenthesis;
+ _body = _becomeParentOf(body);
+ }
+
+ @override
+ MapElement get body => _body;
+
+ void set body(MapElement statement) {
+ _body = _becomeParentOf(statement as MapElementImpl);
+ }
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..addAll(super.childEntities)
+ ..add(_body);
+
+ @override
+ Token get endToken => _body.endToken;
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) => visitor.visitMapForElement(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _forLoopParts?.accept(visitor);
+ _body?.accept(visitor);
+ }
+}
+
+class MapIfElementImpl extends MapElementImpl
+ with IfMixin
+ implements MapIfElement {
+ /**
+ * The element to be executed if the condition is `true`.
+ */
+ MapElementImpl _thenElement;
+
+ /**
+ * The element to be executed if the condition is `false`, or `null` if there
+ * is no such element.
+ */
+ MapElementImpl _elseElement;
+
+ /**
+ * Initialize a newly created for element.
+ */
+ MapIfElementImpl(
+ Token ifKeyword,
+ Token leftParenthesis,
+ ExpressionImpl condition,
+ Token rightParenthesis,
+ MapElementImpl thenElement,
+ Token elseKeyword,
+ MapElementImpl elseElement) {
+ this.ifKeyword = ifKeyword;
+ this.leftParenthesis = leftParenthesis;
+ _condition = _becomeParentOf(condition);
+ this.rightParenthesis = rightParenthesis;
+ _thenElement = _becomeParentOf(thenElement);
+ this.elseKeyword = elseKeyword;
+ _elseElement = _becomeParentOf(elseElement);
+ }
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+ ..addAll(super.childEntities)
+ ..add(_thenElement)
+ ..add(_elseElement);
+
+ @override
+ MapElement get elseElement => _elseElement;
+
+ set elseElement(MapElement element) {
+ _elseElement = _becomeParentOf(element as MapElementImpl);
+ }
+
+ @override
+ Token get endToken => _elseElement?.endToken ?? _thenElement.endToken;
+
+ @override
+ MapElement get thenElement => _thenElement;
+
+ set thenElement(MapElement element) {
+ _thenElement = _becomeParentOf(element as MapElementImpl);
+ }
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) => visitor.visitMapIfElement(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ super.visitChildren(visitor);
+ _thenElement?.accept(visitor);
+ _elseElement?.accept(visitor);
+ }
+}
+
+/**
+ * A literal map.
+ *
+ * mapLiteral ::=
+ * 'const'? ('<' [TypeAnnotation] (',' [TypeAnnotation])* '>')?
+ * '{' ([MapElement] (',' [MapElement])* ','?)? '}'
+ *
+ * This is the class that is used to represent a map literal when either the
+ * 'control-flow-collections' or 'spread-collections' experiments are enabled.
+ * If neither of those experiments are enabled, then [MapLiteral] will be used.
+ */
+class MapLiteral2Impl extends TypedLiteralImpl implements MapLiteral2 {
+ @override
+ Token leftBracket;
+
+ /**
+ * The entries in the map.
+ */
+ NodeList<MapElement> _entries;
+
+ @override
+ Token rightBracket;
+
+ /**
+ * Initialize a newly created map literal. The [constKeyword] can be `null` if
+ * the literal is not a constant. The [typeArguments] can be `null` if no type
+ * arguments were declared. The [entries] can be `null` if the map is empty.
+ */
+ MapLiteral2Impl(Token constKeyword, TypeArgumentListImpl typeArguments,
+ this.leftBracket, List<MapElement> entries, this.rightBracket)
+ : super(constKeyword, typeArguments) {
+ _entries = new NodeListImpl<MapElement>(this, entries);
+ }
+
+ @override
+ Token get beginToken {
+ if (constKeyword != null) {
+ return constKeyword;
+ }
+ TypeArgumentList typeArguments = this.typeArguments;
+ if (typeArguments != null) {
+ return typeArguments.beginToken;
+ }
+ return leftBracket;
+ }
+
+ @override
+ // TODO(paulberry): add commas.
+ Iterable<SyntacticEntity> get childEntities => super._childEntities
+ ..add(leftBracket)
+ ..addAll(entries)
+ ..add(rightBracket);
+
+ @override
+ Token get endToken => rightBracket;
+
+ @override
+ NodeList<MapElement> get entries => _entries;
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) => visitor.visitMapLiteral2(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ super.visitChildren(visitor);
+ _entries.accept(visitor);
+ }
+}
+
/**
* A single key/value pair in a map literal.
*
* mapLiteralEntry ::=
* [Expression] ':' [Expression]
*/
-class MapLiteralEntryImpl extends AstNodeImpl implements MapLiteralEntry {
+class MapLiteralEntryImpl extends MapElementImpl implements MapLiteralEntry {
/**
* The expression computing the key with which the value will be associated.
*/
@@ -9507,8 +10309,83 @@
*
* setLiteral ::=
* 'const'? ('<' [TypeAnnotation] '>')?
+ * '{' [CollectionElement] (',' [Expression])* ','? '}'
+ * | 'const'? ('<' [TypeAnnotation] '>')? '{' '}'
+ *
+ * This is the class that is used to represent a set literal when either the
+ * 'control-flow-collections' or 'spread-collections' experiments are enabled.
+ * If neither of those experiments are enabled, then [SetLiteral] will be used.
+ */
+class SetLiteral2Impl extends TypedLiteralImpl implements SetLiteral2 {
+ @override
+ Token leftBracket;
+
+ /**
+ * The elements in the set.
+ */
+ NodeList<CollectionElement> _elements;
+
+ @override
+ Token rightBracket;
+
+ /**
+ * Initialize a newly created set literal. The [constKeyword] can be `null` if
+ * the literal is not a constant. The [typeArguments] can be `null` if no type
+ * arguments were declared. The [elements] can be `null` if the set is empty.
+ */
+ SetLiteral2Impl(Token constKeyword, TypeArgumentListImpl typeArguments,
+ this.leftBracket, List<CollectionElement> elements, this.rightBracket)
+ : super(constKeyword, typeArguments) {
+ _elements = new NodeListImpl<CollectionElement>(this, elements);
+ }
+
+ @override
+ Token get beginToken {
+ if (constKeyword != null) {
+ return constKeyword;
+ }
+ TypeArgumentList typeArguments = this.typeArguments;
+ if (typeArguments != null) {
+ return typeArguments.beginToken;
+ }
+ return leftBracket;
+ }
+
+ @override
+ // TODO(paulberry): add commas.
+ Iterable<SyntacticEntity> get childEntities => super._childEntities
+ ..add(leftBracket)
+ ..addAll(elements)
+ ..add(rightBracket);
+
+ @override
+ NodeList<CollectionElement> get elements => _elements;
+
+ @override
+ Token get endToken => rightBracket;
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) => visitor.visitSetLiteral2(this);
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ super.visitChildren(visitor);
+ _elements.accept(visitor);
+ }
+}
+
+/**
+ * A literal set.
+ *
+ * setLiteral ::=
+ * 'const'? ('<' [TypeAnnotation] '>')?
* '{' [Expression] (',' [Expression])* ','? '}'
* | 'const'? ('<' [TypeAnnotation] '>')? '{' '}'
+ *
+ * This is the class that is used to represent a set literal when neither the
+ * 'control-flow-collections' nor 'spread-collections' experiments are enabled.
+ * If either of those experiments are enabled, then [SetLiteral2] will be used.
*/
class SetLiteralImpl extends TypedLiteralImpl implements SetLiteral {
/**
@@ -9999,6 +10876,45 @@
abstract class SingleStringLiteralImpl extends StringLiteralImpl
implements SingleStringLiteral {}
+class SpreadElementImpl extends AstNodeImpl
+ implements CollectionElementImpl, MapElementImpl, SpreadElement {
+ Token spreadOperator;
+
+ ExpressionImpl _expression;
+
+ SpreadElementImpl(this.spreadOperator, ExpressionImpl expression) {
+ _expression = _becomeParentOf(expression);
+ }
+
+ @override
+ Token get beginToken => spreadOperator;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities =>
+ new ChildEntities()..add(spreadOperator)..add(_expression);
+
+ @override
+ Token get endToken => _expression.endToken;
+
+ @override
+ Expression get expression => _expression;
+
+ set expression(Expression expression) {
+ _expression = _becomeParentOf(expression as ExpressionImpl);
+ }
+
+ @override
+// E accept<E>(AstVisitor<E> visitor) {
+// return visitor.visitSpreadElement(this);
+// }
+ E accept<E>(AstVisitor<E> visitor) => throw new UnsupportedError('');
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _expression?.accept(visitor);
+ }
+}
+
/**
* A node that represents a statement.
*
diff --git a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
index cc7023a..cad9671 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
@@ -173,6 +173,29 @@
semicolon);
@override
+ CollectionForElement collectionForElement(
+ {Token awaitKeyword,
+ Token forKeyword,
+ Token leftParenthesis,
+ ForLoopParts forLoopParts,
+ Token rightParenthesis,
+ CollectionElement body}) =>
+ new CollectionForElementImpl(awaitKeyword, forKeyword, leftParenthesis,
+ forLoopParts, rightParenthesis, body);
+
+ @override
+ CollectionIfElement collectionIfElement(
+ {Token ifKeyword,
+ Token leftParenthesis,
+ Expression condition,
+ Token rightParenthesis,
+ CollectionElement thenElement,
+ Token elseKeyword,
+ CollectionElement elseElement}) =>
+ new CollectionIfElementImpl(ifKeyword, leftParenthesis, condition,
+ rightParenthesis, thenElement, elseKeyword, elseElement);
+
+ @override
CommentReference commentReference(Token newKeyword, Identifier identifier) =>
new CommentReferenceImpl(newKeyword, identifier);
@@ -338,6 +361,7 @@
Token semicolon) =>
new ExportDirectiveImpl(comment, metadata, keyword, libraryUri,
configurations, combinators, semicolon);
+
@override
ExpressionFunctionBody expressionFunctionBody(Token keyword,
Token functionDefinition, Expression expression, Token semicolon) =>
@@ -404,6 +428,20 @@
type, thisKeyword, period, identifier, typeParameters, parameters);
@override
+ ForEachPartsWithDeclaration forEachPartsWithDeclaration(
+ {DeclaredIdentifier loopVariable,
+ Token inKeyword,
+ Expression iterable}) =>
+ new ForEachPartsWithDeclarationImpl(loopVariable, inKeyword, iterable);
+
+ @override
+ ForEachPartsWithIdentifier forEachPartsWithIdentifier(
+ {SimpleIdentifier identifier,
+ Token inKeyword,
+ Expression iterable}) =>
+ new ForEachPartsWithIdentifierImpl(identifier, inKeyword, iterable);
+
+ @override
ForEachStatement forEachStatementWithDeclaration(
Token awaitKeyword,
Token forKeyword,
@@ -454,6 +492,26 @@
rightDelimiter, rightParenthesis);
@override
+ ForPartsWithDeclarations forPartsWithDeclarations(
+ {VariableDeclarationList variables,
+ Token leftSeparator,
+ Expression condition,
+ Token rightSeparator,
+ List<Expression> updaters}) =>
+ new ForPartsWithDeclarationsImpl(
+ variables, leftSeparator, condition, rightSeparator, updaters);
+
+ @override
+ ForPartsWithExpression forPartsWithExpression(
+ {Expression initialization,
+ Token leftSeparator,
+ Expression condition,
+ Token rightSeparator,
+ List<Expression> updaters}) =>
+ new ForPartsWithExpressionImpl(
+ initialization, leftSeparator, condition, rightSeparator, updaters);
+
+ @override
ForStatement forStatement(
Token forKeyword,
Token leftParenthesis,
@@ -478,6 +536,17 @@
body);
@override
+ ForStatement2 forStatement2(
+ {Token awaitKeyword,
+ Token forKeyword,
+ Token leftParenthesis,
+ ForLoopParts forLoopParts,
+ Token rightParenthesis,
+ Statement body}) =>
+ new ForStatement2Impl(awaitKeyword, forKeyword, leftParenthesis,
+ forLoopParts, rightParenthesis, body);
+
+ @override
FunctionDeclaration functionDeclaration(
Comment comment,
List<Annotation> metadata,
@@ -673,6 +742,39 @@
constKeyword, typeArguments, leftBracket, elements, rightBracket);
@override
+ ListLiteral2 listLiteral2(
+ {Token constKeyword,
+ TypeArgumentList typeArguments,
+ Token leftBracket,
+ List<CollectionElement> elements,
+ Token rightBracket}) =>
+ new ListLiteral2Impl(
+ constKeyword, typeArguments, leftBracket, elements, rightBracket);
+
+ @override
+ MapForElement mapForElement(
+ {Token awaitKeyword,
+ Token forKeyword,
+ Token leftParenthesis,
+ ForLoopParts forLoopParts,
+ Token rightParenthesis,
+ MapElement body}) =>
+ new MapForElementImpl(awaitKeyword, forKeyword, leftParenthesis,
+ forLoopParts, rightParenthesis, body);
+
+ @override
+ MapIfElement mapIfElement(
+ {Token ifKeyword,
+ Token leftParenthesis,
+ Expression condition,
+ Token rightParenthesis,
+ MapElement thenElement,
+ Token elseKeyword,
+ MapElement elseElement}) =>
+ new MapIfElementImpl(ifKeyword, leftParenthesis, condition,
+ rightParenthesis, thenElement, elseKeyword, elseElement);
+
+ @override
MapLiteral mapLiteral(
Token constKeyword,
TypeArgumentList typeArguments,
@@ -683,6 +785,16 @@
constKeyword, typeArguments, leftBracket, entries, rightBracket);
@override
+ MapLiteral2 mapLiteral2(
+ {Token constKeyword,
+ TypeArgumentList typeArguments,
+ Token leftBracket,
+ List<MapElement> entries,
+ Token rightBracket}) =>
+ new MapLiteral2Impl(
+ constKeyword, typeArguments, leftBracket, entries, rightBracket);
+
+ @override
MapLiteralEntry mapLiteralEntry(
Expression key, Token separator, Expression value) =>
new MapLiteralEntryImpl(key, separator, value);
@@ -840,6 +952,16 @@
constKeyword, typeArguments, leftBracket, elements, rightBracket);
@override
+ SetLiteral2 setLiteral2(
+ {Token constKeyword,
+ TypeArgumentList typeArguments,
+ Token leftBracket,
+ List<CollectionElement> elements,
+ Token rightBracket}) =>
+ new SetLiteral2Impl(
+ constKeyword, typeArguments, leftBracket, elements, rightBracket);
+
+ @override
ShowCombinator showCombinator(
Token keyword, List<SimpleIdentifier> shownNames) =>
new ShowCombinatorImpl(keyword, shownNames);
@@ -878,6 +1000,10 @@
new SimpleStringLiteralImpl(literal, value);
@override
+ SpreadElement spreadElement({Token spreadOperator, Expression expression}) =>
+ new SpreadElementImpl(spreadOperator, expression);
+
+ @override
StringInterpolation stringInterpolation(
List<InterpolationElement> elements) =>
new StringInterpolationImpl(elements);
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index f62757e..1334a20 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -247,6 +247,26 @@
cloneToken(node.semicolon));
}
+// @override
+ CollectionForElement visitCollectionForElement(CollectionForElement node) =>
+ astFactory.collectionForElement(
+ forKeyword: cloneToken(node.forKeyword),
+ leftParenthesis: cloneToken(node.leftParenthesis),
+ forLoopParts: cloneNode(node.forLoopParts),
+ rightParenthesis: cloneToken(node.rightParenthesis),
+ body: cloneNode(node.body));
+
+// @override
+ CollectionIfElement visitCollectionIfElement(CollectionIfElement node) =>
+ astFactory.collectionIfElement(
+ ifKeyword: cloneToken(node.ifKeyword),
+ leftParenthesis: cloneToken(node.leftParenthesis),
+ condition: cloneNode(node.condition),
+ rightParenthesis: cloneToken(node.rightParenthesis),
+ thenElement: cloneNode(node.thenElement),
+ elseKeyword: cloneToken(node.elseKeyword),
+ elseElement: cloneNode(node.elseElement));
+
@override
Comment visitComment(Comment node) {
if (node.isDocumentation) {
@@ -469,6 +489,22 @@
typeParameters: cloneNode(node.typeParameters),
parameters: cloneNode(node.parameters));
+// @override
+ ForEachPartsWithDeclaration visitForEachPartsWithDeclaration(
+ ForEachPartsWithDeclaration node) =>
+ astFactory.forEachPartsWithDeclaration(
+ loopVariable: cloneNode(node.loopVariable),
+ inKeyword: cloneToken(node.inKeyword),
+ iterable: cloneNode(node.iterable));
+
+// @override
+ ForEachPartsWithIdentifier visitForEachPartsWithIdentifier(
+ ForEachPartsWithIdentifier node) =>
+ astFactory.forEachPartsWithIdentifier(
+ identifier: cloneNode(node.identifier),
+ inKeyword: cloneToken(node.inKeyword),
+ iterable: cloneNode(node.iterable));
+
@override
ForEachStatement visitForEachStatement(ForEachStatement node) {
DeclaredIdentifier loopVariable = node.loopVariable;
@@ -503,6 +539,26 @@
cloneToken(node.rightDelimiter),
cloneToken(node.rightParenthesis));
+// @override
+ ForPartsWithDeclarations visitForPartsWithDeclarations(
+ ForPartsWithDeclarations node) =>
+ astFactory.forPartsWithDeclarations(
+ variables: cloneNode(node.variables),
+ leftSeparator: cloneToken(node.leftSeparator),
+ condition: cloneNode(node.condition),
+ rightSeparator: cloneToken(node.rightSeparator),
+ updaters: cloneNodeList(node.updaters));
+
+// @override
+ ForPartsWithExpression visitForPartsWithExpression(
+ ForPartsWithExpression node) =>
+ astFactory.forPartsWithExpression(
+ initialization: cloneNode(node.initialization),
+ leftSeparator: cloneToken(node.leftSeparator),
+ condition: cloneNode(node.condition),
+ rightSeparator: cloneToken(node.rightSeparator),
+ updaters: cloneNodeList(node.updaters));
+
@override
ForStatement visitForStatement(ForStatement node) => astFactory.forStatement(
cloneToken(node.forKeyword),
@@ -516,6 +572,15 @@
cloneToken(node.rightParenthesis),
cloneNode(node.body));
+// @override
+ ForStatement2 visitForStatement2(ForStatement2 node) =>
+ astFactory.forStatement2(
+ forKeyword: cloneToken(node.forKeyword),
+ leftParenthesis: cloneToken(node.leftParenthesis),
+ forLoopParts: cloneNode(node.forLoopParts),
+ rightParenthesis: cloneToken(node.rightParenthesis),
+ body: cloneNode(node.body));
+
@override
FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) =>
astFactory.functionDeclaration(
@@ -703,6 +768,33 @@
cloneNodeList(node.elements),
cloneToken(node.rightBracket));
+// @override
+ ListLiteral2 visitListLiteral2(ListLiteral2 node) => astFactory.listLiteral2(
+ constKeyword: cloneToken(node.constKeyword),
+ typeArguments: cloneNode(node.typeArguments),
+ leftBracket: cloneToken(node.leftBracket),
+ elements: cloneNodeList(node.elements),
+ rightBracket: cloneToken(node.rightBracket));
+
+// @override
+ MapForElement visitMapForElement(MapForElement node) =>
+ astFactory.mapForElement(
+ forKeyword: cloneToken(node.forKeyword),
+ leftParenthesis: cloneToken(node.leftParenthesis),
+ forLoopParts: cloneNode(node.forLoopParts),
+ rightParenthesis: cloneToken(node.rightParenthesis),
+ body: cloneNode(node.body));
+
+// @override
+ MapIfElement visitMapIfElement(MapIfElement node) => astFactory.mapIfElement(
+ ifKeyword: cloneToken(node.ifKeyword),
+ leftParenthesis: cloneToken(node.leftParenthesis),
+ condition: cloneNode(node.condition),
+ rightParenthesis: cloneToken(node.rightParenthesis),
+ thenElement: cloneNode(node.thenElement),
+ elseKeyword: cloneToken(node.elseKeyword),
+ elseElement: cloneNode(node.elseElement));
+
@override
MapLiteral visitMapLiteral(MapLiteral node) => astFactory.mapLiteral(
cloneToken(node.constKeyword),
@@ -711,6 +803,14 @@
cloneNodeList(node.entries),
cloneToken(node.rightBracket));
+// @override
+ MapLiteral2 visitMapLiteral2(MapLiteral2 node) => astFactory.mapLiteral2(
+ constKeyword: cloneToken(node.constKeyword),
+ typeArguments: cloneNode(node.typeArguments),
+ leftBracket: cloneToken(node.leftBracket),
+ entries: cloneNodeList(node.entries),
+ rightBracket: cloneToken(node.rightBracket));
+
@override
MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node) =>
astFactory.mapLiteralEntry(cloneNode(node.key),
@@ -853,6 +953,14 @@
cloneNodeList(node.elements),
cloneToken(node.rightBracket));
+// @override
+ SetLiteral2 visitSetLiteral2(SetLiteral2 node) => astFactory.setLiteral2(
+ constKeyword: cloneToken(node.constKeyword),
+ typeArguments: cloneNode(node.typeArguments),
+ leftBracket: cloneToken(node.leftBracket),
+ elements: cloneNodeList(node.elements),
+ rightBracket: cloneToken(node.rightBracket));
+
@override
ShowCombinator visitShowCombinator(ShowCombinator node) => astFactory
.showCombinator(cloneToken(node.keyword), cloneNodeList(node.shownNames));
@@ -877,6 +985,12 @@
SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node) =>
astFactory.simpleStringLiteral(cloneToken(node.literal), node.value);
+// @override
+ SpreadElement visitSpreadElement(SpreadElement node) =>
+ astFactory.spreadElement(
+ spreadOperator: cloneToken(node.spreadOperator),
+ expression: cloneNode(node.expression));
+
@override
StringInterpolation visitStringInterpolation(StringInterpolation node) =>
astFactory.stringInterpolation(cloneNodeList(node.elements));
@@ -1334,6 +1448,28 @@
isEqualTokens(node.semicolon, other.semicolon);
}
+// @override
+ bool visitCollectionForElement(CollectionForElement node) {
+ CollectionForElement other = _other as CollectionForElement;
+ return isEqualTokens(node.forKeyword, other.forKeyword) &&
+ isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
+ isEqualNodes(node.forLoopParts, other.forLoopParts) &&
+ isEqualTokens(node.rightParenthesis, other.rightParenthesis) &&
+ isEqualNodes(node.body, other.body);
+ }
+
+// @override
+ bool visitCollectionIfElement(CollectionIfElement node) {
+ CollectionIfElement other = _other as CollectionIfElement;
+ return isEqualTokens(node.ifKeyword, other.ifKeyword) &&
+ isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
+ isEqualNodes(node.condition, other.condition) &&
+ isEqualTokens(node.rightParenthesis, other.rightParenthesis) &&
+ isEqualNodes(node.thenElement, other.thenElement) &&
+ isEqualTokens(node.elseKeyword, other.elseKeyword) &&
+ isEqualNodes(node.elseElement, other.elseElement);
+ }
+
@override
bool visitComment(Comment node) {
Comment other = _other as Comment;
@@ -1562,6 +1698,22 @@
isEqualNodes(node.identifier, other.identifier);
}
+// @override
+ bool visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) {
+ ForEachPartsWithDeclaration other = _other as ForEachPartsWithDeclaration;
+ return isEqualNodes(node.loopVariable, other.loopVariable) &&
+ isEqualTokens(node.inKeyword, other.inKeyword) &&
+ isEqualNodes(node.iterable, other.iterable);
+ }
+
+// @override
+ bool visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) {
+ ForEachPartsWithIdentifier other = _other as ForEachPartsWithIdentifier;
+ return isEqualNodes(node.identifier, other.identifier) &&
+ isEqualTokens(node.inKeyword, other.inKeyword) &&
+ isEqualNodes(node.iterable, other.iterable);
+ }
+
@override
bool visitForEachStatement(ForEachStatement node) {
ForEachStatement other = _other as ForEachStatement;
@@ -1584,6 +1736,26 @@
isEqualTokens(node.rightParenthesis, other.rightParenthesis);
}
+// @override
+ bool visitForPartsWithDeclarations(ForPartsWithDeclarations node) {
+ ForPartsWithDeclarations other = _other as ForPartsWithDeclarations;
+ return isEqualNodes(node.variables, other.variables) &&
+ isEqualTokens(node.leftSeparator, other.leftSeparator) &&
+ isEqualNodes(node.condition, other.condition) &&
+ isEqualTokens(node.rightSeparator, other.rightSeparator) &&
+ _isEqualNodeLists(node.updaters, other.updaters);
+ }
+
+// @override
+ bool visitForPartsWithExpression(ForPartsWithExpression node) {
+ ForPartsWithExpression other = _other as ForPartsWithExpression;
+ return isEqualNodes(node.initialization, other.initialization) &&
+ isEqualTokens(node.leftSeparator, other.leftSeparator) &&
+ isEqualNodes(node.condition, other.condition) &&
+ isEqualTokens(node.rightSeparator, other.rightSeparator) &&
+ _isEqualNodeLists(node.updaters, other.updaters);
+ }
+
@override
bool visitForStatement(ForStatement node) {
ForStatement other = _other as ForStatement;
@@ -1599,6 +1771,16 @@
isEqualNodes(node.body, other.body);
}
+// @override
+ bool visitForStatement2(ForStatement2 node) {
+ ForStatement2 other = _other as ForStatement2;
+ return isEqualTokens(node.forKeyword, other.forKeyword) &&
+ isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
+ isEqualNodes(node.forLoopParts, other.forLoopParts) &&
+ isEqualTokens(node.rightParenthesis, other.rightParenthesis) &&
+ isEqualNodes(node.body, other.body);
+ }
+
@override
bool visitFunctionDeclaration(FunctionDeclaration node) {
FunctionDeclaration other = _other as FunctionDeclaration;
@@ -1811,6 +1993,38 @@
isEqualTokens(node.rightBracket, other.rightBracket);
}
+// @override
+ bool visitListLiteral2(ListLiteral2 node) {
+ ListLiteral2 other = _other as ListLiteral2;
+ return isEqualTokens(node.constKeyword, other.constKeyword) &&
+ isEqualNodes(node.typeArguments, other.typeArguments) &&
+ isEqualTokens(node.leftBracket, other.leftBracket) &&
+ _isEqualNodeLists(node.elements, other.elements) &&
+ isEqualTokens(node.rightBracket, other.rightBracket);
+ }
+
+// @override
+ bool visitMapForElement(MapForElement node) {
+ MapForElement other = _other as MapForElement;
+ return isEqualTokens(node.forKeyword, other.forKeyword) &&
+ isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
+ isEqualNodes(node.forLoopParts, other.forLoopParts) &&
+ isEqualTokens(node.rightParenthesis, other.rightParenthesis) &&
+ isEqualNodes(node.body, other.body);
+ }
+
+// @override
+ bool visitMapIfElement(MapIfElement node) {
+ MapIfElement other = _other as MapIfElement;
+ return isEqualTokens(node.ifKeyword, other.ifKeyword) &&
+ isEqualTokens(node.leftParenthesis, other.leftParenthesis) &&
+ isEqualNodes(node.condition, other.condition) &&
+ isEqualTokens(node.rightParenthesis, other.rightParenthesis) &&
+ isEqualNodes(node.thenElement, other.thenElement) &&
+ isEqualTokens(node.elseKeyword, other.elseKeyword) &&
+ isEqualNodes(node.elseElement, other.elseElement);
+ }
+
@override
bool visitMapLiteral(MapLiteral node) {
MapLiteral other = _other as MapLiteral;
@@ -1821,6 +2035,16 @@
isEqualTokens(node.rightBracket, other.rightBracket);
}
+// @override
+ bool visitMapLiteral2(MapLiteral2 node) {
+ MapLiteral2 other = _other as MapLiteral2;
+ return isEqualTokens(node.constKeyword, other.constKeyword) &&
+ isEqualNodes(node.typeArguments, other.typeArguments) &&
+ isEqualTokens(node.leftBracket, other.leftBracket) &&
+ _isEqualNodeLists(node.entries, other.entries) &&
+ isEqualTokens(node.rightBracket, other.rightBracket);
+ }
+
@override
bool visitMapLiteralEntry(MapLiteralEntry node) {
MapLiteralEntry other = _other as MapLiteralEntry;
@@ -2008,6 +2232,16 @@
isEqualTokens(node.rightBracket, other.rightBracket);
}
+// @override
+ bool visitSetLiteral2(SetLiteral2 node) {
+ SetLiteral2 other = _other as SetLiteral2;
+ return isEqualTokens(node.constKeyword, other.constKeyword) &&
+ isEqualNodes(node.typeArguments, other.typeArguments) &&
+ isEqualTokens(node.leftBracket, other.leftBracket) &&
+ _isEqualNodeLists(node.elements, other.elements) &&
+ isEqualTokens(node.rightBracket, other.rightBracket);
+ }
+
@override
bool visitShowCombinator(ShowCombinator node) {
ShowCombinator other = _other as ShowCombinator;
@@ -2039,6 +2273,13 @@
failIfNotEqual(node, node.value, other, other.value);
}
+// @override
+ bool visitSpreadElement(SpreadElement node) {
+ SpreadElement other = _other as SpreadElement;
+ return isEqualTokens(node.spreadOperator, other.spreadOperator) &&
+ isEqualNodes(node.expression, other.expression);
+ }
+
@override
bool visitStringInterpolation(StringInterpolation node) {
StringInterpolation other = _other as StringInterpolation;
@@ -3057,6 +3298,26 @@
_cloneNode(node.implementsClause),
_mapToken(node.semicolon));
+// @override
+ CollectionForElement visitCollectionForElement(CollectionForElement node) =>
+ astFactory.collectionForElement(
+ forKeyword: _mapToken(node.forKeyword),
+ leftParenthesis: _mapToken(node.leftParenthesis),
+ forLoopParts: _cloneNode(node.forLoopParts),
+ rightParenthesis: _mapToken(node.rightParenthesis),
+ body: _cloneNode(node.body));
+
+// @override
+ CollectionIfElement visitCollectionIfElement(CollectionIfElement node) =>
+ astFactory.collectionIfElement(
+ ifKeyword: _mapToken(node.ifKeyword),
+ leftParenthesis: _mapToken(node.leftParenthesis),
+ condition: _cloneNode(node.condition),
+ rightParenthesis: _mapToken(node.rightParenthesis),
+ thenElement: _cloneNode(node.thenElement),
+ elseKeyword: _mapToken(node.elseKeyword),
+ elseElement: _cloneNode(node.elseElement));
+
@override
Comment visitComment(Comment node) {
if (node.isDocumentation) {
@@ -3271,6 +3532,22 @@
typeParameters: _cloneNode(node.typeParameters),
parameters: _cloneNode(node.parameters));
+// @override
+ ForEachPartsWithDeclaration visitForEachPartsWithDeclaration(
+ ForEachPartsWithDeclaration node) =>
+ astFactory.forEachPartsWithDeclaration(
+ loopVariable: _cloneNode(node.loopVariable),
+ inKeyword: _mapToken(node.inKeyword),
+ iterable: _cloneNode(node.iterable));
+
+// @override
+ ForEachPartsWithIdentifier visitForEachPartsWithIdentifier(
+ ForEachPartsWithIdentifier node) =>
+ astFactory.forEachPartsWithIdentifier(
+ identifier: _cloneNode(node.identifier),
+ inKeyword: _mapToken(node.inKeyword),
+ iterable: _cloneNode(node.iterable));
+
@override
ForEachStatement visitForEachStatement(ForEachStatement node) {
DeclaredIdentifier loopVariable = node.loopVariable;
@@ -3305,6 +3582,26 @@
_mapToken(node.rightDelimiter),
_mapToken(node.rightParenthesis));
+// @override
+ ForPartsWithDeclarations visitForPartsWithDeclarations(
+ ForPartsWithDeclarations node) =>
+ astFactory.forPartsWithDeclarations(
+ variables: _cloneNode(node.variables),
+ leftSeparator: _mapToken(node.leftSeparator),
+ condition: _cloneNode(node.condition),
+ rightSeparator: _mapToken(node.rightSeparator),
+ updaters: _cloneNodeList(node.updaters));
+
+// @override
+ ForPartsWithExpression visitForPartsWithExpression(
+ ForPartsWithExpression node) =>
+ astFactory.forPartsWithExpression(
+ initialization: _cloneNode(node.initialization),
+ leftSeparator: _mapToken(node.leftSeparator),
+ condition: _cloneNode(node.condition),
+ rightSeparator: _mapToken(node.rightSeparator),
+ updaters: _cloneNodeList(node.updaters));
+
@override
ForStatement visitForStatement(ForStatement node) => astFactory.forStatement(
_mapToken(node.forKeyword),
@@ -3318,6 +3615,15 @@
_mapToken(node.rightParenthesis),
_cloneNode(node.body));
+// @override
+ ForStatement2 visitForStatement2(ForStatement2 node) =>
+ astFactory.forStatement2(
+ forKeyword: _mapToken(node.forKeyword),
+ leftParenthesis: _mapToken(node.leftParenthesis),
+ forLoopParts: _cloneNode(node.forLoopParts),
+ rightParenthesis: _mapToken(node.rightParenthesis),
+ body: _cloneNode(node.body));
+
@override
FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) =>
astFactory.functionDeclaration(
@@ -3545,6 +3851,33 @@
return copy;
}
+// @override
+ ListLiteral2 visitListLiteral2(ListLiteral2 node) => astFactory.listLiteral2(
+ constKeyword: _mapToken(node.constKeyword),
+ typeArguments: _cloneNode(node.typeArguments),
+ leftBracket: _mapToken(node.leftBracket),
+ elements: _cloneNodeList(node.elements),
+ rightBracket: _mapToken(node.rightBracket));
+
+// @override
+ MapForElement visitMapForElement(MapForElement node) =>
+ astFactory.mapForElement(
+ forKeyword: _mapToken(node.forKeyword),
+ leftParenthesis: _mapToken(node.leftParenthesis),
+ forLoopParts: _cloneNode(node.forLoopParts),
+ rightParenthesis: _mapToken(node.rightParenthesis),
+ body: _cloneNode(node.body));
+
+// @override
+ MapIfElement visitMapIfElement(MapIfElement node) => astFactory.mapIfElement(
+ ifKeyword: _mapToken(node.ifKeyword),
+ leftParenthesis: _mapToken(node.leftParenthesis),
+ condition: _cloneNode(node.condition),
+ rightParenthesis: _mapToken(node.rightParenthesis),
+ thenElement: _cloneNode(node.thenElement),
+ elseKeyword: _mapToken(node.elseKeyword),
+ elseElement: _cloneNode(node.elseElement));
+
@override
MapLiteral visitMapLiteral(MapLiteral node) {
MapLiteral copy = astFactory.mapLiteral(
@@ -3557,6 +3890,14 @@
return copy;
}
+// @override
+ MapLiteral2 visitMapLiteral2(MapLiteral2 node) => astFactory.mapLiteral2(
+ constKeyword: _mapToken(node.constKeyword),
+ typeArguments: _cloneNode(node.typeArguments),
+ leftBracket: _mapToken(node.leftBracket),
+ entries: _cloneNodeList(node.entries),
+ rightBracket: _mapToken(node.rightBracket));
+
@override
MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node) =>
astFactory.mapLiteralEntry(_cloneNode(node.key),
@@ -3746,6 +4087,14 @@
return copy;
}
+// @override
+ SetLiteral2 visitSetLiteral2(SetLiteral2 node) => astFactory.setLiteral2(
+ constKeyword: _mapToken(node.constKeyword),
+ typeArguments: _cloneNode(node.typeArguments),
+ leftBracket: _mapToken(node.leftBracket),
+ elements: _cloneNodeList(node.elements),
+ rightBracket: _mapToken(node.rightBracket));
+
@override
ShowCombinator visitShowCombinator(ShowCombinator node) => astFactory
.showCombinator(_mapToken(node.keyword), _cloneNodeList(node.shownNames));
@@ -3788,6 +4137,12 @@
return copy;
}
+// @override
+ SpreadElement visitSpreadElement(SpreadElement node) =>
+ astFactory.spreadElement(
+ spreadOperator: _mapToken(node.spreadOperator),
+ expression: _cloneNode(node.expression));
+
@override
StringInterpolation visitStringInterpolation(StringInterpolation node) {
StringInterpolation copy =
@@ -4421,6 +4776,36 @@
return visitAnnotatedNode(node);
}
+// @override
+ bool visitCollectionForElement(CollectionForElement node) {
+ if (identical(node.forLoopParts, _oldNode)) {
+ (node as CollectionForElementImpl).forLoopParts =
+ _newNode as ForLoopParts;
+ return true;
+ } else if (identical(node.body, _oldNode)) {
+ (node as CollectionForElementImpl).body = _newNode as CollectionElement;
+ return true;
+ }
+ return visitNode(node);
+ }
+
+// @override
+ bool visitCollectionIfElement(CollectionIfElement node) {
+ if (identical(node.condition, _oldNode)) {
+ (node as CollectionIfElementImpl).condition = _newNode as Expression;
+ return true;
+ } else if (identical(node.thenElement, _oldNode)) {
+ (node as CollectionIfElementImpl).thenElement =
+ _newNode as CollectionElement;
+ return true;
+ } else if (identical(node.elseElement, _oldNode)) {
+ (node as CollectionIfElementImpl).elseElement =
+ _newNode as CollectionElement;
+ return true;
+ }
+ return visitNode(node);
+ }
+
@override
bool visitComment(Comment node) {
if (_replaceInList(node.references)) {
@@ -4662,6 +5047,34 @@
return visitNormalFormalParameter(node);
}
+// @override
+ bool visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) {
+ if (identical(node.loopVariable, _oldNode)) {
+ (node as ForEachPartsWithDeclarationImpl).loopVariable =
+ _newNode as DeclaredIdentifier;
+ return true;
+ } else if (identical(node.iterable, _oldNode)) {
+ (node as ForEachPartsWithDeclarationImpl).iterable =
+ _newNode as Expression;
+ return true;
+ }
+ return visitNode(node);
+ }
+
+// @override
+ bool visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) {
+ if (identical(node.identifier, _oldNode)) {
+ (node as ForEachPartsWithIdentifierImpl).identifier =
+ _newNode as SimpleIdentifier;
+ return true;
+ } else if (identical(node.iterable, _oldNode)) {
+ (node as ForEachPartsWithIdentifierImpl).iterable =
+ _newNode as Expression;
+ return true;
+ }
+ return visitNode(node);
+ }
+
@override
bool visitForEachStatement(ForEachStatement node) {
if (identical(node.loopVariable, _oldNode)) {
@@ -4688,6 +5101,36 @@
return visitNode(node);
}
+// @override
+ bool visitForPartsWithDeclarations(ForPartsWithDeclarations node) {
+ if (identical(node.variables, _oldNode)) {
+ (node as ForPartsWithDeclarationsImpl).variables =
+ _newNode as VariableDeclarationList;
+ return true;
+ } else if (identical(node.condition, _oldNode)) {
+ (node as ForPartsWithDeclarationsImpl).condition = _newNode as Expression;
+ return true;
+ } else if (_replaceInList(node.updaters)) {
+ return true;
+ }
+ return visitNode(node);
+ }
+
+// @override
+ bool visitForPartsWithExpression(ForPartsWithExpression node) {
+ if (identical(node.initialization, _oldNode)) {
+ (node as ForPartsWithExpressionImpl).initialization =
+ _newNode as Expression;
+ return true;
+ } else if (identical(node.condition, _oldNode)) {
+ (node as ForPartsWithExpressionImpl).condition = _newNode as Expression;
+ return true;
+ } else if (_replaceInList(node.updaters)) {
+ return true;
+ }
+ return visitNode(node);
+ }
+
@override
bool visitForStatement(ForStatement node) {
if (identical(node.variables, _oldNode)) {
@@ -4708,6 +5151,18 @@
return visitNode(node);
}
+// @override
+ bool visitForStatement2(ForStatement2 node) {
+ if (identical(node.forLoopParts, _oldNode)) {
+ (node as ForStatement2Impl).forLoopParts = _newNode as ForLoopParts;
+ return true;
+ } else if (identical(node.body, _oldNode)) {
+ (node as ForStatement2Impl).body = _newNode as Statement;
+ return true;
+ }
+ return visitNode(node);
+ }
+
@override
bool visitFunctionDeclaration(FunctionDeclaration node) {
if (identical(node.returnType, _oldNode)) {
@@ -4954,6 +5409,44 @@
return visitTypedLiteral(node);
}
+// @override
+ bool visitListLiteral2(ListLiteral2 node) {
+ if (identical(node.typeArguments, _oldNode)) {
+ (node as ListLiteral2Impl).typeArguments = _newNode as TypeArgumentList;
+ return true;
+ } else if (_replaceInList(node.elements)) {
+ return true;
+ }
+ return visitNode(node);
+ }
+
+// @override
+ bool visitMapForElement(MapForElement node) {
+ if (identical(node.forLoopParts, _oldNode)) {
+ (node as MapForElementImpl).forLoopParts = _newNode as ForLoopParts;
+ return true;
+ } else if (identical(node.body, _oldNode)) {
+ (node as MapForElementImpl).body = _newNode as MapElement;
+ return true;
+ }
+ return visitNode(node);
+ }
+
+// @override
+ bool visitMapIfElement(MapIfElement node) {
+ if (identical(node.condition, _oldNode)) {
+ (node as MapIfElementImpl).condition = _newNode as Expression;
+ return true;
+ } else if (identical(node.thenElement, _oldNode)) {
+ (node as MapIfElementImpl).thenElement = _newNode as MapElement;
+ return true;
+ } else if (identical(node.elseElement, _oldNode)) {
+ (node as MapIfElementImpl).elseElement = _newNode as MapElement;
+ return true;
+ }
+ return visitNode(node);
+ }
+
@override
bool visitMapLiteral(MapLiteral node) {
if (_replaceInList(node.entries)) {
@@ -4962,6 +5455,17 @@
return visitTypedLiteral(node);
}
+// @override
+ bool visitMapLiteral2(MapLiteral2 node) {
+ if (identical(node.typeArguments, _oldNode)) {
+ (node as MapLiteral2Impl).typeArguments = _newNode as TypeArgumentList;
+ return true;
+ } else if (_replaceInList(node.entries)) {
+ return true;
+ }
+ return visitNode(node);
+ }
+
@override
bool visitMapLiteralEntry(MapLiteralEntry node) {
if (identical(node.key, _oldNode)) {
@@ -5198,6 +5702,17 @@
return visitTypedLiteral(node);
}
+// @override
+ bool visitSetLiteral2(SetLiteral2 node) {
+ if (identical(node.typeArguments, _oldNode)) {
+ (node as SetLiteral2Impl).typeArguments = _newNode as TypeArgumentList;
+ return true;
+ } else if (_replaceInList(node.elements)) {
+ return true;
+ }
+ return visitNode(node);
+ }
+
@override
bool visitShowCombinator(ShowCombinator node) {
if (_replaceInList(node.shownNames)) {
@@ -5221,6 +5736,15 @@
@override
bool visitSimpleStringLiteral(SimpleStringLiteral node) => visitNode(node);
+// @override
+ bool visitSpreadElement(SpreadElement node) {
+ if (identical(node.expression, _oldNode)) {
+ (node as SpreadElementImpl).expression = _newNode as Expression;
+ return true;
+ }
+ return visitNode(node);
+ }
+
@override
bool visitStringInterpolation(StringInterpolation node) {
if (_replaceInList(node.elements)) {
@@ -5688,6 +6212,30 @@
_isEqualTokens(node.semicolon, toNode.semicolon));
}
+// @override
+ bool visitCollectionForElement(CollectionForElement node) {
+ CollectionForElement toNode = this._toNode as CollectionForElement;
+ return _and(
+ _isEqualTokens(node.forKeyword, toNode.forKeyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.forLoopParts, toNode.forLoopParts),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualNodes(node.body, toNode.body));
+ }
+
+// @override
+ bool visitCollectionIfElement(CollectionIfElement node) {
+ CollectionIfElement toNode = this._toNode as CollectionIfElement;
+ return _and(
+ _isEqualTokens(node.ifKeyword, toNode.ifKeyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.condition, toNode.condition),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualNodes(node.thenElement, toNode.thenElement),
+ _isEqualTokens(node.elseKeyword, toNode.elseKeyword),
+ _isEqualNodes(node.elseElement, toNode.elseElement));
+ }
+
@override
bool visitComment(Comment node) {
Comment toNode = this._toNode as Comment;
@@ -5957,7 +6505,27 @@
_isEqualNodes(node.identifier, toNode.identifier));
}
- @override
+// @override
+ bool visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) {
+ ForEachPartsWithDeclaration toNode =
+ this._toNode as ForEachPartsWithDeclaration;
+ return _and(
+ _isEqualNodes(node.loopVariable, toNode.loopVariable),
+ _isEqualTokens(node.inKeyword, toNode.inKeyword),
+ _isEqualNodes(node.iterable, toNode.iterable));
+ }
+
+// @override
+ bool visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) {
+ ForEachPartsWithIdentifier toNode =
+ this._toNode as ForEachPartsWithIdentifier;
+ return _and(
+ _isEqualNodes(node.identifier, toNode.identifier),
+ _isEqualTokens(node.inKeyword, toNode.inKeyword),
+ _isEqualNodes(node.iterable, toNode.iterable));
+ }
+
+// @override
bool visitForEachStatement(ForEachStatement node) {
ForEachStatement toNode = this._toNode as ForEachStatement;
return _and(
@@ -5982,6 +6550,28 @@
_isEqualTokens(node.rightParenthesis, toNode.rightParenthesis));
}
+// @override
+ bool visitForPartsWithDeclarations(ForPartsWithDeclarations node) {
+ ForPartsWithDeclarations toNode = this._toNode as ForPartsWithDeclarations;
+ return _and(
+ _isEqualNodes(node.variables, toNode.variables),
+ _isEqualTokens(node.leftSeparator, toNode.leftSeparator),
+ _isEqualNodes(node.condition, toNode.condition),
+ _isEqualTokens(node.rightSeparator, toNode.rightSeparator),
+ _isEqualNodeLists(node.updaters, toNode.updaters));
+ }
+
+// @override
+ bool visitForPartsWithExpression(ForPartsWithExpression node) {
+ ForPartsWithExpression toNode = this._toNode as ForPartsWithExpression;
+ return _and(
+ _isEqualNodes(node.initialization, toNode.initialization),
+ _isEqualTokens(node.leftSeparator, toNode.leftSeparator),
+ _isEqualNodes(node.condition, toNode.condition),
+ _isEqualTokens(node.rightSeparator, toNode.rightSeparator),
+ _isEqualNodeLists(node.updaters, toNode.updaters));
+ }
+
@override
bool visitForStatement(ForStatement node) {
ForStatement toNode = this._toNode as ForStatement;
@@ -5998,6 +6588,17 @@
_isEqualNodes(node.body, toNode.body));
}
+// @override
+ bool visitForStatement2(ForStatement2 node) {
+ ForStatement2 toNode = this._toNode as ForStatement2;
+ return _and(
+ _isEqualTokens(node.forKeyword, toNode.forKeyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.forLoopParts, toNode.forLoopParts),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualNodes(node.body, toNode.body));
+ }
+
@override
bool visitFunctionDeclaration(FunctionDeclaration node) {
FunctionDeclaration toNode = this._toNode as FunctionDeclaration;
@@ -6276,6 +6877,45 @@
return false;
}
+// @override
+ bool visitListLiteral2(ListLiteral2 node) {
+ ListLiteral2 toNode = this._toNode as ListLiteral2;
+ if (_and(
+ _isEqualTokens(node.constKeyword, toNode.constKeyword),
+ _isEqualNodes(node.typeArguments, toNode.typeArguments),
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodeLists(node.elements, toNode.elements),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket))) {
+ toNode.staticType = node.staticType;
+ return true;
+ }
+ return false;
+ }
+
+// @override
+ bool visitMapForElement(MapForElement node) {
+ MapForElement toNode = this._toNode as MapForElement;
+ return _and(
+ _isEqualTokens(node.forKeyword, toNode.forKeyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.forLoopParts, toNode.forLoopParts),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualNodes(node.body, toNode.body));
+ }
+
+// @override
+ bool visitMapIfElement(MapIfElement node) {
+ MapIfElement toNode = this._toNode as MapIfElement;
+ return _and(
+ _isEqualTokens(node.ifKeyword, toNode.ifKeyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.condition, toNode.condition),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualNodes(node.thenElement, toNode.thenElement),
+ _isEqualTokens(node.elseKeyword, toNode.elseKeyword),
+ _isEqualNodes(node.elseElement, toNode.elseElement));
+ }
+
@override
bool visitMapLiteral(MapLiteral node) {
MapLiteral toNode = this._toNode as MapLiteral;
@@ -6291,6 +6931,21 @@
return false;
}
+// @override
+ bool visitMapLiteral2(MapLiteral2 node) {
+ MapLiteral2 toNode = this._toNode as MapLiteral2;
+ if (_and(
+ _isEqualTokens(node.constKeyword, toNode.constKeyword),
+ _isEqualNodes(node.typeArguments, toNode.typeArguments),
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodeLists(node.entries, toNode.entries),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket))) {
+ toNode.staticType = node.staticType;
+ return true;
+ }
+ return false;
+ }
+
@override
bool visitMapLiteralEntry(MapLiteralEntry node) {
MapLiteralEntry toNode = this._toNode as MapLiteralEntry;
@@ -6544,6 +7199,21 @@
return false;
}
+// @override
+ bool visitSetLiteral2(SetLiteral2 node) {
+ SetLiteral2 toNode = this._toNode as SetLiteral2;
+ if (_and(
+ _isEqualTokens(node.constKeyword, toNode.constKeyword),
+ _isEqualNodes(node.typeArguments, toNode.typeArguments),
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodeLists(node.elements, toNode.elements),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket))) {
+ toNode.staticType = node.staticType;
+ return true;
+ }
+ return false;
+ }
+
@override
bool visitShowCombinator(ShowCombinator node) {
ShowCombinator toNode = this._toNode as ShowCombinator;
@@ -6590,6 +7260,13 @@
return false;
}
+// @override
+ bool visitSpreadElement(SpreadElement node) {
+ SpreadElement toNode = this._toNode as SpreadElement;
+ return _and(_isEqualTokens(node.spreadOperator, toNode.spreadOperator),
+ _isEqualNodes(node.expression, toNode.expression));
+ }
+
@override
bool visitStringInterpolation(StringInterpolation node) {
StringInterpolation toNode = this._toNode as StringInterpolation;
@@ -6991,6 +7668,12 @@
}
@override
+ void visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) {
+ _addToScope(node.loopVariable.identifier);
+ super.visitForEachPartsWithDeclaration(node);
+ }
+
+ @override
void visitForEachStatement(ForEachStatement node) {
DeclaredIdentifier loopVariable = node.loopVariable;
if (loopVariable != null) {
@@ -7000,6 +7683,12 @@
}
@override
+ void visitForPartsWithDeclarations(ForPartsWithDeclarations node) {
+ _addVariables(node.variables.variables);
+ super.visitForPartsWithDeclarations(node);
+ }
+
+ @override
void visitForStatement(ForStatement node) {
if (!identical(_immediateChild, node.variables) && node.variables != null) {
_addVariables(node.variables.variables);
@@ -7292,6 +7981,23 @@
_writer.print(";");
}
+// @override
+ void visitCollectionForElement(CollectionForElement node) {
+ _writer.print('for (');
+ _visitNode(node.forLoopParts);
+ _writer.print(') ');
+ _visitNode(node.body);
+ }
+
+// @override
+ void visitCollectionIfElement(CollectionIfElement node) {
+ _writer.print('if (');
+ _visitNode(node.condition);
+ _writer.print(') ');
+ _visitNode(node.thenElement);
+ _visitNodeWithPrefix(' else ', node.elseElement);
+ }
+
@override
void visitComment(Comment node) {}
@@ -7482,6 +8188,20 @@
_visitNode(node.parameters);
}
+// @override
+ void visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) {
+ _visitNode(node.loopVariable);
+ _writer.print(' in ');
+ _visitNode(node.iterable);
+ }
+
+// @override
+ void visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) {
+ _visitNode(node.identifier);
+ _writer.print(' in ');
+ _visitNode(node.iterable);
+ }
+
@override
void visitForEachStatement(ForEachStatement node) {
DeclaredIdentifier loopVariable = node.loopVariable;
@@ -7528,6 +8248,24 @@
_writer.print(')');
}
+// @override
+ void visitForPartsWithDeclarations(ForPartsWithDeclarations node) {
+ _visitNode(node.variables);
+ _writer.print(';');
+ _visitNodeWithPrefix(' ', node.condition);
+ _writer.print(';');
+ _visitNodeListWithSeparatorAndPrefix(' ', node.updaters, ', ');
+ }
+
+// @override
+ void visitForPartsWithExpression(ForPartsWithExpression node) {
+ _visitNode(node.initialization);
+ _writer.print(';');
+ _visitNodeWithPrefix(' ', node.condition);
+ _writer.print(';');
+ _visitNodeListWithSeparatorAndPrefix(" ", node.updaters, ', ');
+ }
+
@override
void visitForStatement(ForStatement node) {
Expression initialization = node.initialization;
@@ -7545,6 +8283,14 @@
_visitNode(node.body);
}
+// @override
+ void visitForStatement2(ForStatement2 node) {
+ _writer.print('for (');
+ _visitNode(node.forLoopParts);
+ _writer.print(') ');
+ _visitNode(node.body);
+ }
+
@override
void visitFunctionDeclaration(FunctionDeclaration node) {
_visitNodeListWithSeparatorAndSuffix(node.metadata, " ", " ");
@@ -7742,6 +8488,32 @@
_writer.print("]");
}
+// @override
+ void visitListLiteral2(ListLiteral2 node) {
+ _visitTokenWithSuffix(node.constKeyword, ' ');
+ _visitNode(node.typeArguments);
+ _writer.print('[');
+ _visitNodeListWithSeparator(node.elements, ', ');
+ _writer.print(']');
+ }
+
+// @override
+ void visitMapForElement(MapForElement node) {
+ _writer.print('for (');
+ _visitNode(node.forLoopParts);
+ _writer.print(') ');
+ _visitNode(node.body);
+ }
+
+// @override
+ void visitMapIfElement(MapIfElement node) {
+ _writer.print('if (');
+ _visitNode(node.condition);
+ _writer.print(') ');
+ _visitNode(node.thenElement);
+ _visitNodeWithPrefix(' else ', node.elseElement);
+ }
+
@override
void visitMapLiteral(MapLiteral node) {
if (node.constKeyword != null) {
@@ -7754,6 +8526,15 @@
_writer.print("}");
}
+// @override
+ void visitMapLiteral2(MapLiteral2 node) {
+ _visitTokenWithSuffix(node.constKeyword, ' ');
+ _visitNode(node.typeArguments);
+ _writer.print('{');
+ _visitNodeListWithSeparator(node.entries, ', ');
+ _writer.print('}');
+ }
+
@override
void visitMapLiteralEntry(MapLiteralEntry node) {
_visitNode(node.key);
@@ -7930,6 +8711,15 @@
_writer.print("}");
}
+// @override
+ void visitSetLiteral2(SetLiteral2 node) {
+ _visitTokenWithSuffix(node.constKeyword, ' ');
+ _visitNode(node.typeArguments);
+ _writer.print('{');
+ _visitNodeListWithSeparator(node.elements, ', ');
+ _writer.print('}');
+ }
+
@override
void visitShowCombinator(ShowCombinator node) {
_writer.print("show ");
@@ -7958,6 +8748,12 @@
_writer.print(node.literal.lexeme);
}
+// @override
+ void visitSpreadElement(SpreadElement node) {
+ _writer.print(node.spreadOperator.lexeme);
+ _visitNode(node.expression);
+ }
+
@override
void visitStringInterpolation(StringInterpolation node) {
_visitNodeList(node.elements);
@@ -8529,6 +9325,23 @@
sink.write(";");
}
+// @override
+ void visitCollectionForElement(CollectionForElement node) {
+ sink.write('for (');
+ safelyVisitNode(node.forLoopParts);
+ sink.write(') ');
+ safelyVisitNode(node.body);
+ }
+
+// @override
+ void visitCollectionIfElement(CollectionIfElement node) {
+ sink.write('if (');
+ safelyVisitNode(node.condition);
+ sink.write(') ');
+ safelyVisitNode(node.thenElement);
+ safelyVisitNodeWithPrefix(' else ', node.elseElement);
+ }
+
@override
void visitComment(Comment node) {}
@@ -8719,6 +9532,20 @@
safelyVisitNode(node.parameters);
}
+// @override
+ void visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) {
+ safelyVisitNode(node.loopVariable);
+ sink.write(' in ');
+ safelyVisitNode(node.iterable);
+ }
+
+// @override
+ void visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) {
+ safelyVisitNode(node.identifier);
+ sink.write(' in ');
+ safelyVisitNode(node.iterable);
+ }
+
@override
void visitForEachStatement(ForEachStatement node) {
DeclaredIdentifier loopVariable = node.loopVariable;
@@ -8765,6 +9592,24 @@
sink.write(')');
}
+// @override
+ void visitForPartsWithDeclarations(ForPartsWithDeclarations node) {
+ safelyVisitNode(node.variables);
+ sink.write(';');
+ safelyVisitNodeWithPrefix(' ', node.condition);
+ sink.write(';');
+ safelyVisitNodeListWithSeparatorAndPrefix(' ', node.updaters, ', ');
+ }
+
+// @override
+ void visitForPartsWithExpression(ForPartsWithExpression node) {
+ safelyVisitNode(node.initialization);
+ sink.write(';');
+ safelyVisitNodeWithPrefix(' ', node.condition);
+ sink.write(';');
+ safelyVisitNodeListWithSeparatorAndPrefix(" ", node.updaters, ', ');
+ }
+
@override
void visitForStatement(ForStatement node) {
Expression initialization = node.initialization;
@@ -8782,6 +9627,14 @@
safelyVisitNode(node.body);
}
+// @override
+ void visitForStatement2(ForStatement2 node) {
+ sink.write('for (');
+ safelyVisitNode(node.forLoopParts);
+ sink.write(') ');
+ safelyVisitNode(node.body);
+ }
+
@override
void visitFunctionDeclaration(FunctionDeclaration node) {
safelyVisitNodeListWithSeparatorAndSuffix(node.metadata, " ", " ");
@@ -8969,28 +9822,57 @@
@override
void visitListLiteral(ListLiteral node) {
- if (node.constKeyword != null) {
- sink.write(node.constKeyword.lexeme);
- sink.write(' ');
- }
+ safelyVisitTokenWithSuffix(node.constKeyword, ' ');
safelyVisitNodeWithSuffix(node.typeArguments, " ");
sink.write("[");
safelyVisitNodeListWithSeparator(node.elements, ", ");
sink.write("]");
}
+// @override
+ void visitListLiteral2(ListLiteral2 node) {
+ safelyVisitTokenWithSuffix(node.constKeyword, ' ');
+ safelyVisitNode(node.typeArguments);
+ sink.write('[');
+ safelyVisitNodeListWithSeparator(node.elements, ', ');
+ sink.write(']');
+ }
+
+// @override
+ void visitMapForElement(MapForElement node) {
+ sink.write('for (');
+ safelyVisitNode(node.forLoopParts);
+ sink.write(') ');
+ safelyVisitNode(node.body);
+ }
+
+// @override
+ void visitMapIfElement(MapIfElement node) {
+ sink.write('if (');
+ safelyVisitNode(node.condition);
+ sink.write(') ');
+ safelyVisitNode(node.thenElement);
+ safelyVisitNodeWithPrefix(' else ', node.elseElement);
+ }
+
@override
void visitMapLiteral(MapLiteral node) {
- if (node.constKeyword != null) {
- sink.write(node.constKeyword.lexeme);
- sink.write(' ');
- }
+ safelyVisitTokenWithSuffix(node.constKeyword, ' ');
safelyVisitNodeWithSuffix(node.typeArguments, " ");
sink.write("{");
safelyVisitNodeListWithSeparator(node.entries, ", ");
sink.write("}");
}
+// @override
+ void visitMapLiteral2(MapLiteral2 node) {
+ safelyVisitTokenWithSuffix(node.constKeyword, ' ');
+ safelyVisitNode(node.typeArguments);
+ sink.write('{');
+ safelyVisitNodeListWithSeparator(node.entries, ', ');
+ sink.write('}');
+ }
+
@override
void visitMapLiteralEntry(MapLiteralEntry node) {
safelyVisitNode(node.key);
@@ -9157,16 +10039,22 @@
@override
void visitSetLiteral(SetLiteral node) {
- if (node.constKeyword != null) {
- sink.write(node.constKeyword.lexeme);
- sink.write(' ');
- }
+ safelyVisitTokenWithSuffix(node.constKeyword, ' ');
safelyVisitNodeWithSuffix(node.typeArguments, " ");
sink.write("{");
safelyVisitNodeListWithSeparator(node.elements, ", ");
sink.write("}");
}
+// @override
+ void visitSetLiteral2(SetLiteral2 node) {
+ safelyVisitTokenWithSuffix(node.constKeyword, ' ');
+ safelyVisitNode(node.typeArguments);
+ sink.write('{');
+ safelyVisitNodeListWithSeparator(node.elements, ', ');
+ sink.write('}');
+ }
+
@override
void visitShowCombinator(ShowCombinator node) {
sink.write("show ");
@@ -9195,6 +10083,12 @@
sink.write(node.literal.lexeme);
}
+// @override
+ void visitSpreadElement(SpreadElement node) {
+ sink.write(node.spreadOperator.lexeme);
+ safelyVisitNode(node.expression);
+ }
+
@override
void visitStringInterpolation(StringInterpolation node) {
safelyVisitNodeList(node.elements);
diff --git a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
index 824767b..b6f7ccd 100644
--- a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
@@ -842,6 +842,10 @@
astFactory.mapLiteralEntry(
key, TokenFactory.tokenFromType(TokenType.COLON), value);
+ static MapLiteralEntry mapLiteralEntry3(String key, String value) =>
+ astFactory.mapLiteralEntry(string2(key),
+ TokenFactory.tokenFromType(TokenType.COLON), string2(value));
+
static MethodDeclaration methodDeclaration(
Keyword modifier,
TypeAnnotation returnType,
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index d8063b5..a165d8d 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -6420,6 +6420,49 @@
/// Unused, see [_defineClass].
@override
visitWithClause(node) => _unreachable(node);
+
+// @override
+ visitCollectionForElement(CollectionForElement node) => _unreachable(node);
+
+// @override
+ visitCollectionIfElement(CollectionIfElement node) => _unreachable(node);
+
+// @override
+ visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) =>
+ _unreachable(node);
+
+// @override
+ visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) =>
+ _unreachable(node);
+
+// @override
+ visitForStatement2(ForStatement2 node) => _unreachable(node);
+
+// @override
+ visitListLiteral2(ListLiteral2 node) => _unreachable(node);
+
+// @override
+ visitMapForElement(MapForElement node) => _unreachable(node);
+
+// @override
+ visitMapIfElement(MapIfElement node) => _unreachable(node);
+
+// @override
+ visitMapLiteral2(MapLiteral2 node) => _unreachable(node);
+
+// @override
+ visitSetLiteral2(SetLiteral2 node) => _unreachable(node);
+
+// @override
+ visitSpreadElement(SpreadElement node) => _unreachable(node);
+
+// @override
+ visitForPartsWithDeclarations(ForPartsWithDeclarations node) =>
+ _unreachable(node);
+
+// @override
+ visitForPartsWithExpression(ForPartsWithExpression node) =>
+ _unreachable(node);
}
/// Choose a canonical name from the [library] element.