Skip to content
Merged
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
3 changes: 3 additions & 0 deletions _packages/api/src/node/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,9 @@ export class RemoteNode extends RemoteNodeBase implements Node {
get declarationList(): RemoteNode | undefined {
return this.getNamedChild("declarationList") as RemoteNode;
}
get declarations(): RemoteNode | undefined {
return this.getNamedChild("declarations") as RemoteNode;
}
get default(): RemoteNode | undefined {
return this.getNamedChild("default") as RemoteNode;
}
Expand Down
1 change: 1 addition & 0 deletions _packages/api/src/node/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const childProperties: Readonly<Partial<Record<SyntaxKind, readonly strin
[SyntaxKind.CatchClause]: ["variableDeclaration", "block"],
[SyntaxKind.LabeledStatement]: ["label", "statement"],
[SyntaxKind.VariableStatement]: ["modifiers", "declarationList"],
[SyntaxKind.VariableDeclarationList]: ["declarations"],
[SyntaxKind.VariableDeclaration]: ["name", "exclamationToken", "type", "initializer"],
[SyntaxKind.Parameter]: ["modifiers", "dotDotDotToken", "name", "questionToken", "type", "initializer"],
[SyntaxKind.BindingElement]: ["dotDotDotToken", "propertyName", "name", "initializer"],
Expand Down
3 changes: 3 additions & 0 deletions internal/api/encoder/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@ func getChildrenPropertyMask(node *ast.Node) uint8 {
case ast.KindVariableStatement:
n := node.AsVariableStatement()
return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.DeclarationList != nil) << 1)
case ast.KindVariableDeclarationList:
n := node.AsVariableDeclarationList()
return (boolToByte(n.Declarations != nil) << 0)
case ast.KindVariableDeclaration:
n := node.AsVariableDeclaration()
return (boolToByte(n.Name() != nil) << 0) | (boolToByte(n.ExclamationToken != nil) << 1) | (boolToByte(n.Type != nil) << 2) | (boolToByte(n.Initializer != nil) << 3)
Expand Down