Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _packages/api/src/node/protocol.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export const childProperties: Readonly<Partial<Record<SyntaxKind, readonly (stri
[SyntaxKind.TemplateLiteralTypeSpan]: ["type", "literal"],
[SyntaxKind.SyntheticExpression]: ["tupleNameSource"],
[SyntaxKind.PartiallyEmittedExpression]: ["expression"],
[SyntaxKind.CommaListExpression]: ["elements"],
[SyntaxKind.JsxElement]: ["openingElement", "children", "closingElement"],
[SyntaxKind.JsxAttributes]: ["properties"],
[SyntaxKind.JsxNamespacedName]: ["namespace", "name"],
Expand Down Expand Up @@ -228,6 +229,7 @@ export const singleChildNodePropertyNames: Readonly<Partial<Record<SyntaxKind, s
[SyntaxKind.ParenthesizedType]: "type",
[SyntaxKind.SyntheticExpression]: "tupleNameSource",
[SyntaxKind.PartiallyEmittedExpression]: "expression",
[SyntaxKind.CommaListExpression]: "elements",
[SyntaxKind.JsxAttributes]: "properties",
[SyntaxKind.JsxSpreadAttribute]: "expression",
[SyntaxKind.JsxClosingElement]: "tagName",
Expand Down
4 changes: 4 additions & 0 deletions _packages/ast/src/ast.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,10 @@ export interface PartiallyEmittedExpression extends LeftHandSideExpressionBase {
readonly kind: SyntaxKind.PartiallyEmittedExpression;
readonly expression: Expression;
}
export interface CommaListExpression extends ExpressionBase {
readonly kind: SyntaxKind.CommaListExpression;
readonly elements: NodeArray<Expression>;
}
export interface JsxElement extends PrimaryExpressionBase {
readonly kind: SyntaxKind.JsxElement;
readonly openingElement: JsxOpeningElement;
Expand Down
7 changes: 4 additions & 3 deletions _packages/ast/src/enums/syntaxKind.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,10 @@ export enum SyntaxKind {
JSImportDeclaration = 348,
NotEmittedStatement = 349,
PartiallyEmittedExpression = 350,
SyntheticReferenceExpression = 351,
NotEmittedTypeElement = 352,
Count = 353,
CommaListExpression = 351,
SyntheticReferenceExpression = 352,
NotEmittedTypeElement = 353,
Count = 354,
FirstAssignment = EqualsToken,
LastAssignment = CaretEqualsToken,
FirstCompoundAssignment = PlusEqualsToken,
Expand Down
7 changes: 4 additions & 3 deletions _packages/ast/src/enums/syntaxKind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,10 @@ export var SyntaxKind: any;
SyntaxKind[SyntaxKind["JSImportDeclaration"] = 348] = "JSImportDeclaration";
SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement";
SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression";
SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 351] = "SyntheticReferenceExpression";
SyntaxKind[SyntaxKind["NotEmittedTypeElement"] = 352] = "NotEmittedTypeElement";
SyntaxKind[SyntaxKind["Count"] = 353] = "Count";
SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression";
SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 352] = "SyntheticReferenceExpression";
SyntaxKind[SyntaxKind["NotEmittedTypeElement"] = 353] = "NotEmittedTypeElement";
SyntaxKind[SyntaxKind["Count"] = 354] = "Count";
SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment";
SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 64] = "FirstCompoundAssignment";
Expand Down
14 changes: 14 additions & 0 deletions _packages/ast/src/factory.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import type {
ClassExpression,
ClassStaticBlockDeclaration,
ColonToken,
CommaListExpression,
CommonJSExport,
ComputedPropertyName,
ConciseBody,
Expand Down Expand Up @@ -943,6 +944,8 @@ function cloneNodeData(node: Node): any {
return { type: n.type, isSpread: n.isSpread, tupleNameSource: n.tupleNameSource };
case SyntaxKind.PartiallyEmittedExpression:
return { expression: n.expression };
case SyntaxKind.CommaListExpression:
return { elements: n.elements };
case SyntaxKind.JsxElement:
return { openingElement: n.openingElement, children: n.children, closingElement: n.closingElement };
case SyntaxKind.JsxAttributes:
Expand Down Expand Up @@ -1440,6 +1443,7 @@ const forEachChildTable: Record<number, ForEachChildFunction> = {
visitNode(cbNode, data.literal),
[SyntaxKind.SyntheticExpression]: (data, cbNode, cbNodes) => visitNode(cbNode, data.tupleNameSource),
[SyntaxKind.PartiallyEmittedExpression]: (data, cbNode, cbNodes) => visitNode(cbNode, data.expression),
[SyntaxKind.CommaListExpression]: (data, cbNode, cbNodes) => visitNodes(cbNode, cbNodes, data.elements),
[SyntaxKind.JsxElement]: (data, cbNode, cbNodes) =>
visitNode(cbNode, data.openingElement) ||
visitNodes(cbNode, cbNodes, data.children) ||
Expand Down Expand Up @@ -2617,6 +2621,12 @@ export function createPartiallyEmittedExpression(expression: Expression): Partia
}) as unknown as PartiallyEmittedExpression;
}

