mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-17 10:31:20 -06:00
Parsing of spread element expressions
This commit is contained in:
parent
bb70e9eb12
commit
ebc7e7e0e3
@ -4553,6 +4553,7 @@ module ts {
|
||||
case SyntaxKind.VoidExpression:
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.SpreadElementExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
@ -8876,6 +8877,7 @@ module ts {
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.SpreadElementExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.VariableStatement:
|
||||
|
||||
@ -356,6 +356,8 @@ module ts {
|
||||
return child((<ConditionalExpression>node).condition) ||
|
||||
child((<ConditionalExpression>node).whenTrue) ||
|
||||
child((<ConditionalExpression>node).whenFalse);
|
||||
case SyntaxKind.SpreadElementExpression:
|
||||
return child((<SpreadElementExpression>node).expression);
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
@ -622,6 +624,7 @@ module ts {
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.SpreadElementExpression:
|
||||
case SyntaxKind.TemplateExpression:
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
case SyntaxKind.OmittedExpression:
|
||||
@ -3354,8 +3357,15 @@ module ts {
|
||||
: parseAssignmentExpressionOrHigher();
|
||||
}
|
||||
|
||||
function parseSpreadElement(): Expression {
|
||||
var node = <SpreadElementExpression>createNode(SyntaxKind.SpreadElementExpression);
|
||||
parseExpected(SyntaxKind.DotDotDotToken);
|
||||
node.expression = parseAssignmentExpressionOrHigher();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseArrayLiteralElement(): Expression {
|
||||
return parseAssignmentExpressionOrOmittedExpression();
|
||||
return token === SyntaxKind.DotDotDotToken ? parseSpreadElement() : parseAssignmentExpressionOrOmittedExpression();
|
||||
}
|
||||
|
||||
function parseArgumentExpression(): Expression {
|
||||
|
||||
@ -192,6 +192,7 @@ module ts {
|
||||
ConditionalExpression,
|
||||
TemplateExpression,
|
||||
YieldExpression,
|
||||
SpreadElementExpression,
|
||||
OmittedExpression,
|
||||
// Misc
|
||||
TemplateSpan,
|
||||
@ -649,7 +650,11 @@ module ts {
|
||||
export interface ArrayLiteralExpression extends PrimaryExpression {
|
||||
elements: NodeArray<Expression>;
|
||||
}
|
||||
|
||||
|
||||
export interface SpreadElementExpression extends Expression {
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
// An ObjectLiteralExpression is the declaration node for an anonymous symbol.
|
||||
export interface ObjectLiteralExpression extends PrimaryExpression, Declaration {
|
||||
properties: NodeArray<ObjectLiteralElement>;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user