export function createCommaListExpression(elements: readonly Expression[]): CommaListExpression {
return new NodeObject(SyntaxKind.CommaListExpression, {
elements: createNodeArray(elements),
}) as unknown as CommaListExpression;
}

export function createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement {
return new NodeObject(SyntaxKind.JsxElement, {
openingElement,
Expand Down Expand Up @@ -3541,6 +3551,10 @@ export function updatePartiallyEmittedExpression(node: PartiallyEmittedExpressio
return node.expression !== expression ? createPartiallyEmittedExpression(expression) : node;
}

export function updateCommaListExpression(node: CommaListExpression, elements: readonly Expression[]): CommaListExpression {
return node.elements !== elements ? createCommaListExpression(elements) : node;
}

export function updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement {
return node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement ? createJsxElement(openingElement, children, closingElement) : node;
}
Expand Down
5 changes: 5 additions & 0 deletions _packages/ast/src/is.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import type {
ClassLikeDeclaration,
ClassStaticBlockDeclaration,
ColonToken,
CommaListExpression,
CommonJSExport,
CompoundAssignmentOperator,
ComputedPropertyName,
Expand Down Expand Up @@ -872,6 +873,10 @@ export function isPartiallyEmittedExpression(node: Node): node is PartiallyEmitt
return node.kind === SyntaxKind.PartiallyEmittedExpression;
}

export function isCommaListExpression(node: Node): node is CommaListExpression {
return node.kind === SyntaxKind.CommaListExpression;
}

export function isJsxElement(node: Node): node is JsxElement {
return node.kind === SyntaxKind.JsxElement;
}
Expand Down
6 changes: 6 additions & 0 deletions _packages/ast/src/visitor.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
ClassDeclaration,
ClassExpression,
ClassStaticBlockDeclaration,
CommaListExpression,
CommonJSExport,
ComputedPropertyName,
ConditionalExpression,
Expand Down Expand Up @@ -197,6 +198,7 @@ import {
updateClassDeclaration,
updateClassExpression,
updateClassStaticBlockDeclaration,
updateCommaListExpression,
updateCommonJSExport,
updateComputedPropertyName,
updateConditionalExpression,
Expand Down Expand Up @@ -1134,6 +1136,10 @@ const visitEachChildTable: Record<number, VisitEachChildFunction> = {
const _expression = visitNode(node.expression, visitor, isExpression);
return updatePartiallyEmittedExpression(node, _expression);
},
[SyntaxKind.CommaListExpression]: (node: CommaListExpression, visitor: Visitor): CommaListExpression => {
const _elements = visitNodes(node.elements, visitor);
return updateCommaListExpression(node, _elements);
},
[SyntaxKind.JsxElement]: (node: JsxElement, visitor: Visitor): JsxElement => {
const _openingElement = visitNode(node.openingElement, visitor, isJsxOpeningElement);
const _children = visitNodes(node.children, visitor);
Expand Down
14 changes: 14 additions & 0 deletions _scripts/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@
},
"NotEmittedStatement",
"PartiallyEmittedExpression",
"CommaListExpression",
"SyntheticReferenceExpression",
"NotEmittedTypeElement"
],
Expand Down Expand Up @@ -4076,6 +4077,19 @@
}
]
},
"CommaListExpression": {
"generateSubtreeFacts": true,
"extends": [
"ExpressionBase"
],
"members": [
{
"name": "Elements",
"type": "Expression",
"list": "NodeList"
}
]
},
"JsxElement": {
"extends": [
"PrimaryExpressionBase",
Expand Down
2 changes: 2 additions & 0 deletions internal/api/encoder/decoder_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions internal/api/encoder/encoder_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,8 @@ func (n *Node) ElementList() *NodeList {
return n.AsArrayLiteralExpression().Elements
case KindTupleType:
return n.AsTupleTypeNode().Elements
case KindCommaListExpression:
return n.AsCommaListExpression().Elements
}
panic("Unhandled case in Node.ElementList: " + n.Kind.String())
}
Expand Down
47 changes: 47 additions & 0 deletions internal/ast/ast_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/ast/kind_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading