From ffb0e2a8c00deb183c50b537204117294a6140dc Mon Sep 17 00:00:00 2001 From: Sam Vervaeck Date: Tue, 26 May 2020 21:01:38 +0200 Subject: [PATCH] Major update to code base - Extended and fixed some issues in the parser - Complete rewrite of TypeChecker as a SymbolResolver - Created basic structure for a new class TypeChecker - Introduces verification passes - Updated frontend and all bits depending on it --- Makefile | 2 +- src/ast-spec.txt | 10 +- src/ast.d.ts | 5970 ++++++++++++++++++++++++++++++++--- src/bin/bolt.ts | 13 +- src/checker.ts | 883 ------ src/checks.ts | 149 + src/common.ts | 48 +- src/emitter.ts | 2 +- src/evaluator.ts | 201 +- src/frontend.ts | 84 +- src/parser.ts | 60 +- src/resolver.ts | 497 +++ src/transforms/boltToJS.ts | 13 +- src/transforms/constFold.ts | 7 +- src/transforms/expand.ts | 8 +- src/types.ts | 155 +- src/util.ts | 20 +- 17 files changed, 6638 insertions(+), 1484 deletions(-) delete mode 100644 src/checker.ts create mode 100644 src/checks.ts create mode 100644 src/resolver.ts diff --git a/Makefile b/Makefile index 23827da5e..520b4cc20 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ TREEGEN_FILES = src/ast-spec.txt lib/bin/bolt-treegen.js lib/treegen/parser.js lib/treegen/index.js lib/treegen/util.js src/treegen/ast-template.js all: lib/ast.js - bolt bundle stdlib + bolt check stdlib lib/ast.js: $(TREEGEN_FILES) @echo "Generating AST definitions ..." diff --git a/src/ast-spec.txt b/src/ast-spec.txt index aa011c24a..dcba9fb7b 100644 --- a/src/ast-spec.txt +++ b/src/ast-spec.txt @@ -92,7 +92,6 @@ node BoltSourceFile > SourceFile { node BoltQualName { modulePath: Option>, - name: BoltSymbol, } node BoltModulePath { @@ -156,11 +155,16 @@ node BoltRecordPattern > BoltPattern { node BoltExpression; node BoltQuoteExpression > BoltExpression { - tokens: Vec, + tokens: Vec, +} + +node BoltTupleExpression > BoltExpression { + elements: Vec, } node BoltReferenceExpression > BoltExpression { - name: BoltQualName, + modulePath: Option, + name: BoltSymbol, } node BoltMemberExpression > BoltExpression { diff --git a/src/ast.d.ts b/src/ast.d.ts index 83854216d..9dbdf068a 100644 --- a/src/ast.d.ts +++ b/src/ast.d.ts @@ -1,6 +1,5 @@ -import { Type } from "./types" -import { ScopeInfo } from "./checker" +import { TypeInfo } from "./types" import { Package } from "./common" import { TextSpan } from "./text" @@ -10,19 +9,179 @@ export type SyntaxRange = [Syntax, Syntax]; export function isSyntax(value: any): value is Syntax; -interface SyntaxBase { +interface SyntaxBase { id: number; - _scope?: ScopeInfo; - kind: K; - parentNode: ParentTypesOf | null; + kind: SyntaxKind; + _typeInfo: TypeInfo; + parentNode: Syntax | null; span: TextSpan | null; - getChildNodes(): IterableIterator>, + visit(visitors: NodeVisitor[]): void; + preorder(): IterableIterator; + getParentOfKind(kind: K1): ResolveSyntaxKind | null; + getChildNodes(): IterableIterator, findAllChildrenOfKind(kind: K1): IterableIterator>; } export type ResolveSyntaxKind = Extract; +export class NodeVisitor { + public visit(node: Syntax): void; + protected visitEndOfFile?(node: EndOfFile): void; + protected visitFunctionBody?(node: FunctionBody): void; + protected visitBoltStringLiteral?(node: BoltStringLiteral): void; + protected visitBoltIntegerLiteral?(node: BoltIntegerLiteral): void; + protected visitBoltIdentifier?(node: BoltIdentifier): void; + protected visitBoltOperator?(node: BoltOperator): void; + protected visitBoltAssignment?(node: BoltAssignment): void; + protected visitBoltComma?(node: BoltComma): void; + protected visitBoltSemi?(node: BoltSemi): void; + protected visitBoltColon?(node: BoltColon): void; + protected visitBoltColonColon?(node: BoltColonColon): void; + protected visitBoltDot?(node: BoltDot): void; + protected visitBoltDotDot?(node: BoltDotDot): void; + protected visitBoltRArrow?(node: BoltRArrow): void; + protected visitBoltRArrowAlt?(node: BoltRArrowAlt): void; + protected visitBoltLArrow?(node: BoltLArrow): void; + protected visitBoltEqSign?(node: BoltEqSign): void; + protected visitBoltGtSign?(node: BoltGtSign): void; + protected visitBoltExMark?(node: BoltExMark): void; + protected visitBoltLtSign?(node: BoltLtSign): void; + protected visitBoltVBar?(node: BoltVBar): void; + protected visitBoltWhereKeyword?(node: BoltWhereKeyword): void; + protected visitBoltQuoteKeyword?(node: BoltQuoteKeyword): void; + protected visitBoltFnKeyword?(node: BoltFnKeyword): void; + protected visitBoltForeignKeyword?(node: BoltForeignKeyword): void; + protected visitBoltForKeyword?(node: BoltForKeyword): void; + protected visitBoltLetKeyword?(node: BoltLetKeyword): void; + protected visitBoltReturnKeyword?(node: BoltReturnKeyword): void; + protected visitBoltLoopKeyword?(node: BoltLoopKeyword): void; + protected visitBoltYieldKeyword?(node: BoltYieldKeyword): void; + protected visitBoltMatchKeyword?(node: BoltMatchKeyword): void; + protected visitBoltImportKeyword?(node: BoltImportKeyword): void; + protected visitBoltExportKeyword?(node: BoltExportKeyword): void; + protected visitBoltPubKeyword?(node: BoltPubKeyword): void; + protected visitBoltModKeyword?(node: BoltModKeyword): void; + protected visitBoltMutKeyword?(node: BoltMutKeyword): void; + protected visitBoltEnumKeyword?(node: BoltEnumKeyword): void; + protected visitBoltStructKeyword?(node: BoltStructKeyword): void; + protected visitBoltTypeKeyword?(node: BoltTypeKeyword): void; + protected visitBoltTraitKeyword?(node: BoltTraitKeyword): void; + protected visitBoltImplKeyword?(node: BoltImplKeyword): void; + protected visitBoltParenthesized?(node: BoltParenthesized): void; + protected visitBoltBraced?(node: BoltBraced): void; + protected visitBoltBracketed?(node: BoltBracketed): void; + protected visitBoltSourceFile?(node: BoltSourceFile): void; + protected visitBoltQualName?(node: BoltQualName): void; + protected visitBoltModulePath?(node: BoltModulePath): void; + protected visitBoltReferenceTypeExpression?(node: BoltReferenceTypeExpression): void; + protected visitBoltFunctionTypeExpression?(node: BoltFunctionTypeExpression): void; + protected visitBoltTypeParameter?(node: BoltTypeParameter): void; + protected visitBoltBindPattern?(node: BoltBindPattern): void; + protected visitBoltTypePattern?(node: BoltTypePattern): void; + protected visitBoltExpressionPattern?(node: BoltExpressionPattern): void; + protected visitBoltTuplePatternElement?(node: BoltTuplePatternElement): void; + protected visitBoltTuplePattern?(node: BoltTuplePattern): void; + protected visitBoltRecordFieldPattern?(node: BoltRecordFieldPattern): void; + protected visitBoltRecordPattern?(node: BoltRecordPattern): void; + protected visitBoltQuoteExpression?(node: BoltQuoteExpression): void; + protected visitBoltTupleExpression?(node: BoltTupleExpression): void; + protected visitBoltReferenceExpression?(node: BoltReferenceExpression): void; + protected visitBoltMemberExpression?(node: BoltMemberExpression): void; + protected visitBoltFunctionExpression?(node: BoltFunctionExpression): void; + protected visitBoltCallExpression?(node: BoltCallExpression): void; + protected visitBoltYieldExpression?(node: BoltYieldExpression): void; + protected visitBoltMatchArm?(node: BoltMatchArm): void; + protected visitBoltMatchExpression?(node: BoltMatchExpression): void; + protected visitBoltCase?(node: BoltCase): void; + protected visitBoltCaseExpression?(node: BoltCaseExpression): void; + protected visitBoltBlockExpression?(node: BoltBlockExpression): void; + protected visitBoltConstantExpression?(node: BoltConstantExpression): void; + protected visitBoltReturnStatement?(node: BoltReturnStatement): void; + protected visitBoltConditionalCase?(node: BoltConditionalCase): void; + protected visitBoltConditionalStatement?(node: BoltConditionalStatement): void; + protected visitBoltResumeStatement?(node: BoltResumeStatement): void; + protected visitBoltExpressionStatement?(node: BoltExpressionStatement): void; + protected visitBoltParameter?(node: BoltParameter): void; + protected visitBoltModule?(node: BoltModule): void; + protected visitBoltFunctionDeclaration?(node: BoltFunctionDeclaration): void; + protected visitBoltVariableDeclaration?(node: BoltVariableDeclaration): void; + protected visitBoltPlainImportSymbol?(node: BoltPlainImportSymbol): void; + protected visitBoltImportDirective?(node: BoltImportDirective): void; + protected visitBoltExportSymbol?(node: BoltExportSymbol): void; + protected visitBoltPlainExportSymbol?(node: BoltPlainExportSymbol): void; + protected visitBoltExportDirective?(node: BoltExportDirective): void; + protected visitBoltTraitDeclaration?(node: BoltTraitDeclaration): void; + protected visitBoltImplDeclaration?(node: BoltImplDeclaration): void; + protected visitBoltTypeAliasDeclaration?(node: BoltTypeAliasDeclaration): void; + protected visitBoltRecordField?(node: BoltRecordField): void; + protected visitBoltRecordDeclaration?(node: BoltRecordDeclaration): void; + protected visitBoltMacroCall?(node: BoltMacroCall): void; + protected visitJSOperator?(node: JSOperator): void; + protected visitJSIdentifier?(node: JSIdentifier): void; + protected visitJSString?(node: JSString): void; + protected visitJSInteger?(node: JSInteger): void; + protected visitJSFromKeyword?(node: JSFromKeyword): void; + protected visitJSReturnKeyword?(node: JSReturnKeyword): void; + protected visitJSTryKeyword?(node: JSTryKeyword): void; + protected visitJSFinallyKeyword?(node: JSFinallyKeyword): void; + protected visitJSCatchKeyword?(node: JSCatchKeyword): void; + protected visitJSImportKeyword?(node: JSImportKeyword): void; + protected visitJSAsKeyword?(node: JSAsKeyword): void; + protected visitJSConstKeyword?(node: JSConstKeyword): void; + protected visitJSLetKeyword?(node: JSLetKeyword): void; + protected visitJSExportKeyword?(node: JSExportKeyword): void; + protected visitJSFunctionKeyword?(node: JSFunctionKeyword): void; + protected visitJSWhileKeyword?(node: JSWhileKeyword): void; + protected visitJSForKeyword?(node: JSForKeyword): void; + protected visitJSCloseBrace?(node: JSCloseBrace): void; + protected visitJSCloseBracket?(node: JSCloseBracket): void; + protected visitJSCloseParen?(node: JSCloseParen): void; + protected visitJSOpenBrace?(node: JSOpenBrace): void; + protected visitJSOpenBracket?(node: JSOpenBracket): void; + protected visitJSOpenParen?(node: JSOpenParen): void; + protected visitJSSemi?(node: JSSemi): void; + protected visitJSComma?(node: JSComma): void; + protected visitJSDot?(node: JSDot): void; + protected visitJSDotDotDot?(node: JSDotDotDot): void; + protected visitJSMulOp?(node: JSMulOp): void; + protected visitJSAddOp?(node: JSAddOp): void; + protected visitJSDivOp?(node: JSDivOp): void; + protected visitJSSubOp?(node: JSSubOp): void; + protected visitJSLtOp?(node: JSLtOp): void; + protected visitJSGtOp?(node: JSGtOp): void; + protected visitJSBOrOp?(node: JSBOrOp): void; + protected visitJSBXorOp?(node: JSBXorOp): void; + protected visitJSBAndOp?(node: JSBAndOp): void; + protected visitJSBNotOp?(node: JSBNotOp): void; + protected visitJSNotOp?(node: JSNotOp): void; + protected visitJSBindPattern?(node: JSBindPattern): void; + protected visitJSConstantExpression?(node: JSConstantExpression): void; + protected visitJSMemberExpression?(node: JSMemberExpression): void; + protected visitJSCallExpression?(node: JSCallExpression): void; + protected visitJSBinaryExpression?(node: JSBinaryExpression): void; + protected visitJSUnaryExpression?(node: JSUnaryExpression): void; + protected visitJSNewExpression?(node: JSNewExpression): void; + protected visitJSSequenceExpression?(node: JSSequenceExpression): void; + protected visitJSConditionalExpression?(node: JSConditionalExpression): void; + protected visitJSLiteralExpression?(node: JSLiteralExpression): void; + protected visitJSReferenceExpression?(node: JSReferenceExpression): void; + protected visitJSCatchBlock?(node: JSCatchBlock): void; + protected visitJSTryCatchStatement?(node: JSTryCatchStatement): void; + protected visitJSExpressionStatement?(node: JSExpressionStatement): void; + protected visitJSConditionalCase?(node: JSConditionalCase): void; + protected visitJSConditionalStatement?(node: JSConditionalStatement): void; + protected visitJSReturnStatement?(node: JSReturnStatement): void; + protected visitJSParameter?(node: JSParameter): void; + protected visitJSImportStarBinding?(node: JSImportStarBinding): void; + protected visitJSImportAsBinding?(node: JSImportAsBinding): void; + protected visitJSImportDeclaration?(node: JSImportDeclaration): void; + protected visitJSFunctionDeclaration?(node: JSFunctionDeclaration): void; + protected visitJSArrowFunctionDeclaration?(node: JSArrowFunctionDeclaration): void; + protected visitJSLetDeclaration?(node: JSLetDeclaration): void; + protected visitJSSourceFile?(node: JSSourceFile): void; +} + export const enum SyntaxKind { EndOfFile = 2, @@ -83,155 +242,146 @@ export const enum SyntaxKind { BoltRecordFieldPattern = 67, BoltRecordPattern = 68, BoltQuoteExpression = 70, - BoltReferenceExpression = 71, - BoltMemberExpression = 72, - BoltFunctionExpression = 73, - BoltCallExpression = 74, - BoltYieldExpression = 75, - BoltMatchArm = 76, - BoltMatchExpression = 77, - BoltCase = 78, - BoltCaseExpression = 79, - BoltBlockExpression = 80, - BoltConstantExpression = 81, - BoltReturnStatement = 83, - BoltConditionalCase = 84, - BoltConditionalStatement = 85, - BoltResumeStatement = 86, - BoltExpressionStatement = 87, - BoltParameter = 88, - BoltModule = 92, - BoltFunctionDeclaration = 94, - BoltVariableDeclaration = 95, - BoltPlainImportSymbol = 97, - BoltImportDirective = 98, - BoltExportSymbol = 99, - BoltPlainExportSymbol = 100, - BoltExportDirective = 101, - BoltTraitDeclaration = 102, - BoltImplDeclaration = 103, - BoltTypeAliasDeclaration = 104, - BoltRecordField = 106, - BoltRecordDeclaration = 107, - BoltMacroCall = 109, - JSOperator = 112, - JSIdentifier = 113, - JSString = 114, - JSInteger = 115, - JSFromKeyword = 116, - JSReturnKeyword = 117, - JSTryKeyword = 118, - JSFinallyKeyword = 119, - JSCatchKeyword = 120, - JSImportKeyword = 121, - JSAsKeyword = 122, - JSConstKeyword = 123, - JSLetKeyword = 124, - JSExportKeyword = 125, - JSFunctionKeyword = 126, - JSWhileKeyword = 127, - JSForKeyword = 128, - JSCloseBrace = 129, - JSCloseBracket = 130, - JSCloseParen = 131, - JSOpenBrace = 132, - JSOpenBracket = 133, - JSOpenParen = 134, - JSSemi = 135, - JSComma = 136, - JSDot = 137, - JSDotDotDot = 138, - JSMulOp = 139, - JSAddOp = 140, - JSDivOp = 141, - JSSubOp = 142, - JSLtOp = 143, - JSGtOp = 144, - JSBOrOp = 145, - JSBXorOp = 146, - JSBAndOp = 147, - JSBNotOp = 148, - JSNotOp = 149, - JSBindPattern = 151, - JSConstantExpression = 153, - JSMemberExpression = 154, - JSCallExpression = 155, - JSBinaryExpression = 156, - JSUnaryExpression = 157, - JSNewExpression = 158, - JSSequenceExpression = 159, - JSConditionalExpression = 160, - JSLiteralExpression = 162, - JSReferenceExpression = 163, - JSCatchBlock = 167, - JSTryCatchStatement = 168, - JSExpressionStatement = 169, - JSConditionalCase = 170, - JSConditionalStatement = 171, - JSReturnStatement = 172, - JSParameter = 173, - JSImportStarBinding = 177, - JSImportAsBinding = 178, - JSImportDeclaration = 179, - JSFunctionDeclaration = 180, - JSArrowFunctionDeclaration = 181, - JSLetDeclaration = 182, - JSSourceFile = 183, + BoltTupleExpression = 71, + BoltReferenceExpression = 72, + BoltMemberExpression = 73, + BoltFunctionExpression = 74, + BoltCallExpression = 75, + BoltYieldExpression = 76, + BoltMatchArm = 77, + BoltMatchExpression = 78, + BoltCase = 79, + BoltCaseExpression = 80, + BoltBlockExpression = 81, + BoltConstantExpression = 82, + BoltReturnStatement = 84, + BoltConditionalCase = 85, + BoltConditionalStatement = 86, + BoltResumeStatement = 87, + BoltExpressionStatement = 88, + BoltParameter = 89, + BoltModule = 93, + BoltFunctionDeclaration = 95, + BoltVariableDeclaration = 96, + BoltPlainImportSymbol = 98, + BoltImportDirective = 99, + BoltExportSymbol = 100, + BoltPlainExportSymbol = 101, + BoltExportDirective = 102, + BoltTraitDeclaration = 103, + BoltImplDeclaration = 104, + BoltTypeAliasDeclaration = 105, + BoltRecordField = 107, + BoltRecordDeclaration = 108, + BoltMacroCall = 110, + JSOperator = 113, + JSIdentifier = 114, + JSString = 115, + JSInteger = 116, + JSFromKeyword = 117, + JSReturnKeyword = 118, + JSTryKeyword = 119, + JSFinallyKeyword = 120, + JSCatchKeyword = 121, + JSImportKeyword = 122, + JSAsKeyword = 123, + JSConstKeyword = 124, + JSLetKeyword = 125, + JSExportKeyword = 126, + JSFunctionKeyword = 127, + JSWhileKeyword = 128, + JSForKeyword = 129, + JSCloseBrace = 130, + JSCloseBracket = 131, + JSCloseParen = 132, + JSOpenBrace = 133, + JSOpenBracket = 134, + JSOpenParen = 135, + JSSemi = 136, + JSComma = 137, + JSDot = 138, + JSDotDotDot = 139, + JSMulOp = 140, + JSAddOp = 141, + JSDivOp = 142, + JSSubOp = 143, + JSLtOp = 144, + JSGtOp = 145, + JSBOrOp = 146, + JSBXorOp = 147, + JSBAndOp = 148, + JSBNotOp = 149, + JSNotOp = 150, + JSBindPattern = 152, + JSConstantExpression = 154, + JSMemberExpression = 155, + JSCallExpression = 156, + JSBinaryExpression = 157, + JSUnaryExpression = 158, + JSNewExpression = 159, + JSSequenceExpression = 160, + JSConditionalExpression = 161, + JSLiteralExpression = 163, + JSReferenceExpression = 164, + JSCatchBlock = 168, + JSTryCatchStatement = 169, + JSExpressionStatement = 170, + JSConditionalCase = 171, + JSConditionalStatement = 172, + JSReturnStatement = 173, + JSParameter = 174, + JSImportStarBinding = 178, + JSImportAsBinding = 179, + JSImportDeclaration = 180, + JSFunctionDeclaration = 181, + JSArrowFunctionDeclaration = 182, + JSLetDeclaration = 183, + JSSourceFile = 184, } -export interface EndOfFile extends SyntaxBase { +export interface EndOfFile extends SyntaxBase { kind: SyntaxKind.EndOfFile; + parentNode: EndOfFileParent; + getChildNodes(): IterableIterator } +export type EndOfFileParent += BoltQuoteExpression +| never + +export type EndOfFileAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type EndOfFileChild += never + export type Token = EndOfFile - | BoltStringLiteral - | BoltIntegerLiteral - | BoltIdentifier - | BoltGtSign - | BoltExMark - | BoltLtSign - | BoltVBar - | BoltOperator - | BoltAssignment - | BoltComma - | BoltSemi - | BoltColon - | BoltColonColon - | BoltDot - | BoltDotDot - | BoltRArrow - | BoltRArrowAlt - | BoltLArrow - | BoltEqSign - | BoltGtSign - | BoltExMark - | BoltLtSign - | BoltVBar - | BoltWhereKeyword - | BoltQuoteKeyword - | BoltFnKeyword - | BoltForeignKeyword - | BoltForKeyword - | BoltLetKeyword - | BoltReturnKeyword - | BoltLoopKeyword - | BoltYieldKeyword - | BoltMatchKeyword - | BoltImportKeyword - | BoltExportKeyword - | BoltPubKeyword - | BoltModKeyword - | BoltMutKeyword - | BoltEnumKeyword - | BoltStructKeyword - | BoltTypeKeyword - | BoltTraitKeyword - | BoltImplKeyword - | BoltParenthesized - | BoltBraced - | BoltBracketed - | EndOfFile | JSOperator | JSIdentifier | JSString @@ -270,27 +420,8 @@ export type Token | JSBAndOp | JSBNotOp | JSNotOp - - -export type SourceFile - = BoltSourceFile - | JSSourceFile - - -export interface FunctionBody extends SyntaxBase { - kind: SyntaxKind.FunctionBody; -} - -export type BoltToken - = EndOfFile | BoltStringLiteral | BoltIntegerLiteral - | BoltIdentifier - | BoltGtSign - | BoltExMark - | BoltLtSign - | BoltVBar - | BoltOperator | BoltAssignment | BoltComma | BoltSemi @@ -329,32 +460,214 @@ export type BoltToken | BoltParenthesized | BoltBraced | BoltBracketed + | BoltIdentifier + | BoltOperator -export interface BoltStringLiteral extends SyntaxBase { - kind: SyntaxKind.BoltStringLiteral; - value: string; +export type SourceFile + = BoltSourceFile + | JSSourceFile + + +export interface FunctionBody extends SyntaxBase { + kind: SyntaxKind.FunctionBody; + parentNode: FunctionBodyParent; + getChildNodes(): IterableIterator } -export interface BoltIntegerLiteral extends SyntaxBase { - kind: SyntaxKind.BoltIntegerLiteral; - value: bigint; -} +export type FunctionBodyParent += never -export type BoltSymbol - = BoltIdentifier +export type FunctionBodyAnyParent += never + +export type FunctionBodyChild += never + +export type BoltToken + = EndOfFile + | BoltStringLiteral + | BoltIntegerLiteral + | BoltAssignment + | BoltComma + | BoltSemi + | BoltColon + | BoltColonColon + | BoltDot + | BoltDotDot + | BoltRArrow + | BoltRArrowAlt + | BoltLArrow + | BoltEqSign | BoltGtSign | BoltExMark | BoltLtSign | BoltVBar + | BoltWhereKeyword + | BoltQuoteKeyword + | BoltFnKeyword + | BoltForeignKeyword + | BoltForKeyword + | BoltLetKeyword + | BoltReturnKeyword + | BoltLoopKeyword + | BoltYieldKeyword + | BoltMatchKeyword + | BoltImportKeyword + | BoltExportKeyword + | BoltPubKeyword + | BoltModKeyword + | BoltMutKeyword + | BoltEnumKeyword + | BoltStructKeyword + | BoltTypeKeyword + | BoltTraitKeyword + | BoltImplKeyword + | BoltParenthesized + | BoltBraced + | BoltBracketed + | BoltIdentifier | BoltOperator -export interface BoltIdentifier extends SyntaxBase { +export interface BoltStringLiteral extends SyntaxBase { + kind: SyntaxKind.BoltStringLiteral; + value: string; + parentNode: BoltStringLiteralParent; + getChildNodes(): IterableIterator +} + +export type BoltStringLiteralParent += BoltQuoteExpression +| never + +export type BoltStringLiteralAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltStringLiteralChild += never + +export interface BoltIntegerLiteral extends SyntaxBase { + kind: SyntaxKind.BoltIntegerLiteral; + value: bigint; + parentNode: BoltIntegerLiteralParent; + getChildNodes(): IterableIterator +} + +export type BoltIntegerLiteralParent += BoltQuoteExpression +| never + +export type BoltIntegerLiteralAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltIntegerLiteralChild += never + +export type BoltSymbol + = BoltIdentifier + | BoltOperator + | BoltGtSign + | BoltExMark + | BoltLtSign + | BoltVBar + + +export interface BoltIdentifier extends SyntaxBase { kind: SyntaxKind.BoltIdentifier; text: string; + parentNode: BoltIdentifierParent; + getChildNodes(): IterableIterator } +export type BoltIdentifierParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| never + +export type BoltIdentifierAnyParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltIdentifierChild += never + export type BoltOperatorLike = BoltGtSign | BoltExMark @@ -362,72 +675,679 @@ export type BoltOperatorLike | BoltVBar -export interface BoltOperator extends SyntaxBase { +export interface BoltOperator extends SyntaxBase { kind: SyntaxKind.BoltOperator; text: string; + parentNode: BoltOperatorParent; + getChildNodes(): IterableIterator } -export interface BoltAssignment extends SyntaxBase { +export type BoltOperatorParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| never + +export type BoltOperatorAnyParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltOperatorChild += never + +export interface BoltAssignment extends SyntaxBase { kind: SyntaxKind.BoltAssignment; operator: string | null; + parentNode: BoltAssignmentParent; + getChildNodes(): IterableIterator } -export interface BoltComma extends SyntaxBase { +export type BoltAssignmentParent += BoltQuoteExpression +| never + +export type BoltAssignmentAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltAssignmentChild += never + +export interface BoltComma extends SyntaxBase { kind: SyntaxKind.BoltComma; + parentNode: BoltCommaParent; + getChildNodes(): IterableIterator } -export interface BoltSemi extends SyntaxBase { +export type BoltCommaParent += BoltQuoteExpression +| never + +export type BoltCommaAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltCommaChild += never + +export interface BoltSemi extends SyntaxBase { kind: SyntaxKind.BoltSemi; + parentNode: BoltSemiParent; + getChildNodes(): IterableIterator } -export interface BoltColon extends SyntaxBase { +export type BoltSemiParent += BoltQuoteExpression +| never + +export type BoltSemiAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltSemiChild += never + +export interface BoltColon extends SyntaxBase { kind: SyntaxKind.BoltColon; + parentNode: BoltColonParent; + getChildNodes(): IterableIterator } -export interface BoltColonColon extends SyntaxBase { +export type BoltColonParent += BoltQuoteExpression +| never + +export type BoltColonAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltColonChild += never + +export interface BoltColonColon extends SyntaxBase { kind: SyntaxKind.BoltColonColon; + parentNode: BoltColonColonParent; + getChildNodes(): IterableIterator } -export interface BoltDot extends SyntaxBase { +export type BoltColonColonParent += BoltQuoteExpression +| never + +export type BoltColonColonAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltColonColonChild += never + +export interface BoltDot extends SyntaxBase { kind: SyntaxKind.BoltDot; + parentNode: BoltDotParent; + getChildNodes(): IterableIterator } -export interface BoltDotDot extends SyntaxBase { +export type BoltDotParent += BoltQuoteExpression +| never + +export type BoltDotAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltDotChild += never + +export interface BoltDotDot extends SyntaxBase { kind: SyntaxKind.BoltDotDot; + parentNode: BoltDotDotParent; + getChildNodes(): IterableIterator } -export interface BoltRArrow extends SyntaxBase { +export type BoltDotDotParent += BoltQuoteExpression +| never + +export type BoltDotDotAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltDotDotChild += never + +export interface BoltRArrow extends SyntaxBase { kind: SyntaxKind.BoltRArrow; + parentNode: BoltRArrowParent; + getChildNodes(): IterableIterator } -export interface BoltRArrowAlt extends SyntaxBase { +export type BoltRArrowParent += BoltQuoteExpression +| never + +export type BoltRArrowAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltRArrowChild += never + +export interface BoltRArrowAlt extends SyntaxBase { kind: SyntaxKind.BoltRArrowAlt; + parentNode: BoltRArrowAltParent; + getChildNodes(): IterableIterator } -export interface BoltLArrow extends SyntaxBase { +export type BoltRArrowAltParent += BoltQuoteExpression +| never + +export type BoltRArrowAltAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltRArrowAltChild += never + +export interface BoltLArrow extends SyntaxBase { kind: SyntaxKind.BoltLArrow; + parentNode: BoltLArrowParent; + getChildNodes(): IterableIterator } -export interface BoltEqSign extends SyntaxBase { +export type BoltLArrowParent += BoltQuoteExpression +| never + +export type BoltLArrowAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltLArrowChild += never + +export interface BoltEqSign extends SyntaxBase { kind: SyntaxKind.BoltEqSign; + parentNode: BoltEqSignParent; + getChildNodes(): IterableIterator } -export interface BoltGtSign extends SyntaxBase { +export type BoltEqSignParent += BoltQuoteExpression +| never + +export type BoltEqSignAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltEqSignChild += never + +export interface BoltGtSign extends SyntaxBase { kind: SyntaxKind.BoltGtSign; + parentNode: BoltGtSignParent; + getChildNodes(): IterableIterator } -export interface BoltExMark extends SyntaxBase { +export type BoltGtSignParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| never + +export type BoltGtSignAnyParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltGtSignChild += never + +export interface BoltExMark extends SyntaxBase { kind: SyntaxKind.BoltExMark; + parentNode: BoltExMarkParent; + getChildNodes(): IterableIterator } -export interface BoltLtSign extends SyntaxBase { +export type BoltExMarkParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| never + +export type BoltExMarkAnyParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltExMarkChild += never + +export interface BoltLtSign extends SyntaxBase { kind: SyntaxKind.BoltLtSign; + parentNode: BoltLtSignParent; + getChildNodes(): IterableIterator } -export interface BoltVBar extends SyntaxBase { +export type BoltLtSignParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| never + +export type BoltLtSignAnyParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltLtSignChild += never + +export interface BoltVBar extends SyntaxBase { kind: SyntaxKind.BoltVBar; + parentNode: BoltVBarParent; + getChildNodes(): IterableIterator } +export type BoltVBarParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| never + +export type BoltVBarAnyParent += BoltQuoteExpression +| BoltReferenceExpression +| BoltFunctionDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltVBarChild += never + export type BoltKeyword = BoltWhereKeyword | BoltQuoteKeyword @@ -451,149 +1371,1149 @@ export type BoltKeyword | BoltImplKeyword -export interface BoltWhereKeyword extends SyntaxBase { +export interface BoltWhereKeyword extends SyntaxBase { kind: SyntaxKind.BoltWhereKeyword; + parentNode: BoltWhereKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltQuoteKeyword extends SyntaxBase { +export type BoltWhereKeywordParent += BoltQuoteExpression +| never + +export type BoltWhereKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltWhereKeywordChild += never + +export interface BoltQuoteKeyword extends SyntaxBase { kind: SyntaxKind.BoltQuoteKeyword; + parentNode: BoltQuoteKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltFnKeyword extends SyntaxBase { +export type BoltQuoteKeywordParent += BoltQuoteExpression +| never + +export type BoltQuoteKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltQuoteKeywordChild += never + +export interface BoltFnKeyword extends SyntaxBase { kind: SyntaxKind.BoltFnKeyword; + parentNode: BoltFnKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltForeignKeyword extends SyntaxBase { +export type BoltFnKeywordParent += BoltQuoteExpression +| never + +export type BoltFnKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltFnKeywordChild += never + +export interface BoltForeignKeyword extends SyntaxBase { kind: SyntaxKind.BoltForeignKeyword; + parentNode: BoltForeignKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltForKeyword extends SyntaxBase { +export type BoltForeignKeywordParent += BoltQuoteExpression +| never + +export type BoltForeignKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltForeignKeywordChild += never + +export interface BoltForKeyword extends SyntaxBase { kind: SyntaxKind.BoltForKeyword; + parentNode: BoltForKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltLetKeyword extends SyntaxBase { +export type BoltForKeywordParent += BoltQuoteExpression +| never + +export type BoltForKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltForKeywordChild += never + +export interface BoltLetKeyword extends SyntaxBase { kind: SyntaxKind.BoltLetKeyword; + parentNode: BoltLetKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltReturnKeyword extends SyntaxBase { +export type BoltLetKeywordParent += BoltQuoteExpression +| never + +export type BoltLetKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltLetKeywordChild += never + +export interface BoltReturnKeyword extends SyntaxBase { kind: SyntaxKind.BoltReturnKeyword; + parentNode: BoltReturnKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltLoopKeyword extends SyntaxBase { +export type BoltReturnKeywordParent += BoltQuoteExpression +| never + +export type BoltReturnKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltReturnKeywordChild += never + +export interface BoltLoopKeyword extends SyntaxBase { kind: SyntaxKind.BoltLoopKeyword; + parentNode: BoltLoopKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltYieldKeyword extends SyntaxBase { +export type BoltLoopKeywordParent += BoltQuoteExpression +| never + +export type BoltLoopKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltLoopKeywordChild += never + +export interface BoltYieldKeyword extends SyntaxBase { kind: SyntaxKind.BoltYieldKeyword; + parentNode: BoltYieldKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltMatchKeyword extends SyntaxBase { +export type BoltYieldKeywordParent += BoltQuoteExpression +| never + +export type BoltYieldKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltYieldKeywordChild += never + +export interface BoltMatchKeyword extends SyntaxBase { kind: SyntaxKind.BoltMatchKeyword; + parentNode: BoltMatchKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltImportKeyword extends SyntaxBase { +export type BoltMatchKeywordParent += BoltQuoteExpression +| never + +export type BoltMatchKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltMatchKeywordChild += never + +export interface BoltImportKeyword extends SyntaxBase { kind: SyntaxKind.BoltImportKeyword; + parentNode: BoltImportKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltExportKeyword extends SyntaxBase { +export type BoltImportKeywordParent += BoltQuoteExpression +| never + +export type BoltImportKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltImportKeywordChild += never + +export interface BoltExportKeyword extends SyntaxBase { kind: SyntaxKind.BoltExportKeyword; + parentNode: BoltExportKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltPubKeyword extends SyntaxBase { +export type BoltExportKeywordParent += BoltQuoteExpression +| never + +export type BoltExportKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltExportKeywordChild += never + +export interface BoltPubKeyword extends SyntaxBase { kind: SyntaxKind.BoltPubKeyword; + parentNode: BoltPubKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltModKeyword extends SyntaxBase { +export type BoltPubKeywordParent += BoltQuoteExpression +| never + +export type BoltPubKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltPubKeywordChild += never + +export interface BoltModKeyword extends SyntaxBase { kind: SyntaxKind.BoltModKeyword; + parentNode: BoltModKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltMutKeyword extends SyntaxBase { +export type BoltModKeywordParent += BoltQuoteExpression +| never + +export type BoltModKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltModKeywordChild += never + +export interface BoltMutKeyword extends SyntaxBase { kind: SyntaxKind.BoltMutKeyword; + parentNode: BoltMutKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltEnumKeyword extends SyntaxBase { +export type BoltMutKeywordParent += BoltQuoteExpression +| never + +export type BoltMutKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltMutKeywordChild += never + +export interface BoltEnumKeyword extends SyntaxBase { kind: SyntaxKind.BoltEnumKeyword; + parentNode: BoltEnumKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltStructKeyword extends SyntaxBase { +export type BoltEnumKeywordParent += BoltQuoteExpression +| never + +export type BoltEnumKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltEnumKeywordChild += never + +export interface BoltStructKeyword extends SyntaxBase { kind: SyntaxKind.BoltStructKeyword; + parentNode: BoltStructKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltTypeKeyword extends SyntaxBase { +export type BoltStructKeywordParent += BoltQuoteExpression +| never + +export type BoltStructKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltStructKeywordChild += never + +export interface BoltTypeKeyword extends SyntaxBase { kind: SyntaxKind.BoltTypeKeyword; + parentNode: BoltTypeKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltTraitKeyword extends SyntaxBase { +export type BoltTypeKeywordParent += BoltQuoteExpression +| never + +export type BoltTypeKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltTypeKeywordChild += never + +export interface BoltTraitKeyword extends SyntaxBase { kind: SyntaxKind.BoltTraitKeyword; + parentNode: BoltTraitKeywordParent; + getChildNodes(): IterableIterator } -export interface BoltImplKeyword extends SyntaxBase { +export type BoltTraitKeywordParent += BoltQuoteExpression +| never + +export type BoltTraitKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltTraitKeywordChild += never + +export interface BoltImplKeyword extends SyntaxBase { kind: SyntaxKind.BoltImplKeyword; + parentNode: BoltImplKeywordParent; + getChildNodes(): IterableIterator } +export type BoltImplKeywordParent += BoltQuoteExpression +| never + +export type BoltImplKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltImplKeywordChild += never + export type BoltPunctuated = BoltParenthesized | BoltBraced | BoltBracketed -export interface BoltParenthesized extends SyntaxBase { +export interface BoltParenthesized extends SyntaxBase { kind: SyntaxKind.BoltParenthesized; text: string; + parentNode: BoltParenthesizedParent; + getChildNodes(): IterableIterator } -export interface BoltBraced extends SyntaxBase { +export type BoltParenthesizedParent += BoltQuoteExpression +| never + +export type BoltParenthesizedAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltParenthesizedChild += never + +export interface BoltBraced extends SyntaxBase { kind: SyntaxKind.BoltBraced; text: string; + parentNode: BoltBracedParent; + getChildNodes(): IterableIterator } -export interface BoltBracketed extends SyntaxBase { +export type BoltBracedParent += BoltQuoteExpression +| never + +export type BoltBracedAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltBracedChild += never + +export interface BoltBracketed extends SyntaxBase { kind: SyntaxKind.BoltBracketed; text: string; + parentNode: BoltBracketedParent; + getChildNodes(): IterableIterator } -export interface BoltSourceFile extends SyntaxBase { +export type BoltBracketedParent += BoltQuoteExpression +| never + +export type BoltBracketedAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltBracketedChild += never + +export interface BoltSourceFile extends SyntaxBase { kind: SyntaxKind.BoltSourceFile; elements: BoltSourceElement[]; package: Package; + parentNode: BoltSourceFileParent; + getChildNodes(): IterableIterator } -export interface BoltQualName extends SyntaxBase { +export type BoltSourceFileParent += never + +export type BoltSourceFileAnyParent += never + +export type BoltSourceFileChild += never + +export interface BoltQualName extends SyntaxBase { kind: SyntaxKind.BoltQualName; modulePath: BoltIdentifier[] | null; - name: BoltSymbol; + parentNode: BoltQualNameParent; + getChildNodes(): IterableIterator } -export interface BoltModulePath extends SyntaxBase { +export type BoltQualNameParent += never + +export type BoltQualNameAnyParent += never + +export type BoltQualNameChild += never + +export interface BoltModulePath extends SyntaxBase { kind: SyntaxKind.BoltModulePath; isAbsolute: boolean; elements: BoltIdentifier[]; + parentNode: BoltModulePathParent; + getChildNodes(): IterableIterator } +export type BoltModulePathParent += never + +export type BoltModulePathAnyParent += never + +export type BoltModulePathChild += never + export type BoltTypeExpression = BoltReferenceTypeExpression | BoltFunctionTypeExpression -export interface BoltReferenceTypeExpression extends SyntaxBase { +export interface BoltReferenceTypeExpression extends SyntaxBase { kind: SyntaxKind.BoltReferenceTypeExpression; path: BoltModulePath; arguments: BoltTypeExpression[] | null; + parentNode: BoltReferenceTypeExpressionParent; + getChildNodes(): IterableIterator } -export interface BoltFunctionTypeExpression extends SyntaxBase { +export type BoltReferenceTypeExpressionParent += BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltTypePattern +| BoltRecordPattern +| BoltFunctionExpression +| BoltParameter +| BoltFunctionDeclaration +| BoltVariableDeclaration +| BoltImplDeclaration +| BoltTypeAliasDeclaration +| BoltRecordField +| never + +export type BoltReferenceTypeExpressionAnyParent += BoltFunctionTypeExpression +| BoltTypeParameter +| BoltTypePattern +| BoltRecordPattern +| BoltFunctionExpression +| BoltParameter +| BoltFunctionDeclaration +| BoltVariableDeclaration +| BoltImplDeclaration +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration +| BoltSourceFile +| BoltModule +| BoltTraitDeclaration +| BoltBlockExpression +| BoltConditionalCase +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltReferenceTypeExpressionChild += never + +export interface BoltFunctionTypeExpression extends SyntaxBase { kind: SyntaxKind.BoltFunctionTypeExpression; params: BoltParameter[]; returnType: BoltTypeExpression | null; + parentNode: BoltFunctionTypeExpressionParent; + getChildNodes(): IterableIterator } -export interface BoltTypeParameter extends SyntaxBase { +export type BoltFunctionTypeExpressionParent += BoltReferenceTypeExpression +| BoltFunctionTypeExpression +| BoltTypeParameter +| BoltTypePattern +| BoltRecordPattern +| BoltFunctionExpression +| BoltParameter +| BoltFunctionDeclaration +| BoltVariableDeclaration +| BoltImplDeclaration +| BoltTypeAliasDeclaration +| BoltRecordField +| never + +export type BoltFunctionTypeExpressionAnyParent += BoltReferenceTypeExpression +| BoltTypeParameter +| BoltTypePattern +| BoltRecordPattern +| BoltFunctionExpression +| BoltParameter +| BoltFunctionDeclaration +| BoltVariableDeclaration +| BoltImplDeclaration +| BoltTypeAliasDeclaration +| BoltRecordField +| BoltRecordDeclaration +| BoltSourceFile +| BoltModule +| BoltTraitDeclaration +| BoltBlockExpression +| BoltConditionalCase +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltFunctionTypeExpressionChild += never + +export interface BoltTypeParameter extends SyntaxBase { kind: SyntaxKind.BoltTypeParameter; index: number; name: BoltIdentifier; defaultType: BoltTypeExpression | null; + parentNode: BoltTypeParameterParent; + getChildNodes(): IterableIterator } +export type BoltTypeParameterParent += never + +export type BoltTypeParameterAnyParent += never + +export type BoltTypeParameterChild += never + export type BoltPattern = BoltBindPattern | BoltTypePattern @@ -602,48 +2522,274 @@ export type BoltPattern | BoltRecordPattern -export interface BoltBindPattern extends SyntaxBase { +export interface BoltBindPattern extends SyntaxBase { kind: SyntaxKind.BoltBindPattern; name: BoltIdentifier; + parentNode: BoltBindPatternParent; + getChildNodes(): IterableIterator } -export interface BoltTypePattern extends SyntaxBase { +export type BoltBindPatternParent += BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| BoltMatchArm +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltBindPatternAnyParent += BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| BoltMatchArm +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| never + +export type BoltBindPatternChild += never + +export interface BoltTypePattern extends SyntaxBase { kind: SyntaxKind.BoltTypePattern; type: BoltTypeExpression; nestedPattern: BoltPattern; + parentNode: BoltTypePatternParent; + getChildNodes(): IterableIterator } -export interface BoltExpressionPattern extends SyntaxBase { +export type BoltTypePatternParent += BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| BoltMatchArm +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltTypePatternAnyParent += BoltTuplePatternElement +| BoltRecordFieldPattern +| BoltMatchArm +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| never + +export type BoltTypePatternChild += never + +export interface BoltExpressionPattern extends SyntaxBase { kind: SyntaxKind.BoltExpressionPattern; expression: BoltExpression; + parentNode: BoltExpressionPatternParent; + getChildNodes(): IterableIterator } -export interface BoltTuplePatternElement extends SyntaxBase { +export type BoltExpressionPatternParent += BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| BoltMatchArm +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltExpressionPatternAnyParent += BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| BoltMatchArm +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| never + +export type BoltExpressionPatternChild += never + +export interface BoltTuplePatternElement extends SyntaxBase { kind: SyntaxKind.BoltTuplePatternElement; index: number; pattern: BoltPattern; + parentNode: BoltTuplePatternElementParent; + getChildNodes(): IterableIterator } -export interface BoltTuplePattern extends SyntaxBase { +export type BoltTuplePatternElementParent += never + +export type BoltTuplePatternElementAnyParent += never + +export type BoltTuplePatternElementChild += never + +export interface BoltTuplePattern extends SyntaxBase { kind: SyntaxKind.BoltTuplePattern; elements: BoltTuplePatternElement[]; + parentNode: BoltTuplePatternParent; + getChildNodes(): IterableIterator } -export interface BoltRecordFieldPattern extends SyntaxBase { +export type BoltTuplePatternParent += BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| BoltMatchArm +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltTuplePatternAnyParent += BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| BoltMatchArm +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| never + +export type BoltTuplePatternChild += never + +export interface BoltRecordFieldPattern extends SyntaxBase { kind: SyntaxKind.BoltRecordFieldPattern; isRest: boolean; name: BoltIdentifier | null; pattern: BoltPattern | null; + parentNode: BoltRecordFieldPatternParent; + getChildNodes(): IterableIterator } -export interface BoltRecordPattern extends SyntaxBase { +export type BoltRecordFieldPatternParent += never + +export type BoltRecordFieldPatternAnyParent += never + +export type BoltRecordFieldPatternChild += never + +export interface BoltRecordPattern extends SyntaxBase { kind: SyntaxKind.BoltRecordPattern; name: BoltTypeExpression; fields: BoltRecordFieldPattern[]; + parentNode: BoltRecordPatternParent; + getChildNodes(): IterableIterator } +export type BoltRecordPatternParent += BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| BoltMatchArm +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltRecordPatternAnyParent += BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| BoltMatchArm +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| never + +export type BoltRecordPatternChild += never + export type BoltExpression = BoltQuoteExpression + | BoltTupleExpression | BoltReferenceExpression | BoltMemberExpression | BoltFunctionExpression @@ -656,73 +2802,633 @@ export type BoltExpression | BoltMacroCall -export interface BoltQuoteExpression extends SyntaxBase { +export interface BoltQuoteExpression extends SyntaxBase { kind: SyntaxKind.BoltQuoteExpression; - tokens: Token[]; + tokens: Token | BoltExpression[]; + parentNode: BoltQuoteExpressionParent; + getChildNodes(): IterableIterator } -export interface BoltReferenceExpression extends SyntaxBase { +export type BoltQuoteExpressionParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltQuoteExpressionAnyParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltQuoteExpressionChild += never + +export interface BoltTupleExpression extends SyntaxBase { + kind: SyntaxKind.BoltTupleExpression; + elements: BoltExpression[]; + parentNode: BoltTupleExpressionParent; + getChildNodes(): IterableIterator +} + +export type BoltTupleExpressionParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltTupleExpressionAnyParent += BoltExpressionPattern +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltTupleExpressionChild += never + +export interface BoltReferenceExpression extends SyntaxBase { kind: SyntaxKind.BoltReferenceExpression; - name: BoltQualName; + modulePath: BoltModulePath | null; + name: BoltSymbol; + parentNode: BoltReferenceExpressionParent; + getChildNodes(): IterableIterator } -export interface BoltMemberExpression extends SyntaxBase { +export type BoltReferenceExpressionParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltReferenceExpressionAnyParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltReferenceExpressionChild += never + +export interface BoltMemberExpression extends SyntaxBase { kind: SyntaxKind.BoltMemberExpression; expression: BoltExpression; path: BoltIdentifier[]; + parentNode: BoltMemberExpressionParent; + getChildNodes(): IterableIterator } -export interface BoltFunctionExpression extends SyntaxBase { +export type BoltMemberExpressionParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltMemberExpressionAnyParent += BoltExpressionPattern +| BoltTupleExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltMemberExpressionChild += never + +export interface BoltFunctionExpression extends SyntaxBase { kind: SyntaxKind.BoltFunctionExpression; params: BoltParameter[]; returnType: BoltTypeExpression | null; body: BoltFunctionBodyElement[]; + parentNode: BoltFunctionExpressionParent; + getChildNodes(): IterableIterator } -export interface BoltCallExpression extends SyntaxBase { +export type BoltFunctionExpressionParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltFunctionExpressionAnyParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltFunctionExpressionChild += never + +export interface BoltCallExpression extends SyntaxBase { kind: SyntaxKind.BoltCallExpression; operator: BoltExpression; operands: BoltExpression[]; + parentNode: BoltCallExpressionParent; + getChildNodes(): IterableIterator } -export interface BoltYieldExpression extends SyntaxBase { +export type BoltCallExpressionParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltCallExpressionAnyParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltCallExpressionChild += never + +export interface BoltYieldExpression extends SyntaxBase { kind: SyntaxKind.BoltYieldExpression; value: BoltExpression; + parentNode: BoltYieldExpressionParent; + getChildNodes(): IterableIterator } -export interface BoltMatchArm extends SyntaxBase { +export type BoltYieldExpressionParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltYieldExpressionAnyParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltYieldExpressionChild += never + +export interface BoltMatchArm extends SyntaxBase { kind: SyntaxKind.BoltMatchArm; pattern: BoltPattern; body: BoltExpression; + parentNode: BoltMatchArmParent; + getChildNodes(): IterableIterator } -export interface BoltMatchExpression extends SyntaxBase { +export type BoltMatchArmParent += never + +export type BoltMatchArmAnyParent += never + +export type BoltMatchArmChild += never + +export interface BoltMatchExpression extends SyntaxBase { kind: SyntaxKind.BoltMatchExpression; value: BoltExpression; arms: BoltMatchArm[]; + parentNode: BoltMatchExpressionParent; + getChildNodes(): IterableIterator } -export interface BoltCase extends SyntaxBase { +export type BoltMatchExpressionParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltMatchExpressionAnyParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltMatchExpressionChild += never + +export interface BoltCase extends SyntaxBase { kind: SyntaxKind.BoltCase; test: BoltExpression; result: BoltExpression; + parentNode: BoltCaseParent; + getChildNodes(): IterableIterator } -export interface BoltCaseExpression extends SyntaxBase { +export type BoltCaseParent += never + +export type BoltCaseAnyParent += never + +export type BoltCaseChild += never + +export interface BoltCaseExpression extends SyntaxBase { kind: SyntaxKind.BoltCaseExpression; cases: BoltCase[]; + parentNode: BoltCaseExpressionParent; + getChildNodes(): IterableIterator } -export interface BoltBlockExpression extends SyntaxBase { +export type BoltCaseExpressionParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltCaseExpressionAnyParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltCaseExpressionChild += never + +export interface BoltBlockExpression extends SyntaxBase { kind: SyntaxKind.BoltBlockExpression; elements: BoltFunctionBodyElement[]; + parentNode: BoltBlockExpressionParent; + getChildNodes(): IterableIterator } -export interface BoltConstantExpression extends SyntaxBase { +export type BoltBlockExpressionParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltBlockExpressionAnyParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltBlockExpressionChild += never + +export interface BoltConstantExpression extends SyntaxBase { kind: SyntaxKind.BoltConstantExpression; value: BoltValue; + parentNode: BoltConstantExpressionParent; + getChildNodes(): IterableIterator } +export type BoltConstantExpressionParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| never + +export type BoltConstantExpressionAnyParent += BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltConstantExpressionChild += never + export type BoltStatement = BoltReturnStatement | BoltConditionalStatement @@ -731,40 +3437,223 @@ export type BoltStatement | BoltMacroCall -export interface BoltReturnStatement extends SyntaxBase { +export interface BoltReturnStatement extends SyntaxBase { kind: SyntaxKind.BoltReturnStatement; value: BoltExpression | null; + parentNode: BoltReturnStatementParent; + getChildNodes(): IterableIterator } -export interface BoltConditionalCase extends SyntaxBase { +export type BoltReturnStatementParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| never + +export type BoltReturnStatementAnyParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltReturnStatementChild += never + +export interface BoltConditionalCase extends SyntaxBase { kind: SyntaxKind.BoltConditionalCase; test: BoltExpression | null; body: BoltFunctionBodyElement[]; + parentNode: BoltConditionalCaseParent; + getChildNodes(): IterableIterator } -export interface BoltConditionalStatement extends SyntaxBase { +export type BoltConditionalCaseParent += never + +export type BoltConditionalCaseAnyParent += never + +export type BoltConditionalCaseChild += never + +export interface BoltConditionalStatement extends SyntaxBase { kind: SyntaxKind.BoltConditionalStatement; cases: BoltConditionalCase[]; + parentNode: BoltConditionalStatementParent; + getChildNodes(): IterableIterator } -export interface BoltResumeStatement extends SyntaxBase { +export type BoltConditionalStatementParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| never + +export type BoltConditionalStatementAnyParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltConditionalStatementChild += never + +export interface BoltResumeStatement extends SyntaxBase { kind: SyntaxKind.BoltResumeStatement; value: BoltExpression; + parentNode: BoltResumeStatementParent; + getChildNodes(): IterableIterator } -export interface BoltExpressionStatement extends SyntaxBase { +export type BoltResumeStatementParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| never + +export type BoltResumeStatementAnyParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltResumeStatementChild += never + +export interface BoltExpressionStatement extends SyntaxBase { kind: SyntaxKind.BoltExpressionStatement; expression: BoltExpression; + parentNode: BoltExpressionStatementParent; + getChildNodes(): IterableIterator } -export interface BoltParameter extends SyntaxBase { +export type BoltExpressionStatementParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| never + +export type BoltExpressionStatementAnyParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltParameter +| BoltVariableDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltExpressionStatementChild += never + +export interface BoltParameter extends SyntaxBase { kind: SyntaxKind.BoltParameter; index: number; bindings: BoltPattern; type: BoltTypeExpression | null; defaultValue: BoltExpression | null; + parentNode: BoltParameterParent; + getChildNodes(): IterableIterator } +export type BoltParameterParent += never + +export type BoltParameterAnyParent += never + +export type BoltParameterChild += never + export type BoltDeclaration = BoltFunctionDeclaration | BoltVariableDeclaration @@ -784,24 +3673,38 @@ export type BoltTypeDeclaration export const enum BoltModifiers { IsMutable = 1,IsPublic = 2,} -export interface BoltModule extends SyntaxBase { +export interface BoltModule extends SyntaxBase { kind: SyntaxKind.BoltModule; modifiers: BoltModifiers; name: BoltIdentifier[]; elements: BoltSourceElement[]; + parentNode: BoltModuleParent; + getChildNodes(): IterableIterator } +export type BoltModuleParent += BoltSourceFile +| BoltModule +| never + +export type BoltModuleAnyParent += BoltSourceFile +| never + +export type BoltModuleChild += never + export type BoltFunctionBodyElement - = BoltReturnStatement + = BoltFunctionDeclaration + | BoltVariableDeclaration + | BoltReturnStatement | BoltConditionalStatement | BoltResumeStatement | BoltExpressionStatement | BoltMacroCall - | BoltFunctionDeclaration - | BoltVariableDeclaration -export interface BoltFunctionDeclaration extends SyntaxBase { +export interface BoltFunctionDeclaration extends SyntaxBase { kind: SyntaxKind.BoltFunctionDeclaration; modifiers: BoltModifiers; target: string; @@ -810,118 +3713,414 @@ export interface BoltFunctionDeclaration extends SyntaxBase } -export interface BoltVariableDeclaration extends SyntaxBase { +export type BoltFunctionDeclarationParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| never + +export type BoltFunctionDeclarationAnyParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltFunctionDeclarationChild += never + +export interface BoltVariableDeclaration extends SyntaxBase { kind: SyntaxKind.BoltVariableDeclaration; modifiers: BoltModifiers; bindings: BoltPattern; type: BoltTypeExpression | null; value: BoltExpression | null; + parentNode: BoltVariableDeclarationParent; + getChildNodes(): IterableIterator } +export type BoltVariableDeclarationParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| never + +export type BoltVariableDeclarationAnyParent += BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltConditionalCase +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltVariableDeclarationChild += never + export type BoltImportSymbol = BoltPlainImportSymbol -export interface BoltPlainImportSymbol extends SyntaxBase { +export interface BoltPlainImportSymbol extends SyntaxBase { kind: SyntaxKind.BoltPlainImportSymbol; name: BoltQualName; + parentNode: BoltPlainImportSymbolParent; + getChildNodes(): IterableIterator } -export interface BoltImportDirective extends SyntaxBase { +export type BoltPlainImportSymbolParent += BoltImportDirective +| never + +export type BoltPlainImportSymbolAnyParent += BoltImportDirective +| BoltSourceFile +| BoltModule +| never + +export type BoltPlainImportSymbolChild += never + +export interface BoltImportDirective extends SyntaxBase { kind: SyntaxKind.BoltImportDirective; modifiers: BoltModifiers; file: BoltStringLiteral; symbols: BoltImportSymbol[]; + parentNode: BoltImportDirectiveParent; + getChildNodes(): IterableIterator } -export interface BoltExportSymbol extends SyntaxBase { +export type BoltImportDirectiveParent += BoltSourceFile +| BoltModule +| never + +export type BoltImportDirectiveAnyParent += BoltSourceFile +| BoltModule +| never + +export type BoltImportDirectiveChild += never + +export interface BoltExportSymbol extends SyntaxBase { kind: SyntaxKind.BoltExportSymbol; + parentNode: BoltExportSymbolParent; + getChildNodes(): IterableIterator } -export interface BoltPlainExportSymbol extends SyntaxBase { +export type BoltExportSymbolParent += never + +export type BoltExportSymbolAnyParent += never + +export type BoltExportSymbolChild += never + +export interface BoltPlainExportSymbol extends SyntaxBase { kind: SyntaxKind.BoltPlainExportSymbol; name: BoltQualName; + parentNode: BoltPlainExportSymbolParent; + getChildNodes(): IterableIterator } -export interface BoltExportDirective extends SyntaxBase { +export type BoltPlainExportSymbolParent += never + +export type BoltPlainExportSymbolAnyParent += never + +export type BoltPlainExportSymbolChild += never + +export interface BoltExportDirective extends SyntaxBase { kind: SyntaxKind.BoltExportDirective; file: string; symbols: BoltExportSymbol[] | null; + parentNode: BoltExportDirectiveParent; + getChildNodes(): IterableIterator } -export interface BoltTraitDeclaration extends SyntaxBase { +export type BoltExportDirectiveParent += BoltSourceFile +| BoltModule +| never + +export type BoltExportDirectiveAnyParent += BoltSourceFile +| BoltModule +| never + +export type BoltExportDirectiveChild += never + +export interface BoltTraitDeclaration extends SyntaxBase { kind: SyntaxKind.BoltTraitDeclaration; modifiers: BoltModifiers; name: BoltIdentifier; typeParams: BoltTypeParameter[] | null; elements: BoltDeclaration[]; + parentNode: BoltTraitDeclarationParent; + getChildNodes(): IterableIterator } -export interface BoltImplDeclaration extends SyntaxBase { +export type BoltTraitDeclarationParent += BoltSourceFile +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| never + +export type BoltTraitDeclarationAnyParent += BoltSourceFile +| BoltModule +| BoltImplDeclaration +| never + +export type BoltTraitDeclarationChild += never + +export interface BoltImplDeclaration extends SyntaxBase { kind: SyntaxKind.BoltImplDeclaration; modifiers: BoltModifiers; name: BoltIdentifier; trait: BoltTypeExpression; typeParams: BoltTypeParameter[] | null; elements: BoltDeclaration[]; + parentNode: BoltImplDeclarationParent; + getChildNodes(): IterableIterator } -export interface BoltTypeAliasDeclaration extends SyntaxBase { +export type BoltImplDeclarationParent += BoltSourceFile +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| never + +export type BoltImplDeclarationAnyParent += BoltSourceFile +| BoltModule +| BoltTraitDeclaration +| never + +export type BoltImplDeclarationChild += never + +export interface BoltTypeAliasDeclaration extends SyntaxBase { kind: SyntaxKind.BoltTypeAliasDeclaration; modifiers: BoltModifiers; name: BoltIdentifier; typeParams: BoltTypeParameter[] | null; typeExpr: BoltTypeExpression; + parentNode: BoltTypeAliasDeclarationParent; + getChildNodes(): IterableIterator } +export type BoltTypeAliasDeclarationParent += BoltSourceFile +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| never + +export type BoltTypeAliasDeclarationAnyParent += BoltSourceFile +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| never + +export type BoltTypeAliasDeclarationChild += never + export type BoltRecordMember = BoltRecordField | BoltMacroCall -export interface BoltRecordField extends SyntaxBase { +export interface BoltRecordField extends SyntaxBase { kind: SyntaxKind.BoltRecordField; name: BoltIdentifier; type: BoltTypeExpression; + parentNode: BoltRecordFieldParent; + getChildNodes(): IterableIterator } -export interface BoltRecordDeclaration extends SyntaxBase { +export type BoltRecordFieldParent += BoltRecordDeclaration +| never + +export type BoltRecordFieldAnyParent += BoltRecordDeclaration +| BoltSourceFile +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| never + +export type BoltRecordFieldChild += never + +export interface BoltRecordDeclaration extends SyntaxBase { kind: SyntaxKind.BoltRecordDeclaration; modifiers: BoltModifiers; name: BoltIdentifier; typeParms: BoltTypeParameter[] | null; members: BoltRecordMember[] | null; + parentNode: BoltRecordDeclarationParent; + getChildNodes(): IterableIterator } +export type BoltRecordDeclarationParent += BoltSourceFile +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| never + +export type BoltRecordDeclarationAnyParent += BoltSourceFile +| BoltModule +| BoltTraitDeclaration +| BoltImplDeclaration +| never + +export type BoltRecordDeclarationChild += never + export type BoltSourceElement - = BoltReturnStatement + = BoltModule + | BoltImportDirective + | BoltExportDirective + | BoltTraitDeclaration + | BoltTypeAliasDeclaration + | BoltRecordDeclaration + | BoltFunctionDeclaration + | BoltVariableDeclaration + | BoltImplDeclaration + | BoltMacroCall + | BoltReturnStatement | BoltConditionalStatement | BoltResumeStatement | BoltExpressionStatement - | BoltMacroCall - | BoltFunctionDeclaration - | BoltVariableDeclaration - | BoltTraitDeclaration - | BoltImplDeclaration - | BoltTypeAliasDeclaration - | BoltRecordDeclaration - | BoltMacroCall - | BoltTraitDeclaration - | BoltTypeAliasDeclaration - | BoltRecordDeclaration - | BoltModule - | BoltImportDirective - | BoltExportDirective -export interface BoltMacroCall extends SyntaxBase { +export interface BoltMacroCall extends SyntaxBase { kind: SyntaxKind.BoltMacroCall; name: BoltIdentifier; text: string; + parentNode: BoltMacroCallParent; + getChildNodes(): IterableIterator } +export type BoltMacroCallParent += BoltSourceFile +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltFunctionExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltBlockExpression +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltModule +| BoltFunctionDeclaration +| BoltVariableDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltRecordDeclaration +| never + +export type BoltMacroCallAnyParent += BoltSourceFile +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltFunctionExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltBlockExpression +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltModule +| BoltFunctionDeclaration +| BoltVariableDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltRecordDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type BoltMacroCallChild += never + export type JSToken = EndOfFile | JSOperator @@ -964,171 +4163,1597 @@ export type JSToken | JSNotOp -export interface JSOperator extends SyntaxBase { +export interface JSOperator extends SyntaxBase { kind: SyntaxKind.JSOperator; text: string; + parentNode: JSOperatorParent; + getChildNodes(): IterableIterator } -export interface JSIdentifier extends SyntaxBase { +export type JSOperatorParent += BoltQuoteExpression +| never + +export type JSOperatorAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSOperatorChild += never + +export interface JSIdentifier extends SyntaxBase { kind: SyntaxKind.JSIdentifier; text: string; + parentNode: JSIdentifierParent; + getChildNodes(): IterableIterator } -export interface JSString extends SyntaxBase { +export type JSIdentifierParent += BoltQuoteExpression +| never + +export type JSIdentifierAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSIdentifierChild += never + +export interface JSString extends SyntaxBase { kind: SyntaxKind.JSString; value: string; + parentNode: JSStringParent; + getChildNodes(): IterableIterator } -export interface JSInteger extends SyntaxBase { +export type JSStringParent += BoltQuoteExpression +| never + +export type JSStringAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSStringChild += never + +export interface JSInteger extends SyntaxBase { kind: SyntaxKind.JSInteger; value: bigint; + parentNode: JSIntegerParent; + getChildNodes(): IterableIterator } -export interface JSFromKeyword extends SyntaxBase { +export type JSIntegerParent += BoltQuoteExpression +| never + +export type JSIntegerAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSIntegerChild += never + +export interface JSFromKeyword extends SyntaxBase { kind: SyntaxKind.JSFromKeyword; + parentNode: JSFromKeywordParent; + getChildNodes(): IterableIterator } -export interface JSReturnKeyword extends SyntaxBase { +export type JSFromKeywordParent += BoltQuoteExpression +| never + +export type JSFromKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSFromKeywordChild += never + +export interface JSReturnKeyword extends SyntaxBase { kind: SyntaxKind.JSReturnKeyword; + parentNode: JSReturnKeywordParent; + getChildNodes(): IterableIterator } -export interface JSTryKeyword extends SyntaxBase { +export type JSReturnKeywordParent += BoltQuoteExpression +| never + +export type JSReturnKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSReturnKeywordChild += never + +export interface JSTryKeyword extends SyntaxBase { kind: SyntaxKind.JSTryKeyword; + parentNode: JSTryKeywordParent; + getChildNodes(): IterableIterator } -export interface JSFinallyKeyword extends SyntaxBase { +export type JSTryKeywordParent += BoltQuoteExpression +| never + +export type JSTryKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSTryKeywordChild += never + +export interface JSFinallyKeyword extends SyntaxBase { kind: SyntaxKind.JSFinallyKeyword; + parentNode: JSFinallyKeywordParent; + getChildNodes(): IterableIterator } -export interface JSCatchKeyword extends SyntaxBase { +export type JSFinallyKeywordParent += BoltQuoteExpression +| never + +export type JSFinallyKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSFinallyKeywordChild += never + +export interface JSCatchKeyword extends SyntaxBase { kind: SyntaxKind.JSCatchKeyword; + parentNode: JSCatchKeywordParent; + getChildNodes(): IterableIterator } -export interface JSImportKeyword extends SyntaxBase { +export type JSCatchKeywordParent += BoltQuoteExpression +| never + +export type JSCatchKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSCatchKeywordChild += never + +export interface JSImportKeyword extends SyntaxBase { kind: SyntaxKind.JSImportKeyword; + parentNode: JSImportKeywordParent; + getChildNodes(): IterableIterator } -export interface JSAsKeyword extends SyntaxBase { +export type JSImportKeywordParent += BoltQuoteExpression +| never + +export type JSImportKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSImportKeywordChild += never + +export interface JSAsKeyword extends SyntaxBase { kind: SyntaxKind.JSAsKeyword; + parentNode: JSAsKeywordParent; + getChildNodes(): IterableIterator } -export interface JSConstKeyword extends SyntaxBase { +export type JSAsKeywordParent += BoltQuoteExpression +| never + +export type JSAsKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSAsKeywordChild += never + +export interface JSConstKeyword extends SyntaxBase { kind: SyntaxKind.JSConstKeyword; + parentNode: JSConstKeywordParent; + getChildNodes(): IterableIterator } -export interface JSLetKeyword extends SyntaxBase { +export type JSConstKeywordParent += BoltQuoteExpression +| never + +export type JSConstKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSConstKeywordChild += never + +export interface JSLetKeyword extends SyntaxBase { kind: SyntaxKind.JSLetKeyword; + parentNode: JSLetKeywordParent; + getChildNodes(): IterableIterator } -export interface JSExportKeyword extends SyntaxBase { +export type JSLetKeywordParent += BoltQuoteExpression +| never + +export type JSLetKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSLetKeywordChild += never + +export interface JSExportKeyword extends SyntaxBase { kind: SyntaxKind.JSExportKeyword; + parentNode: JSExportKeywordParent; + getChildNodes(): IterableIterator } -export interface JSFunctionKeyword extends SyntaxBase { +export type JSExportKeywordParent += BoltQuoteExpression +| never + +export type JSExportKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSExportKeywordChild += never + +export interface JSFunctionKeyword extends SyntaxBase { kind: SyntaxKind.JSFunctionKeyword; + parentNode: JSFunctionKeywordParent; + getChildNodes(): IterableIterator } -export interface JSWhileKeyword extends SyntaxBase { +export type JSFunctionKeywordParent += BoltQuoteExpression +| never + +export type JSFunctionKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSFunctionKeywordChild += never + +export interface JSWhileKeyword extends SyntaxBase { kind: SyntaxKind.JSWhileKeyword; + parentNode: JSWhileKeywordParent; + getChildNodes(): IterableIterator } -export interface JSForKeyword extends SyntaxBase { +export type JSWhileKeywordParent += BoltQuoteExpression +| never + +export type JSWhileKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSWhileKeywordChild += never + +export interface JSForKeyword extends SyntaxBase { kind: SyntaxKind.JSForKeyword; + parentNode: JSForKeywordParent; + getChildNodes(): IterableIterator } -export interface JSCloseBrace extends SyntaxBase { +export type JSForKeywordParent += BoltQuoteExpression +| never + +export type JSForKeywordAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSForKeywordChild += never + +export interface JSCloseBrace extends SyntaxBase { kind: SyntaxKind.JSCloseBrace; + parentNode: JSCloseBraceParent; + getChildNodes(): IterableIterator } -export interface JSCloseBracket extends SyntaxBase { +export type JSCloseBraceParent += BoltQuoteExpression +| never + +export type JSCloseBraceAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSCloseBraceChild += never + +export interface JSCloseBracket extends SyntaxBase { kind: SyntaxKind.JSCloseBracket; + parentNode: JSCloseBracketParent; + getChildNodes(): IterableIterator } -export interface JSCloseParen extends SyntaxBase { +export type JSCloseBracketParent += BoltQuoteExpression +| never + +export type JSCloseBracketAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSCloseBracketChild += never + +export interface JSCloseParen extends SyntaxBase { kind: SyntaxKind.JSCloseParen; + parentNode: JSCloseParenParent; + getChildNodes(): IterableIterator } -export interface JSOpenBrace extends SyntaxBase { +export type JSCloseParenParent += BoltQuoteExpression +| never + +export type JSCloseParenAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSCloseParenChild += never + +export interface JSOpenBrace extends SyntaxBase { kind: SyntaxKind.JSOpenBrace; + parentNode: JSOpenBraceParent; + getChildNodes(): IterableIterator } -export interface JSOpenBracket extends SyntaxBase { +export type JSOpenBraceParent += BoltQuoteExpression +| never + +export type JSOpenBraceAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSOpenBraceChild += never + +export interface JSOpenBracket extends SyntaxBase { kind: SyntaxKind.JSOpenBracket; + parentNode: JSOpenBracketParent; + getChildNodes(): IterableIterator } -export interface JSOpenParen extends SyntaxBase { +export type JSOpenBracketParent += BoltQuoteExpression +| never + +export type JSOpenBracketAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSOpenBracketChild += never + +export interface JSOpenParen extends SyntaxBase { kind: SyntaxKind.JSOpenParen; + parentNode: JSOpenParenParent; + getChildNodes(): IterableIterator } -export interface JSSemi extends SyntaxBase { +export type JSOpenParenParent += BoltQuoteExpression +| never + +export type JSOpenParenAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSOpenParenChild += never + +export interface JSSemi extends SyntaxBase { kind: SyntaxKind.JSSemi; + parentNode: JSSemiParent; + getChildNodes(): IterableIterator } -export interface JSComma extends SyntaxBase { +export type JSSemiParent += BoltQuoteExpression +| never + +export type JSSemiAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSSemiChild += never + +export interface JSComma extends SyntaxBase { kind: SyntaxKind.JSComma; + parentNode: JSCommaParent; + getChildNodes(): IterableIterator } -export interface JSDot extends SyntaxBase { +export type JSCommaParent += BoltQuoteExpression +| never + +export type JSCommaAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSCommaChild += never + +export interface JSDot extends SyntaxBase { kind: SyntaxKind.JSDot; + parentNode: JSDotParent; + getChildNodes(): IterableIterator } -export interface JSDotDotDot extends SyntaxBase { +export type JSDotParent += BoltQuoteExpression +| never + +export type JSDotAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSDotChild += never + +export interface JSDotDotDot extends SyntaxBase { kind: SyntaxKind.JSDotDotDot; + parentNode: JSDotDotDotParent; + getChildNodes(): IterableIterator } -export interface JSMulOp extends SyntaxBase { +export type JSDotDotDotParent += BoltQuoteExpression +| never + +export type JSDotDotDotAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSDotDotDotChild += never + +export interface JSMulOp extends SyntaxBase { kind: SyntaxKind.JSMulOp; + parentNode: JSMulOpParent; + getChildNodes(): IterableIterator } -export interface JSAddOp extends SyntaxBase { +export type JSMulOpParent += BoltQuoteExpression +| never + +export type JSMulOpAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSMulOpChild += never + +export interface JSAddOp extends SyntaxBase { kind: SyntaxKind.JSAddOp; + parentNode: JSAddOpParent; + getChildNodes(): IterableIterator } -export interface JSDivOp extends SyntaxBase { +export type JSAddOpParent += BoltQuoteExpression +| never + +export type JSAddOpAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSAddOpChild += never + +export interface JSDivOp extends SyntaxBase { kind: SyntaxKind.JSDivOp; + parentNode: JSDivOpParent; + getChildNodes(): IterableIterator } -export interface JSSubOp extends SyntaxBase { +export type JSDivOpParent += BoltQuoteExpression +| never + +export type JSDivOpAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSDivOpChild += never + +export interface JSSubOp extends SyntaxBase { kind: SyntaxKind.JSSubOp; + parentNode: JSSubOpParent; + getChildNodes(): IterableIterator } -export interface JSLtOp extends SyntaxBase { +export type JSSubOpParent += BoltQuoteExpression +| never + +export type JSSubOpAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSSubOpChild += never + +export interface JSLtOp extends SyntaxBase { kind: SyntaxKind.JSLtOp; + parentNode: JSLtOpParent; + getChildNodes(): IterableIterator } -export interface JSGtOp extends SyntaxBase { +export type JSLtOpParent += BoltQuoteExpression +| never + +export type JSLtOpAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSLtOpChild += never + +export interface JSGtOp extends SyntaxBase { kind: SyntaxKind.JSGtOp; + parentNode: JSGtOpParent; + getChildNodes(): IterableIterator } -export interface JSBOrOp extends SyntaxBase { +export type JSGtOpParent += BoltQuoteExpression +| never + +export type JSGtOpAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSGtOpChild += never + +export interface JSBOrOp extends SyntaxBase { kind: SyntaxKind.JSBOrOp; + parentNode: JSBOrOpParent; + getChildNodes(): IterableIterator } -export interface JSBXorOp extends SyntaxBase { +export type JSBOrOpParent += BoltQuoteExpression +| never + +export type JSBOrOpAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSBOrOpChild += never + +export interface JSBXorOp extends SyntaxBase { kind: SyntaxKind.JSBXorOp; + parentNode: JSBXorOpParent; + getChildNodes(): IterableIterator } -export interface JSBAndOp extends SyntaxBase { +export type JSBXorOpParent += BoltQuoteExpression +| never + +export type JSBXorOpAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSBXorOpChild += never + +export interface JSBAndOp extends SyntaxBase { kind: SyntaxKind.JSBAndOp; + parentNode: JSBAndOpParent; + getChildNodes(): IterableIterator } -export interface JSBNotOp extends SyntaxBase { +export type JSBAndOpParent += BoltQuoteExpression +| never + +export type JSBAndOpAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSBAndOpChild += never + +export interface JSBNotOp extends SyntaxBase { kind: SyntaxKind.JSBNotOp; + parentNode: JSBNotOpParent; + getChildNodes(): IterableIterator } -export interface JSNotOp extends SyntaxBase { +export type JSBNotOpParent += BoltQuoteExpression +| never + +export type JSBNotOpAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSBNotOpChild += never + +export interface JSNotOp extends SyntaxBase { kind: SyntaxKind.JSNotOp; + parentNode: JSNotOpParent; + getChildNodes(): IterableIterator } +export type JSNotOpParent += BoltQuoteExpression +| never + +export type JSNotOpAnyParent += BoltQuoteExpression +| BoltExpressionPattern +| BoltTupleExpression +| BoltMemberExpression +| BoltCallExpression +| BoltYieldExpression +| BoltMatchArm +| BoltMatchExpression +| BoltCase +| BoltReturnStatement +| BoltConditionalCase +| BoltResumeStatement +| BoltExpressionStatement +| BoltParameter +| BoltVariableDeclaration +| BoltSourceFile +| BoltFunctionExpression +| BoltBlockExpression +| BoltModule +| BoltFunctionDeclaration +| BoltTraitDeclaration +| BoltImplDeclaration +| BoltTypePattern +| BoltTuplePatternElement +| BoltRecordFieldPattern +| never + +export type JSNotOpChild += never + export type JSPattern = JSBindPattern -export interface JSBindPattern extends SyntaxBase { +export interface JSBindPattern extends SyntaxBase { kind: SyntaxKind.JSBindPattern; name: JSIdentifier; + parentNode: JSBindPatternParent; + getChildNodes(): IterableIterator } +export type JSBindPatternParent += JSCatchBlock +| JSParameter +| JSLetDeclaration +| never + +export type JSBindPatternAnyParent += JSCatchBlock +| JSParameter +| JSLetDeclaration +| JSTryCatchStatement +| JSConditionalCase +| JSSourceFile +| never + +export type JSBindPatternChild += never + export type JSExpression = JSConstantExpression | JSMemberExpression @@ -1142,81 +5767,484 @@ export type JSExpression | JSReferenceExpression -export interface JSConstantExpression extends SyntaxBase { +export interface JSConstantExpression extends SyntaxBase { kind: SyntaxKind.JSConstantExpression; value: BoltValue; + parentNode: JSConstantExpressionParent; + getChildNodes(): IterableIterator } -export interface JSMemberExpression extends SyntaxBase { +export type JSConstantExpressionParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| never + +export type JSConstantExpressionAnyParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| JSFunctionDeclaration +| never + +export type JSConstantExpressionChild += never + +export interface JSMemberExpression extends SyntaxBase { kind: SyntaxKind.JSMemberExpression; value: JSExpression; property: JSIdentifier; + parentNode: JSMemberExpressionParent; + getChildNodes(): IterableIterator } -export interface JSCallExpression extends SyntaxBase { +export type JSMemberExpressionParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| never + +export type JSMemberExpressionAnyParent += JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| JSFunctionDeclaration +| never + +export type JSMemberExpressionChild += never + +export interface JSCallExpression extends SyntaxBase { kind: SyntaxKind.JSCallExpression; operator: JSExpression; operands: JSExpression[]; + parentNode: JSCallExpressionParent; + getChildNodes(): IterableIterator } -export interface JSBinaryExpression extends SyntaxBase { +export type JSCallExpressionParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| never + +export type JSCallExpressionAnyParent += JSMemberExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| JSFunctionDeclaration +| never + +export type JSCallExpressionChild += never + +export interface JSBinaryExpression extends SyntaxBase { kind: SyntaxKind.JSBinaryExpression; left: JSExpression; operator: JSOperator; right: JSExpression; + parentNode: JSBinaryExpressionParent; + getChildNodes(): IterableIterator } -export interface JSUnaryExpression extends SyntaxBase { +export type JSBinaryExpressionParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| never + +export type JSBinaryExpressionAnyParent += JSMemberExpression +| JSCallExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| JSFunctionDeclaration +| never + +export type JSBinaryExpressionChild += never + +export interface JSUnaryExpression extends SyntaxBase { kind: SyntaxKind.JSUnaryExpression; operator: JSOperator; operand: JSExpression; + parentNode: JSUnaryExpressionParent; + getChildNodes(): IterableIterator } -export interface JSNewExpression extends SyntaxBase { +export type JSUnaryExpressionParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| never + +export type JSUnaryExpressionAnyParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| JSFunctionDeclaration +| never + +export type JSUnaryExpressionChild += never + +export interface JSNewExpression extends SyntaxBase { kind: SyntaxKind.JSNewExpression; target: JSExpression; arguments: JSExpression[]; + parentNode: JSNewExpressionParent; + getChildNodes(): IterableIterator } -export interface JSSequenceExpression extends SyntaxBase { +export type JSNewExpressionParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| never + +export type JSNewExpressionAnyParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| JSFunctionDeclaration +| never + +export type JSNewExpressionChild += never + +export interface JSSequenceExpression extends SyntaxBase { kind: SyntaxKind.JSSequenceExpression; expressions: JSExpression[]; + parentNode: JSSequenceExpressionParent; + getChildNodes(): IterableIterator } -export interface JSConditionalExpression extends SyntaxBase { +export type JSSequenceExpressionParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| never + +export type JSSequenceExpressionAnyParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| JSFunctionDeclaration +| never + +export type JSSequenceExpressionChild += never + +export interface JSConditionalExpression extends SyntaxBase { kind: SyntaxKind.JSConditionalExpression; test: JSExpression; consequent: JSExpression; alternate: JSExpression; + parentNode: JSConditionalExpressionParent; + getChildNodes(): IterableIterator } -export interface JSLiteralExpression extends SyntaxBase { +export type JSConditionalExpressionParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| never + +export type JSConditionalExpressionAnyParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| JSFunctionDeclaration +| never + +export type JSConditionalExpressionChild += never + +export interface JSLiteralExpression extends SyntaxBase { kind: SyntaxKind.JSLiteralExpression; value: JSValue; + parentNode: JSLiteralExpressionParent; + getChildNodes(): IterableIterator } -export interface JSReferenceExpression extends SyntaxBase { +export type JSLiteralExpressionParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| never + +export type JSLiteralExpressionAnyParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| JSFunctionDeclaration +| never + +export type JSLiteralExpressionChild += never + +export interface JSReferenceExpression extends SyntaxBase { kind: SyntaxKind.JSReferenceExpression; name: string; + parentNode: JSReferenceExpressionParent; + getChildNodes(): IterableIterator } +export type JSReferenceExpressionParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| never + +export type JSReferenceExpressionAnyParent += JSMemberExpression +| JSCallExpression +| JSBinaryExpression +| JSUnaryExpression +| JSNewExpression +| JSSequenceExpression +| JSConditionalExpression +| JSExpressionStatement +| JSConditionalCase +| JSReturnStatement +| JSParameter +| JSArrowFunctionDeclaration +| JSLetDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| JSFunctionDeclaration +| never + +export type JSReferenceExpressionChild += never + export type JSSourceElement - = JSExpressionStatement - | JSConditionalStatement - | JSReturnStatement - | JSImportDeclaration + = JSImportDeclaration | JSFunctionDeclaration | JSArrowFunctionDeclaration | JSLetDeclaration + | JSExpressionStatement + | JSConditionalStatement + | JSReturnStatement export type JSFunctionBodyElement - = JSExpressionStatement - | JSConditionalStatement - | JSReturnStatement - | JSFunctionDeclaration + = JSFunctionDeclaration | JSArrowFunctionDeclaration | JSLetDeclaration + | JSExpressionStatement + | JSConditionalStatement + | JSReturnStatement export type JSStatement @@ -1225,47 +6253,154 @@ export type JSStatement | JSReturnStatement -export interface JSCatchBlock extends SyntaxBase { +export interface JSCatchBlock extends SyntaxBase { kind: SyntaxKind.JSCatchBlock; bindings: JSPattern | null; elements: JSSourceElement[]; + parentNode: JSCatchBlockParent; + getChildNodes(): IterableIterator } -export interface JSTryCatchStatement extends SyntaxBase { +export type JSCatchBlockParent += never + +export type JSCatchBlockAnyParent += never + +export type JSCatchBlockChild += never + +export interface JSTryCatchStatement extends SyntaxBase { kind: SyntaxKind.JSTryCatchStatement; tryBlock: JSSourceElement[]; catchBlock: JSCatchBlock | null; finalBlock: JSSourceElement[] | null; + parentNode: JSTryCatchStatementParent; + getChildNodes(): IterableIterator } -export interface JSExpressionStatement extends SyntaxBase { +export type JSTryCatchStatementParent += never + +export type JSTryCatchStatementAnyParent += never + +export type JSTryCatchStatementChild += never + +export interface JSExpressionStatement extends SyntaxBase { kind: SyntaxKind.JSExpressionStatement; expression: JSExpression; + parentNode: JSExpressionStatementParent; + getChildNodes(): IterableIterator } -export interface JSConditionalCase extends SyntaxBase { +export type JSExpressionStatementParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSFunctionDeclaration +| JSSourceFile +| never + +export type JSExpressionStatementAnyParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSFunctionDeclaration +| JSSourceFile +| never + +export type JSExpressionStatementChild += never + +export interface JSConditionalCase extends SyntaxBase { kind: SyntaxKind.JSConditionalCase; test: JSExpression | null; body: JSFunctionBodyElement[]; + parentNode: JSConditionalCaseParent; + getChildNodes(): IterableIterator } -export interface JSConditionalStatement extends SyntaxBase { +export type JSConditionalCaseParent += never + +export type JSConditionalCaseAnyParent += never + +export type JSConditionalCaseChild += never + +export interface JSConditionalStatement extends SyntaxBase { kind: SyntaxKind.JSConditionalStatement; cases: JSConditionalCase[]; + parentNode: JSConditionalStatementParent; + getChildNodes(): IterableIterator } -export interface JSReturnStatement extends SyntaxBase { +export type JSConditionalStatementParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSFunctionDeclaration +| JSSourceFile +| never + +export type JSConditionalStatementAnyParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSFunctionDeclaration +| JSSourceFile +| never + +export type JSConditionalStatementChild += never + +export interface JSReturnStatement extends SyntaxBase { kind: SyntaxKind.JSReturnStatement; value: JSExpression | null; + parentNode: JSReturnStatementParent; + getChildNodes(): IterableIterator } -export interface JSParameter extends SyntaxBase { +export type JSReturnStatementParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSFunctionDeclaration +| JSSourceFile +| never + +export type JSReturnStatementAnyParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSFunctionDeclaration +| JSSourceFile +| never + +export type JSReturnStatementChild += never + +export interface JSParameter extends SyntaxBase { kind: SyntaxKind.JSParameter; index: number; bindings: JSPattern; defaultValue: JSExpression | null; + parentNode: JSParameterParent; + getChildNodes(): IterableIterator } +export type JSParameterParent += never + +export type JSParameterAnyParent += never + +export type JSParameterChild += never + export type JSDeclaration = JSImportDeclaration | JSFunctionDeclaration @@ -1281,49 +6416,166 @@ export type JSImportBinding | JSImportAsBinding -export interface JSImportStarBinding extends SyntaxBase { +export interface JSImportStarBinding extends SyntaxBase { kind: SyntaxKind.JSImportStarBinding; local: JSIdentifier; + parentNode: JSImportStarBindingParent; + getChildNodes(): IterableIterator } -export interface JSImportAsBinding extends SyntaxBase { +export type JSImportStarBindingParent += JSImportDeclaration +| never + +export type JSImportStarBindingAnyParent += JSImportDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| never + +export type JSImportStarBindingChild += never + +export interface JSImportAsBinding extends SyntaxBase { kind: SyntaxKind.JSImportAsBinding; remote: JSIdentifier; local: JSIdentifier | null; + parentNode: JSImportAsBindingParent; + getChildNodes(): IterableIterator } -export interface JSImportDeclaration extends SyntaxBase { +export type JSImportAsBindingParent += JSImportDeclaration +| never + +export type JSImportAsBindingAnyParent += JSImportDeclaration +| JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| never + +export type JSImportAsBindingChild += never + +export interface JSImportDeclaration extends SyntaxBase { kind: SyntaxKind.JSImportDeclaration; bindings: JSImportBinding[]; filename: JSString; + parentNode: JSImportDeclarationParent; + getChildNodes(): IterableIterator } -export interface JSFunctionDeclaration extends SyntaxBase { +export type JSImportDeclarationParent += JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| never + +export type JSImportDeclarationAnyParent += JSCatchBlock +| JSTryCatchStatement +| JSSourceFile +| never + +export type JSImportDeclarationChild += never + +export interface JSFunctionDeclaration extends SyntaxBase { kind: SyntaxKind.JSFunctionDeclaration; modifiers: JSDeclarationModifiers; name: JSIdentifier; params: JSParameter[]; body: JSStatement[]; + parentNode: JSFunctionDeclarationParent; + getChildNodes(): IterableIterator } -export interface JSArrowFunctionDeclaration extends SyntaxBase { +export type JSFunctionDeclarationParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSSourceFile +| never + +export type JSFunctionDeclarationAnyParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSSourceFile +| never + +export type JSFunctionDeclarationChild += never + +export interface JSArrowFunctionDeclaration extends SyntaxBase { kind: SyntaxKind.JSArrowFunctionDeclaration; name: JSIdentifier; params: JSParameter[]; body: JSExpression; + parentNode: JSArrowFunctionDeclarationParent; + getChildNodes(): IterableIterator } -export interface JSLetDeclaration extends SyntaxBase { +export type JSArrowFunctionDeclarationParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSSourceFile +| never + +export type JSArrowFunctionDeclarationAnyParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSSourceFile +| never + +export type JSArrowFunctionDeclarationChild += never + +export interface JSLetDeclaration extends SyntaxBase { kind: SyntaxKind.JSLetDeclaration; bindings: JSPattern; value: JSExpression | null; + parentNode: JSLetDeclarationParent; + getChildNodes(): IterableIterator } -export interface JSSourceFile extends SyntaxBase { +export type JSLetDeclarationParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSSourceFile +| never + +export type JSLetDeclarationAnyParent += JSCatchBlock +| JSTryCatchStatement +| JSConditionalCase +| JSSourceFile +| never + +export type JSLetDeclarationChild += never + +export interface JSSourceFile extends SyntaxBase { kind: SyntaxKind.JSSourceFile; elements: JSSourceElement[]; + parentNode: JSSourceFileParent; + getChildNodes(): IterableIterator } +export type JSSourceFileParent += never + +export type JSSourceFileAnyParent += never + +export type JSSourceFileChild += never + export type BoltSyntax = BoltStringLiteral | BoltIntegerLiteral @@ -1381,6 +6633,7 @@ export type BoltSyntax | BoltRecordFieldPattern | BoltRecordPattern | BoltQuoteExpression + | BoltTupleExpression | BoltReferenceExpression | BoltMemberExpression | BoltFunctionExpression @@ -1539,6 +6792,7 @@ export type Syntax | BoltRecordFieldPattern | BoltRecordPattern | BoltQuoteExpression + | BoltTupleExpression | BoltReferenceExpression | BoltMemberExpression | BoltFunctionExpression @@ -1682,7 +6936,7 @@ export function createBoltParenthesized(text: string, span?: TextSpan | null): B export function createBoltBraced(text: string, span?: TextSpan | null): BoltBraced; export function createBoltBracketed(text: string, span?: TextSpan | null): BoltBracketed; export function createBoltSourceFile(elements: BoltSourceElement[], package: Package, span?: TextSpan | null): BoltSourceFile; -export function createBoltQualName(modulePath: BoltIdentifier[] | null, name: BoltSymbol, span?: TextSpan | null): BoltQualName; +export function createBoltQualName(modulePath: BoltIdentifier[] | null, span?: TextSpan | null): BoltQualName; export function createBoltModulePath(isAbsolute: boolean, elements: BoltIdentifier[], span?: TextSpan | null): BoltModulePath; export function createBoltReferenceTypeExpression(path: BoltModulePath, arguments: BoltTypeExpression[] | null, span?: TextSpan | null): BoltReferenceTypeExpression; export function createBoltFunctionTypeExpression(params: BoltParameter[], returnType: BoltTypeExpression | null, span?: TextSpan | null): BoltFunctionTypeExpression; @@ -1694,8 +6948,9 @@ export function createBoltTuplePatternElement(index: number, pattern: BoltPatter export function createBoltTuplePattern(elements: BoltTuplePatternElement[], span?: TextSpan | null): BoltTuplePattern; export function createBoltRecordFieldPattern(isRest: boolean, name: BoltIdentifier | null, pattern: BoltPattern | null, span?: TextSpan | null): BoltRecordFieldPattern; export function createBoltRecordPattern(name: BoltTypeExpression, fields: BoltRecordFieldPattern[], span?: TextSpan | null): BoltRecordPattern; -export function createBoltQuoteExpression(tokens: Token[], span?: TextSpan | null): BoltQuoteExpression; -export function createBoltReferenceExpression(name: BoltQualName, span?: TextSpan | null): BoltReferenceExpression; +export function createBoltQuoteExpression(tokens: Token | BoltExpression[], span?: TextSpan | null): BoltQuoteExpression; +export function createBoltTupleExpression(elements: BoltExpression[], span?: TextSpan | null): BoltTupleExpression; +export function createBoltReferenceExpression(modulePath: BoltModulePath | null, name: BoltSymbol, span?: TextSpan | null): BoltReferenceExpression; export function createBoltMemberExpression(expression: BoltExpression, path: BoltIdentifier[], span?: TextSpan | null): BoltMemberExpression; export function createBoltFunctionExpression(params: BoltParameter[], returnType: BoltTypeExpression | null, body: BoltFunctionBodyElement[], span?: TextSpan | null): BoltFunctionExpression; export function createBoltCallExpression(operator: BoltExpression, operands: BoltExpression[], span?: TextSpan | null): BoltCallExpression; @@ -1858,6 +7113,7 @@ export function isBoltRecordFieldPattern(value: any): value is BoltRecordFieldPa export function isBoltRecordPattern(value: any): value is BoltRecordPattern; export function isBoltExpression(value: any): value is BoltExpression; export function isBoltQuoteExpression(value: any): value is BoltQuoteExpression; +export function isBoltTupleExpression(value: any): value is BoltTupleExpression; export function isBoltReferenceExpression(value: any): value is BoltReferenceExpression; export function isBoltMemberExpression(value: any): value is BoltMemberExpression; export function isBoltFunctionExpression(value: any): value is BoltFunctionExpression; diff --git a/src/bin/bolt.ts b/src/bin/bolt.ts index ac8a147b8..9e4a722e4 100644 --- a/src/bin/bolt.ts +++ b/src/bin/bolt.ts @@ -17,7 +17,6 @@ import { Package } from "../common" import {hasOwnProperty} from "../util" import {isString} from "util" import {DiagnosticPrinter, E_FIELD_NOT_PRESENT, E_FIELD_MUST_BE_STRING, E_FIELD_HAS_INVALID_VERSION_NUMBER} from "../diagnostics" -import {BoltSourceFileModifiers} from "../ast" //global.print = function (value: any) { // console.error(require('util').inspect(value, { depth: Infinity, colors: true })) @@ -158,6 +157,18 @@ yargs ) + .command( + 'check [files..]', + 'Check the given files/packages for mistakes.', + yargs => yargs, + args => { + const pkgs = loadPackagesAndSourceFiles(toArray(args.files as string[] | string)); + const program = new Program(pkgs); + const frontend = new Frontend(); + frontend.check(program); + } + ) + .command( 'bundle [files..]', diff --git a/src/checker.ts b/src/checker.ts deleted file mode 100644 index 9e637efb6..000000000 --- a/src/checker.ts +++ /dev/null @@ -1,883 +0,0 @@ -/** - * - * ``` - * mod foo { - * type MyType1 = i32; - * mod bar { - * pub type MyType2 = MyType1; - * } - * } - * ``` - * - * ``` - * mod foo { - * let x = 1; - * mod bar { - * fn do_something(y) { - * return x + y; - * } - * } - * } - * ``` - * - * Note that the `pub`-keyword is not present on `MyType1`. - */ - -import { - isSyntax, - Syntax, - SyntaxKind, - BoltReferenceExpression, - BoltDeclaration, - BoltSourceFile, - BoltSyntax, - BoltTypeDeclaration, - BoltExpression, - BoltFunctionDeclaration, - BoltFunctionBodyElement, - kindToString, - BoltStatement, - BoltTypeExpression, - BoltSourceElement, - isBoltStatement, - isBoltDeclaration, - isSourceFile, - BoltReferenceTypeExpression, - isBoltTypeDeclaration, - SourceFile, - BoltModifiers -} from "./ast"; -import {warn, FastStringMap, countDigits, assert, verbose} from "./util"; -import { - DiagnosticPrinter, - E_TYPES_NOT_ASSIGNABLE, - E_TOO_MANY_ARGUMENTS_FOR_FUNCTION_CALL, - E_TOO_FEW_ARGUMENTS_FOR_FUNCTION_CALL, - E_TYPE_DECLARATION_NOT_FOUND, - E_DECLARATION_NOT_FOUND, - E_INVALID_ARGUMENTS, - E_FILE_NOT_FOUND, -} from "./diagnostics"; -import { createAnyType, isOpaqueType, createOpaqueType, Type, createVoidType, createVariantType, isVoidType } from "./types"; -import { getReturnStatementsInFunctionBody, Package } from "./common"; -import {emit} from "./emitter"; -import {Program} from "./program"; -import {type} from "os"; - -// TODO -const GLOBAL_SCOPE_ID = 0; - -class SymbolPath { - - constructor( - private parents: string[], - public isAbsolute: boolean, - public name: string - ) { - - } - - public hasParents(): boolean { - return this.parents.length > 0; - } - - public getParents() { - return this.parents; - } - -} - -function getModulePathToNode(node: BoltSyntax): string[] { - let elements = []; - while (true) { - if (node.kind === SyntaxKind.BoltModule) { - for (const element of node.name) { - elements.unshift(element.text); - } - } - if (node.parentNode === null) { - break; - } - node = node.parentNode; - } - return elements; -} - -function nodeToSymbolPath(node: BoltSyntax): SymbolPath { - switch (node.kind) { - case SyntaxKind.BoltIdentifier: - return new SymbolPath([], false, emit(node)); - case SyntaxKind.BoltQualName: - const name = emit(node.name); - if (node.modulePath === null) { - return new SymbolPath([], false, name); - } - return new SymbolPath(node.modulePath.map(id => id.text), false, name); - case SyntaxKind.BoltModulePath: - return new SymbolPath( - node.elements.slice(0, -1).map(el => el.text), - node.isAbsolute, - node.elements[node.elements.length-1].text - ); - default: - throw new Error(`Could not extract a symbol path from the given node.`); - } -} - -enum SymbolKind { - Type = 0x1, - Variable = 0x2, - Module = 0x4, -} - -function* getAllSymbolKindsInMask(symbolKindMask: SymbolKind) { - for (let i = 1; i <= symbolKindMask; i *= 2) { - if ((symbolKindMask & i) > 0) { - yield i; - } - } -} - -export interface ScopeInfo { - id: number; - declaration: BoltSyntax | Package; - parentScope?: ScopeInfo; - kind: SymbolKind, -} - -interface SymbolInfo { - kind: SymbolKind; - declarations: BoltSyntax[]; -} - -export class TypeChecker { - - constructor( - private diagnostics: DiagnosticPrinter, - private program: Program - ) { - - } - - private symbols = new FastStringMap(); - - public checkSourceFile(node: BoltSourceFile): void { - - const self = this; - for (const element of node.elements) { - visitSourceElement(element); - } - - function visitExpression(node: BoltExpression) { - - switch (node.kind) { - - case SyntaxKind.BoltConstantExpression: - break; - - case SyntaxKind.BoltReferenceExpression: - { - if (self.resolveReferenceExpression(node) === null) { - self.diagnostics.add({ - message: E_DECLARATION_NOT_FOUND, - args: { name: emit(node.name.name) }, - severity: 'error', - node: node, - }) - } - break; - } - - case SyntaxKind.BoltCallExpression: - { - - const fnDecls = self.getAllFunctionsInExpression(node.operator); - - for (const fnDecl of fnDecls) { - - if (fnDecl.params.length > node.operands.length) { - - self.diagnostics.add({ - message: E_TOO_FEW_ARGUMENTS_FOR_FUNCTION_CALL, - args: { expected: fnDecl.params.length, actual: node.operands.length }, - severity: 'error', - node: node, - }); - - } else if (fnDecl.params.length < node.operands.length) { - - self.diagnostics.add({ - message: E_TOO_MANY_ARGUMENTS_FOR_FUNCTION_CALL, - args: { expected: fnDecl.params.length, actual: node.operands.length }, - severity: 'error', - node: node, - }); - - } else { - - const paramCount = fnDecl.params.length; - for (let i = 0; i < paramCount; i++) { - const arg = node.operands[i]; - const param = fnDecl.params[i]; - let argType = self.getTypeOfNode(arg); - let paramType = self.getTypeOfNode(param); - if (!self.isTypeAssignableTo(argType, paramType)) { - self.diagnostics.add({ - message: E_INVALID_ARGUMENTS, - severity: 'error', - args: { name: fnDecl.name.text }, - node: arg, - }); - } - } - - } - - } - - break; - } - - default: - throw new Error(`Unknown node of type ${kindToString(node.kind)}.`); - - } - - } - - function visitTypeExpressionn(node: BoltTypeExpression) { - - switch (node.kind) { - - case SyntaxKind.BoltReferenceTypeExpression: - { - if (self.resolveTypeReferenceExpression(node) === null) { - self.diagnostics.add({ - message: E_TYPE_DECLARATION_NOT_FOUND, - args: { name: emit(node.path) }, - severity: 'error', - node: node, - }) - } - break; - } - - default: - throw new Error(`Unknown node of type ${kindToString(node.kind)}.`); - } - } - - function visitDeclaration(node: BoltDeclaration) { - - switch (node.kind) { - - case SyntaxKind.BoltRecordDeclaration: - { - if (node.members !== null) { - for (const member of node.members) { - if (member.kind === SyntaxKind.BoltRecordField) { - visitTypeExpressionn(member.type); - } - } - } - break; - } - - case SyntaxKind.BoltTypeAliasDeclaration: - { - // TODO - break; - } - - case SyntaxKind.BoltTraitDeclaration: - { - // TODO - break; - } - - case SyntaxKind.BoltImplDeclaration: - { - // TODO - break; - } - - case SyntaxKind.BoltFunctionDeclaration: - { - let fnReturnType: Type = createAnyType(); - - if (node.returnType !== null) { - fnReturnType = self.getTypeOfNode(node.returnType); - } - - if (node.body !== null) { - const returnStmts = getReturnStatementsInFunctionBody(node.body) - const validReturnTypes: Type[] = []; - for (const returnStmt of returnStmts) { - if (returnStmt.value === null) { - if (!isVoidType(fnReturnType)) { - self.diagnostics.add({ - message: E_MUST_RETURN_A_VALUE, - node: returnStmt, - severity: 'error', - }); - } - } else { - checkExpressionMatchesType(returnStmt.value, fnReturnType); - } - //const returnType = self.getTypeOfNode(returnStmt); - //if (!self.isTypeAssignableTo(fnReturnType, returnType)) { - //self.diagnostics.add({ - //severity: 'error', - //node: returnStmt.value !== null ? returnStmt.value : returnStmt, - //args: { left: fnReturnType, right: returnType }, - //message: E_TYPES_NOT_ASSIGNABLE, - //}); - //} else { - //validReturnTypes.push(returnType); - //} - } - } - - // TODO Sort the return types and find the largest types, eliminating types that fall under other types. - // Next, add the resulting types as type hints to `fnReturnType`. - - break; - } - - default: - throw new Error(`Unknown node of type ${kindToString(node.kind)}.`); - - } - - } - - function checkExpressionMatchesType(node: BoltExpression, expectedType: Type) { - switch (node.kind) { - case SyntaxKind.BoltMatchExpression: - { - for (const matchArm of node.arms) { - checkExpressionMatchesType(matchArm.body, expectedType); - } - break; - } - default: - { - const actualType = self.getTypeOfNode(node); - if (!self.isTypeAssignableTo(expectedType, actualType)) { - self.diagnostics.add({ - severity: 'error', - message: E_TYPES_NOT_ASSIGNABLE, - args: { left: expectedType, right: actualType }, - node, - }); - } - break; - } - } - } - - function visitStatement(node: BoltStatement) { - switch (node.kind) { - case SyntaxKind.BoltExpressionStatement: - // TODO check for values that should be unwrapped - visitExpression(node.expression); - break; - case SyntaxKind.BoltReturnStatement: - if (node.value !== null) { - visitExpression(node.value); - } - break; - - default: - throw new Error(`Unknown node of type ${kindToString(node.kind)}.`); - } - } - - function visitSourceElement(node: BoltSourceElement) { - if (isBoltStatement(node)) { - visitStatement(node); - } else if (isBoltDeclaration(node)) { - visitDeclaration(node); - } else if (node.kind === SyntaxKind.BoltModule) { - for (const element of node.elements) { - visitSourceElement(element); - } - } else if (node.kind !== SyntaxKind.BoltImportDirective) { - throw new Error(`Unknown node of kind ${kindToString(node.kind)}`); - } - } - - } - - private resolveTypeName(name: string, node: BoltSyntax): Type | null { - const sym = this.findSymbolInScopeOf(name, this.getScopeSurroundingNode(node)); - if (sym === null) { - return null; - } - return this.getTypeOfNode(sym.declarations[0]); - } - - private createType(node: BoltSyntax): Type { - switch (node.kind) { - case SyntaxKind.BoltReferenceTypeExpression: - { - const referenced = this.resolveTypeReferenceExpression(node); - if (referenced === null) { - return createAnyType(); - } - return this.getTypeOfNode(referenced); - } - case SyntaxKind.BoltRecordDeclaration: - { - if (node.members === null) { - return createOpaqueType(); - } - // TODO - throw new Error(`Not yet implemented.`); - } - case SyntaxKind.BoltParameter: - { - let type: Type = createAnyType(); - if (node.type !== null) { - type = this.getTypeOfNode(node.type); - } - return type; - } - case SyntaxKind.BoltReturnStatement: - { - if (node.value === null) { - return createVoidType(); - } - return this.getTypeOfNode(node.value) - } - case SyntaxKind.BoltConstantExpression: - { - return node.value.getType(); - //if (typeof node.value === 'string') { - // type = this.resolveTypeName('String', node)!; - //} else if (typeof node.value === 'boolean') { - // type = this.resolveTypeName('bool', node)!; - //} else if (typeof node.value === 'bigint') { - // type = this.resolveTypeName('i32', node)!; - //} else { - // throw new Error(`Could not derive type of constant expression.`); - //} - //assert(type !== null); - //return type; - } - case SyntaxKind.BoltMatchExpression: - { - return createVariantType(...node.arms.map(arm => this.getTypeOfNode(arm.body))); - } - default: - throw new Error(`Could not derive type of node ${kindToString(node.kind)}.`); - } - } - - private getTypeOfNode(node: BoltSyntax): Type { - if (node._type !== undefined) { - return node._type; - } - const type = this.createType(node); - node._type = type; - return type; - } - - private isTypeAssignableTo(left: Type, right: Type): boolean { - if (isOpaqueType(left) && isOpaqueType(right)) { - return left === right; - } - return false; - } - - private getAllFunctionsInExpression(node: BoltExpression): BoltFunctionDeclaration[] { - - const self = this; - - const results: BoltFunctionDeclaration[] = []; - visitExpression(node); - return results; - - function visitExpression(node: BoltExpression) { - switch (node.kind) { - case SyntaxKind.BoltReferenceExpression: - { - const resolved = self.resolveReferenceExpression(node); - if (resolved !== null) { - visitFunctionBodyElement(resolved); - } - break; - } - default: - throw new Error(`Unexpected node type ${kindToString(node.kind)}`); - } - } - - function visitFunctionBodyElement(node: BoltFunctionBodyElement) { - switch (node.kind) { - case SyntaxKind.BoltFunctionDeclaration: - results.push(node); - break; - case SyntaxKind.BoltVariableDeclaration: - if (node.value !== null) { - visitExpression(node.value); - } - break; - default: - throw new Error(`Unexpected node type ${kindToString(node.kind)}`); - } - } - - } - - public registerSourceFile(node: BoltSourceFile): void { - - const self = this; - - addAllSymbolsToScope( - node, - this.getScopeForNode(node, SymbolKind.Variable), - this.getScopeForNode(node, SymbolKind.Type), - this.getScopeForNode(node, SymbolKind.Module) - ); - - - function addAllSymbolsToScope(node: BoltSyntax, variableScope: ScopeInfo, typeScope: ScopeInfo, moduleScope: ScopeInfo): void { - - switch (node.kind) { - - case SyntaxKind.BoltImportDirective: - { - if (node.symbols !== null) { - for (const importSymbol of node.symbols) { - // TODO - } - } else { - const sourceFile = self.program.resolveToSourceFile(node.file.value, node) as BoltSourceFile; - if (sourceFile === null) { - // FIXME should be moved to checkNode() - self.diagnostics.add({ - severity: 'error', - message: E_FILE_NOT_FOUND, - args: { filename: node.file.value }, - node: node.file, - }); - } else { - for (const exportedNode of self.getAllExportedNodes(sourceFile)) { - addNodeAsSymbol(exportedNode, true); - } - } - } - break; - } - - case SyntaxKind.BoltModule: - { - addNodeAsSymbol(node); - // TODO check for duplicates - for (const element of node.elements) { - addAllSymbolsToScope(element, variableScope, typeScope, moduleScope); - } - break; - } - - case SyntaxKind.BoltSourceFile: - { - for (const element of node.elements) { - addAllSymbolsToScope(element, variableScope, typeScope, moduleScope); - } - break; - } - - case SyntaxKind.BoltRecordDeclaration: - case SyntaxKind.BoltFunctionDeclaration: - addNodeAsSymbol(node); - break; - - } - - function addNodeAsSymbol(node: BoltSyntax, allowDuplicates = false) { - - switch (node.kind) { - - case SyntaxKind.BoltModule: - checkAndAddNode(node.name[node.name.length-1].text, node, moduleScope, SymbolKind.Module); - break; - - case SyntaxKind.BoltFunctionDeclaration: - checkAndAddNode(emit(node.name), node, variableScope, SymbolKind.Variable); - break; - - case SyntaxKind.BoltRecordDeclaration: - checkAndAddNode(node.name.text, node, typeScope, SymbolKind.Type); - break; - - } - - function checkAndAddNode(symbolName: string, node: BoltSyntax, scope: ScopeInfo, symbolKind: SymbolKind) { - const sym = self.lookupSymbolInScope(symbolName, variableScope, symbolKind) - if (sym !== null) { - if (!allowDuplicates) { - throw new Error(`Symbol '${symbolName}' is already defined.`); - } - if (sym.declarations.indexOf(node) === -1) { - throw new Error(`Different symbols imported under the same name.`); - } - } - self.addSymbolToScope(symbolName, node, scope, symbolKind); - } - - } - - } - - } - - private getAllExportedNodes(node: BoltSyntax): BoltSyntax[] { - - const nodes: BoltSyntax[] = []; - visit(node); - return nodes; - - function visit(node: BoltSyntax) { - - switch (node.kind) { - - case SyntaxKind.BoltFunctionDeclaration: - case SyntaxKind.BoltRecordDeclaration: - case SyntaxKind.BoltTypeAliasDeclaration: - case SyntaxKind.BoltVariableDeclaration: - if ((node.modifiers & BoltModifiers.IsPublic) > 0) { - nodes.push(node); - } - break; - - case SyntaxKind.BoltSourceFile: - for (const element of node.elements) { - visit(element); - } - break; - - case SyntaxKind.BoltModule: - if ((node.modifiers & BoltModifiers.IsPublic) > 0) { - nodes.push(node); - } - break; - - } - } - - } - - private resolveReferenceExpression(node: BoltReferenceExpression): BoltDeclaration | null { - const symbolPath = nodeToSymbolPath(node.name) - const scope = this.getScopeForNode(node, SymbolKind.Variable); - return this.resolveSymbolPath(symbolPath, scope, SymbolKind.Variable) as BoltDeclaration; - } - - private resolveTypeReferenceExpression(node: BoltReferenceTypeExpression): BoltTypeDeclaration | null { - const symbolPath = nodeToSymbolPath(node.path); - const scope = this.getScopeForNode(node, SymbolKind.Type); - return this.resolveSymbolPath(symbolPath, scope, SymbolKind.Type) as BoltTypeDeclaration; - } - - public addSymbol(name: string, node: BoltSyntax, kind: SymbolKind): void { - const scope = this.getScopeSurroundingNode(node, kind); - this.addSymbolToScope(name, node, scope, kind) - } - - public addSymbolToScope(name: string, node: BoltSyntax, scope: ScopeInfo, symbolKindMask: SymbolKind): void { - //let message = `Adding symbol ${name} in scope #${scope.id}`; - //const modulePath = getModulePathToNode(scope.declaration); - //if (modulePath.length > 0) { - // message += ` of module ${modulePath.join('::')} in file ${scope.declaration.span!.file.origPath}`; - //} else { - // message += ` of file ${scope.declaration.span!.file.origPath}`; - //} - //verbose(message); - const sym = { kind: symbolKindMask, declarations: [ node ] } as SymbolInfo; - for (const symbolKind of getAllSymbolKindsInMask(symbolKindMask)) { - const key = `${symbolKind}:${name}:${scope.id}`; - if (this.symbols.has(key)) { - warn(`Warninig: silently skipping introduction of duplicate symbol '${name}'`); - } else { - this.symbols.set(key, sym); - } - } - } - - public getParentScope(scope: ScopeInfo, kind: SymbolKind): ScopeInfo | null { - - // We might have already calculcated this scope's parent scope before;; - if (scope.parentScope !== undefined) { - return scope.parentScope; - } - - if (isSyntax(scope.declaration)) { - - // Edge case where there are no parent nodes left to traverse - if (scope.declaration.kind === SyntaxKind.BoltSourceFile) { - const pkg = (scope.declaration as BoltSourceFile).package; - return { - id: pkg.id, - declaration: pkg, - } as ScopeInfo; - } - - return this.getScopeForNode(scope.declaration.parentNode!, kind) - } - - // If the declaration was not an AST node, it can only be a package - return null; - } - - public getScopeSurroundingNode(node: Syntax, kind: SymbolKind): ScopeInfo { - assert(node.parentNode !== null); - return this.getScopeForNode(node.parentNode!, kind); - } - - public getScopeForNode(node: BoltSyntax, kind: SymbolKind): ScopeInfo { - - let currNode = node; - - while (true) { - - // We might have created a scope for this node before, - // or saved the relevant scope for efficiency. - if (node._scope !== undefined) { - return node._scope; - } - - // When we've reached a node that introduces a new scope according - // to the rules of the SymbolKind, we may continue. - if (this.introducesNewScope(currNode.kind, kind)) { - break; - } - - assert(currNode.parentNode !== null); - currNode = currNode.parentNode!; - } - - return { - id: currNode.id, - declaration: currNode, - } as ScopeInfo; - } - - private lookupSymbolInScope(name: string, scope: ScopeInfo, symbolKindMask: SymbolKind): SymbolInfo | null { - for (const symbolKind of getAllSymbolKindsInMask(symbolKindMask)) { - const key = `${symbolKind}:${name}:${scope.id}`; - if (this.symbols.has(key)) { - return this.symbols.get(key); - } - } - return null; - } - - private findSymbolInScopeOf(name: string, scope: ScopeInfo, kind: SymbolKind): SymbolInfo | null { - while (true) { - - // Attempt to look up the symbol in the scope that was either passed to this - // method or one of its parents. If we found one, we're done. - const sym = this.lookupSymbolInScope(name, scope, kind); - if (sym !== null) { - return sym; - } - - const parentScope = this.getParentScope(scope, kind); - - // Failing to find a parent scope means that none of the enclosing - // scopes had the given variable. If this is the case, jump to the - // error handling logic. - if (parentScope === null) { - break; - } - - scope = parentScope; - } - - return null; - } - - public resolveSymbolPath(path: SymbolPath, scope: ScopeInfo, kind: SymbolKind): BoltSyntax | null { - - if (path.hasParents()) { - - if (path.isAbsolute) { - - // TODO - - } else { - - // We will keep looping until we are at the topmost module of - // the package corresponding to `node`. - while (true) { - - let shouldSearchParentScopes = false; - let currScope = scope; - - // Go through each of the parent names in normal order, resolving to the module - // that declared the name, and mark when we failed to look up the inner module. - for (const name of path.getParents()) { - const sym = this.lookupSymbolInScope(name, currScope, SymbolKind.Module); - if (sym === null) { - shouldSearchParentScopes = true; - break; - } - if (sym.declarations[0].kind !== SyntaxKind.BoltModule) { - shouldSearchParentScopes = true; - break; - } - // FIXME it should be possible to directly get the scope of a symbol - currScope = this.getScopeForNode(sym.declarations[0], SymbolKind.Module); - } - - // If the previous loop did not fail, we are done. - if (!shouldSearchParentScopes) { - scope = currScope; - break; - } - - // We continue the outer loop by getting the parent module, which should be - // equivalent to getting the parent module scope. - const parentScope = this.getParentScope(scope, SymbolKind.Module); - if (parentScope === null) { - return null; - } - scope = parentScope; - } - - } - - } - - // Once we've handled any module path that might have been present, - // we resolve the actual symbol using a helper method. - - const sym = this.findSymbolInScopeOf(path.name, scope, kind); - - if (sym === null) { - return null; - } - - return sym.declarations[0]!; - } - - private introducesNewScope(nodeKind: SyntaxKind, symbolKind: SymbolKind) { - switch (symbolKind) { - case SymbolKind.Variable: - return nodeKind === SyntaxKind.BoltSourceFile - || nodeKind === SyntaxKind.BoltModule - || nodeKind === SyntaxKind.BoltFunctionDeclaration - || nodeKind === SyntaxKind.BoltBlockExpression; - case SymbolKind.Type: - return nodeKind === SyntaxKind.BoltModule - || nodeKind === SyntaxKind.BoltSourceFile; - case SymbolKind.Module: - return nodeKind === SyntaxKind.BoltModule - || nodeKind === SyntaxKind.BoltSourceFile; - } - } - -} - diff --git a/src/checks.ts b/src/checks.ts new file mode 100644 index 000000000..fc6e2b5a2 --- /dev/null +++ b/src/checks.ts @@ -0,0 +1,149 @@ +import { BoltImportDirective, Syntax, BoltParameter, BoltModulePath, BoltReferenceExpression, BoltReferenceTypeExpression, BoltSourceFile, BoltCallExpression, BoltReturnKeyword, BoltReturnStatement, SyntaxKind, NodeVisitor } from "./ast"; +import { Program } from "./program"; +import { DiagnosticPrinter, E_FILE_NOT_FOUND, E_TYPES_NOT_ASSIGNABLE, E_DECLARATION_NOT_FOUND, E_TYPE_DECLARATION_NOT_FOUND, E_MUST_RETURN_A_VALUE } from "./diagnostics"; +import { getSymbolPathFromNode } from "./resolver" +import { inject } from "./di"; +import { SymbolResolver, ScopeType } from "./resolver"; +import { assert } from "./util"; +import { emitNode } from "./emitter"; +import { TypeChecker, Type } from "./types"; +import { getReturnStatementsInFunctionBody } from "./common"; + +export class CheckInvalidFilePaths extends NodeVisitor { + + constructor( + @inject private program: Program, + @inject private diagnostics: DiagnosticPrinter, + ) { + super(); + } + + protected visitBoltImportDirective(node: BoltImportDirective) { + const sourceFile = this.program.resolveToSourceFile(node.file.value, node); + if (sourceFile === null) { + this.diagnostics.add({ + severity: 'error', + message: E_FILE_NOT_FOUND, + args: { filename: node.file.value }, + node: node.file, + }); + } + } + +} + +export class CheckReference extends NodeVisitor { + + constructor( + @inject private diagnostics: DiagnosticPrinter, + @inject private resolver: SymbolResolver + ) { + super(); + } + + private checkBoltModulePath(node: BoltModulePath, symbolKind: ScopeType) { + const scope = this.resolver.getScopeForNode(node, symbolKind); + assert(scope !== null); + const sym = this.resolver.resolveModulePath(node.elements.map(el => el.text), scope!); + if (sym === null) { + this.diagnostics.add({ + message: E_DECLARATION_NOT_FOUND, + severity: 'error', + args: { name: emitNode(node) }, + node, + }); + } + } + + protected visitBoltReferenceExpression(node: BoltReferenceExpression) { + if (node.modulePath !== null) { + this.checkBoltModulePath(node.modulePath, ScopeType.Variable); + } + const scope = this.resolver.getScopeSurroundingNode(node, ScopeType.Variable); + assert(scope !== null); + const resolvedSym = this.resolver.resolveSymbolPath(getSymbolPathFromNode(node), scope!); + if (resolvedSym === null) { + this.diagnostics.add({ + message: E_DECLARATION_NOT_FOUND, + args: { name: emitNode(node.name) }, + severity: 'error', + node: node.name, + }) + } + } + + protected visitBoltReferenceTypeExpression(node: BoltReferenceTypeExpression) { + const scope = this.resolver.getScopeForNode(node, ScopeType.Type); + assert(scope !== null); + const resolvedSym = this.resolver.resolveSymbolPath(getSymbolPathFromNode(node), scope!); + if (resolvedSym === null) { + this.diagnostics.add({ + message: E_TYPE_DECLARATION_NOT_FOUND, + args: { name: emitNode(node.path) }, + severity: 'error', + node: node.path, + }) + } + } + + +} + +export class CheckTypeAssignments extends NodeVisitor { + + constructor( + @inject private diagnostics: DiagnosticPrinter, + @inject private checker: TypeChecker, + ) { + super(); + } + + protected visitBoltReturnStatement(node: BoltReturnStatement) { + + const fnDecl = node.getParentOfKind(SyntaxKind.BoltFunctionDeclaration)!; + + if (node.value === null) { + if (fnDecl.returnType !== null && this.checker.isVoid(fnDecl.returnType)) { + this.diagnostics.add({ + message: E_MUST_RETURN_A_VALUE, + node, + severity: 'error', + }); + } + } else { + for (const error of this.checker.getAssignmentErrors(fnDecl.returnType, node.value)) { + this.diagnostics.add({ + message: E_MUST_RETURN_A_VALUE, + node: node, + severity: 'error', + }); + } + } + + } + + protected visitBoltParameter(node: BoltParameter) { + if (node.defaultValue !== null) { + for (const error of this.checker.getAssignmentErrors(node.bindings, node.defaultValue)) { + this.diagnostics.add({ + severity: 'error', + message: E_TYPES_NOT_ASSIGNABLE, + args: { node: error.node } + }); + } + } + } + + protected visitBoltCallExpression(node: BoltCallExpression) { + for (const fnDecl of this.checker.getCallableFunctions(node)) { + for (const error of this.checker.getAssignmentErrors(fnDecl, node)) { + this.diagnostics.add({ + severity: 'error', + message: E_TYPES_NOT_ASSIGNABLE, + args: { node: error.node }, + }); + } + } + } + +} diff --git a/src/common.ts b/src/common.ts index 623ec85e2..60c109697 100644 --- a/src/common.ts +++ b/src/common.ts @@ -10,11 +10,11 @@ import { isBoltPunctuated, SourceFile, BoltSourceFile, - BoltSourceFileModifiers, - isSourceFile + isSourceFile, + BoltSyntax, + BoltModifiers } from "./ast"; import { BOLT_SUPPORTED_LANGUAGES } from "./constants" -import {emit} from "./emitter"; import {FastStringMap, enumerate, escapeChar, assert} from "./util"; import {TextSpan, TextPos, TextFile} from "./text"; import {Scanner} from "./scanner"; @@ -56,13 +56,6 @@ export class Package { } -export function isAutoImported(node: BoltSourceFile): boolean { - //if (node.kind !== SyntaxKind.BoltSourceFile) { - // node = node.getParentOfKind(SyntaxKind.BoltSourceFile)! - //} - return (node.modifiers & BoltSourceFileModifiers.AutoImport) > 0; -} - export function getLanguage(node: Syntax): string { const kindStr = kindToString(node.kind); for (const prefix of BOLT_SUPPORTED_LANGUAGES) { @@ -148,10 +141,6 @@ export function getReturnStatementsInFunctionBody(body: BoltFunctionBody): BoltR } -export function hasPublicModifier(node: BoltDeclaration) { - return (node.modifiers & BoltDeclarationModifiers.Public) > 0; -} - export enum OperatorKind { Prefix, InfixL, @@ -210,6 +199,37 @@ export class OperatorTable { } +export function getModulePathToNode(node: BoltSyntax): string[] { + let elements = []; + while (true) { + if (node.kind === SyntaxKind.BoltModule) { + for (const element of node.name) { + elements.unshift(element.text); + } + } + if (node.parentNode === null) { + break; + } + node = node.parentNode; + } + return elements; +} + +export function isExported(node: Syntax) { + switch (node.kind) { + case SyntaxKind.BoltVariableDeclaration: + case SyntaxKind.BoltFunctionDeclaration: + case SyntaxKind.BoltModule: + case SyntaxKind.BoltRecordDeclaration: + case SyntaxKind.BoltTypeAliasDeclaration: + case SyntaxKind.BoltTraitDeclaration: + case SyntaxKind.BoltImplDeclaration: + return (node.modifiers & BoltModifiers.IsPublic) > 0; + default: + throw new Error(`The node ${kindToString(node.kind)} can not be exported.`) + } +} + export function describeKind(kind: SyntaxKind): string { switch (kind) { case SyntaxKind.BoltImportKeyword: diff --git a/src/emitter.ts b/src/emitter.ts index 4f75df0bf..3f25d0edf 100644 --- a/src/emitter.ts +++ b/src/emitter.ts @@ -98,7 +98,7 @@ export class Emitter { /** * A wrapper around `Emitter` for quick emission of AST nodes with sane defaults. */ -export function emit(node: Syntax) { +export function emitNode(node: Syntax) { const emitter = new Emitter(); return emitter.emit(node); } diff --git a/src/evaluator.ts b/src/evaluator.ts index e9d876456..1c2cb1cbb 100644 --- a/src/evaluator.ts +++ b/src/evaluator.ts @@ -1,77 +1,51 @@ -import { Syntax, SyntaxKind, Expr, isNode, BoltQualName } from "./ast" -import { TypeChecker, Type, RecordType, PrimType, boolType } from "./checker" -import { FastStringMap } from "./util" +import { Syntax, SyntaxKind, BoltQualName, BoltExpression, kindToString, BoltSyntax, isBoltStatement } from "./ast" +import { FastStringMap, assert } from "./util" +import { emitNode } from "./emitter"; +import { Type, TypeChecker, RecordType } from "./types"; export interface Value { - type: Type; + readonly type?: Type; + data: ValueData; } -export class PrimValue implements Value { +class Record { + + private fields: Map; + + constructor(fields: Iterable<[string, Value]>) { + this.fields = new Map(fields); + } - constructor( - public type: PrimType, - public value: any - ) { - + public clone(): Record { + return new Record(this.fields); + } + + public addField(name: string, value: Value): void { + this.fields.set(name, value); + } + + public deleteField(name: string): void { + this.fields.delete(name); + } + + public clear(): void { + this.fields.clear(); } } -export const TRUE = new PrimValue(boolType, true); -export const FALSE = new PrimValue(boolType, false); - -export abstract class RecordValue implements Value { - - abstract type: RecordType; - - abstract getValueOfField(name: string): Value; - -} - -export class NativeRecord implements Value { - - constructor( - public type: RecordType, - protected fields: FastStringMap, - ) { - - } - - getValueOfField(name: string): Value { - if (!this.type.hasField(name)) { - throw new Error(`Field '${name}' does not exist on this record.`) - } - return this.fields[name] - } - -} - -export class RecordWrapper extends RecordValue { - - constructor( - public type: RecordType, - protected data: any, - ) { - super(); - } - - getValueOfField(name: string): Value { - if (!this.type.hasField(name)) { - throw new Error(`Field '${name}' does not exist on this record.`) - } - return this.data[name] - } - -} - -function getDeclarationPath(node: BoltQualName) { - return [...node.modulePath.map(id => id.text), node.name.text]; -} +type ValueData + = string + | undefined + | boolean + | number + | bigint + | Record class Environment { - private symbols = FastStringMap(); + private symbols = new FastStringMap(); constructor(public parentEnv: Environment | null = null) { @@ -81,20 +55,22 @@ class Environment { if (name in this.symbols) { throw new Error(`A variable with the name '${name}' already exists.`); } - this.symbols[name] = value; + this.symbols.set(name, value); } public updateValue(name: string, newValue: Value) { - if (!(name in this.symbols)) { + if (!this.symbols.has(name)) { throw new Error(`Trying to update a variable '${name}' that has not been declared.`); } + this.symbols.delete(name); + this.symbols.set(name, newValue); } public lookup(name: string) { let curr = this as Environment; while (true) { - if (name in curr.symbols) { - return curr.symbols[name]; + if (this.symbols.has(name)) { + return curr.symbols.get(name); } if (curr.parentEnv === null) { break; @@ -106,40 +82,78 @@ class Environment { } +function mangle(node: BoltSyntax) { + switch (node.kind) { + case SyntaxKind.BoltIdentifier: + return emitNode(node); + default: + throw new Error(`Could not mangle ${kindToString(node.kind)} to a symbol name.`) + } +} + +class EvaluationError extends Error { + +} + export class Evaluator { constructor(public checker: TypeChecker) { } - match(value: Value, node: Syntax) { + private performPatternMatch(value: Value, node: Syntax, env: Environment): boolean { switch (node.kind) { - case SyntaxKind.RecordPatt: - for (const field of node.fields) { - if (!this.match((value as RecordValue).getValueOfField(field.name.text), field.pattern)) { - return false; + case SyntaxKind.BoltBindPattern: + { + env.setValue(node.name.text, value); + return true; + } + + case SyntaxKind.BoltRecordPattern: + { + if (!(value.data instanceof Record)) { + throw new EvaluationError(`A deconstructing record pattern received a value that is not a record.`); + } + const record = value.data.clone(); + for (const fieldPatt of node.fields) { + if (fieldPatt.isRest) { + if (fieldPatt.name !== null) { + env.setValue(fieldPatt.name.text, { data: fields.clone() }); + } + record.clear(); + } else { + assert(fieldPatt.name !== null); + let isMatch = true; + if (fieldPatt.pattern !== null) { + isMatch = this.performPatternMatch(value.getFieldValue(fieldPatt.name!.text), fieldPatt.pattern, env); + } + if (!isMatch) { + return false; + } + record.deleteField(fieldPatt.name!.text); } } return true; + } - case SyntaxKind.TypePatt: - return value.type === this.checker.getTypeOfNode(node) + case SyntaxKind.BoltTypePattern: + { + const expectedType = this.checker.getTypeOfNode(node.type); + if (!this.checker.isTypeAssignableTo(expectedType, getTypeOfValue(value))) { + return false; + } + return false; + } default: - throw new Error(`I did not know how to match on pattern ${SyntaxKind[node.kind]}`) + throw new Error(`I did not know how to match on pattern ${kindToString(node.kind)}`) } } - createValue(data: any) { - if (isNode(data)) { - return new RecordWrapper(this.checker.getTypeNamed(`Bolt.AST.${SyntaxKind[data.kind]}`)! as RecordType, data) - } - } - public eval(node: Syntax, env: Environment = new Environment()): Value { switch (node.kind) { @@ -147,32 +161,31 @@ export class Evaluator { case SyntaxKind.BoltSourceFile: case SyntaxKind.BoltModule: for (const element of node.elements) { - this.eval(element, env); + if (isBoltStatement(element)) { + this.eval(element, env); + } } - break; + return { data: undefined } - case SyntaxKind.BoltReferenceTypeExpression: - // FIXME - return env.lookup(node.name.name.text); - - case SyntaxKind.BoltRecordDeclaration: - case SyntaxKind.BoltFunctionDeclaration: - break; + case SyntaxKind.BoltReferenceExpression: + return env.lookup(mangle(node.name)); case SyntaxKind.BoltMatchExpression: const value = this.eval(node.value, env); - for (const [pattern, result] of node.arms) { - if (this.match(value, pattern)) { - return this.eval(result as Expr, env) + for (const matchArm of node.arms) { + const matchArmEnv = new Environment(env); + const isMatch = this.performPatternMatch(value, matchArm.pattern, matchArmEnv); + if (isMatch) { + return this.eval(matchArm.body, env) } } - return new PrimValue(this.checker.getTypeNamed('Void')!, null); + return { data: undefined }; case SyntaxKind.BoltConstantExpression: - return new PrimValue(this.checker.getTypeOfNode(node), node.value) + return node.value; default: - throw new Error(`Could not evaluate node ${SyntaxKind[node.kind]}`) + throw new Error(`Could not evaluate node ${kindToString(node.kind)}`) } diff --git a/src/frontend.ts b/src/frontend.ts index 7954bd9cc..5129d7942 100644 --- a/src/frontend.ts +++ b/src/frontend.ts @@ -5,20 +5,20 @@ import { now } from "microtime" import { EventEmitter } from "events" import { Program } from "./program" -import { TypeChecker } from "./checker" -import { Evaluator } from "./evaluator" -import { emit } from "./emitter" -import { Syntax, BoltSourceFile, SourceFile } from "./ast" -import { upsearchSync, FastStringMap, getFileStem, getLanguage } from "./util" -import { Package } from "./package" +import { emitNode } from "./emitter" +import { Syntax, BoltSourceFile, SourceFile, NodeVisitor } from "./ast" +import { getFileStem, MapLike } from "./util" import { verbose, memoize } from "./util" -import { Container } from "./di" +import { Container, Newable } from "./di" import ExpandBoltTransform from "./transforms/expand" import CompileBoltToJSTransform from "./transforms/boltToJS" import ConstFoldTransform from "./transforms/constFold" -import EliminateModulesTransform from "./transforms/eliminateModules" import { TransformManager } from "./transforms/index" import {DiagnosticPrinter} from "./diagnostics" +import { TypeChecker } from "./types" +import { checkServerIdentity } from "tls" +import { CheckInvalidFilePaths, CheckTypeAssignments } from "./checks" +import { SymbolResolver, BoltSymbolResolutionStrategy } from "./resolver" const targetExtensions: MapLike = { 'JS': '.mjs', @@ -33,7 +33,7 @@ interface TimingInfo { class Timing extends EventEmitter { - private runningTasks: FastStringMap = Object.create(null); + private runningTasks: MapLike = Object.create(null); public start(name: string) { if (this.runningTasks[name] !== undefined) { @@ -61,53 +61,67 @@ class Timing extends EventEmitter { export class Frontend { - public evaluator: Evaluator; - public checker: TypeChecker; + //public resolver = new SymbolResolver(); + //public evaluator = new Evaluator(this.resolver); public diagnostics: DiagnosticPrinter; public timing: Timing; - - private container = new Container(); constructor() { this.diagnostics = new DiagnosticPrinter(); this.timing = new Timing(); } - @memoize - public getPackage(filepath: string) { - const file = this.getTextFile(filepath) - const projectFile = upsearchSync('Boltfile', path.dirname(file.fullPath)); - if (projectFile === null) { - return null; - } - const projectDir = path.resolve(path.dirname(projectFile)); - return new Package(projectDir); - } + //@memoize(filepath => path.resolve(filepath)) + //public getPackage(filepath: string) { + // const file = this.getTextFile(filepath) + // const projectFile = upsearchSync('Boltfile', path.dirname(file.fullPath)); + // if (projectFile === null) { + // return null; + // } + // const projectDir = path.resolve(path.dirname(projectFile)); + // return new Package(projectDir); + //} + + public check(program: Program) { + + const resolver = new SymbolResolver(program, new BoltSymbolResolutionStrategy); + const checker = new TypeChecker(resolver); + + const container = new Container(); + container.bindSelf(program); + container.bindSelf(resolver); + container.bindSelf(checker); + + const checks: Newable[] = [ + CheckInvalidFilePaths, + CheckTypeAssignments, + ]; + + const checkers = checks.map(check => container.createInstance(check)); - public typeCheck(program: Program) { - const checker = new TypeChecker(this.diagnostics, program); for (const sourceFile of program.getAllSourceFiles()) { - checker.registerSourceFile(sourceFile as BoltSourceFile); + resolver.registerSourceFile(sourceFile as BoltSourceFile); } for (const sourceFile of program.getAllSourceFiles()) { - checker.checkSourceFile(sourceFile as BoltSourceFile); + sourceFile.visit(checkers) } } public compile(program: Program, target: string) { - // FIXME type checker should be shared across multple different method invocations - const checker = new TypeChecker(this.diagnostics, program); - const container = new Container(); - - //container.bindSelf(evaluator); - container.bindSelf(checker); + const resolver = new SymbolResolver(program, new BoltSymbolResolutionStrategy); + for (const sourceFile of program.getAllSourceFiles()) { + resolver.registerSourceFile(sourceFile as BoltSourceFile); + } + const transforms = new TransformManager(container); + container.bindSelf(transforms); + container.bindSelf(program); + container.bindSelf(resolver); switch (target) { case "JS": - const transforms = new TransformManager(this.container); transforms.register(ExpandBoltTransform); transforms.register(CompileBoltToJSTransform); transforms.register(ConstFoldTransform); @@ -121,7 +135,7 @@ export class Frontend { for (const sourceFile of program.getAllSourceFiles()) { fs.mkdirp('.bolt-work'); - fs.writeFileSync(this.mapToTargetFile(sourceFile), emit(sourceFile), 'utf8'); + fs.writeFileSync(this.mapToTargetFile(sourceFile), emitNode(sourceFile), 'utf8'); } } diff --git a/src/parser.ts b/src/parser.ts index 0a192958c..9f18d46c4 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -79,6 +79,7 @@ import { createBoltMemberExpression, createBoltModulePath, BoltModulePath, + isBoltSymbol, } from "./ast" import { parseForeignLanguage } from "./foreign" @@ -108,16 +109,23 @@ function assertNoTokens(tokens: BoltTokenStream) { } } -const KIND_EXPRESSION_T0 = [ - SyntaxKind.BoltStringLiteral, - SyntaxKind.BoltIntegerLiteral, +const KIND_SYMBOL = [ SyntaxKind.BoltIdentifier, SyntaxKind.BoltOperator, SyntaxKind.BoltVBar, + SyntaxKind.BoltLtSign, + SyntaxKind.BoltGtSign, +]; + +const KIND_EXPRESSION_T0 = uniq([ + SyntaxKind.BoltStringLiteral, + SyntaxKind.BoltIntegerLiteral, + SyntaxKind.BoltOperator, SyntaxKind.BoltMatchKeyword, SyntaxKind.BoltQuoteKeyword, SyntaxKind.BoltYieldKeyword, -] + ...KIND_SYMBOL, +]) const KIND_STATEMENT_T0 = uniq([ SyntaxKind.BoltReturnKeyword, @@ -194,7 +202,7 @@ export class Parser { return (this as any)['parse' + kindToString(kind).substring('Bolt'.length)](tokens); } - public parseNamespacePath(tokens: BoltTokenStream): BoltModulePath { + public parseModulePath(tokens: BoltTokenStream): BoltModulePath { let isAbsolute = false; let elements = []; @@ -381,7 +389,7 @@ export class Parser { public parseReferenceTypeExpression(tokens: BoltTokenStream): BoltReferenceTypeExpression { - const path = this.parseNamespacePath(tokens) + const path = this.parseModulePath(tokens) const t1 = tokens.peek(); let typeArgs: BoltTypeExpression[] | null = null; @@ -431,7 +439,7 @@ export class Parser { if (!isBoltOperatorLike(t0)) { break; } - let desc0 = this.typeOperatorTable.lookup(emit(t0)); + let desc0 = this.typeOperatorTable.lookup(emitNode(t0)); if (desc0 === null || desc0.arity !== 2 || desc0.precedence < minPrecedence) { break; } @@ -442,7 +450,7 @@ export class Parser { if (!isBoltOperatorLike(t1.kind)) { break; } - const desc1 = this.typeOperatorTable.lookup(emit(t1)) + const desc1 = this.typeOperatorTable.lookup(emitNode(t1)) if (desc1 === null || desc1.arity !== 2 || desc1.precedence < desc0.precedence || !isRightAssoc(desc1.kind)) { break; } @@ -512,9 +520,35 @@ export class Parser { } public parseReferenceExpression(tokens: BoltTokenStream): BoltReferenceExpression { - const name = this.parseNamespacePath(tokens); - const node = createBoltReferenceExpression(name); - setOrigNodeRange(node, name, name); + + const firstToken = tokens.peek(); + let isAbsolute = false; + let elements = []; + + while (true) { + const t2 = tokens.peek(2); + if (t2.kind !== SyntaxKind.BoltColonColon) { + break; + } + const t1 = tokens.get(); + assertToken(t1, SyntaxKind.BoltIdentifier); + elements.push(t1 as BoltIdentifier) + tokens.get(); + } + + let path = null; + if (elements.length > 0) { + path = createBoltModulePath(isAbsolute, elements); + setOrigNodeRange(path, elements[0], elements[elements.length-1]); + } + + const t3 = tokens.get(); + assertToken(t3, SyntaxKind.BoltIdentifier); + + // TODO Add support for parsing parenthesized operators + + const node = createBoltReferenceExpression(path, t3 as BoltIdentifier); + setOrigNodeRange(node, firstToken, t3); return node; } @@ -930,7 +964,7 @@ export class Parser { } // FIXME should fail to parse absolute paths - const name = this.parseNamespacePath(tokens); + const name = this.parseModulePath(tokens); const t1 = tokens.get(); if (t1.kind !== SyntaxKind.BoltBraced) { @@ -1526,7 +1560,7 @@ import { Scanner } from "./scanner" import { TextFile, TextSpan, TextPos } from "./text" import * as fs from "fs" import {JSScanner} from "./foreign/js/scanner"; -import {emit} from "./emitter"; +import {emitNode} from "./emitter"; export function parseSourceFile(filepath: string, pkg: Package): BoltSourceFile { const file = new TextFile(filepath); diff --git a/src/resolver.ts b/src/resolver.ts new file mode 100644 index 000000000..70806df3a --- /dev/null +++ b/src/resolver.ts @@ -0,0 +1,497 @@ +import { BoltSyntax, SyntaxKind, Syntax, BoltSourceFile, SourceFile, kindToString } from "./ast"; +import { emitNode } from "./emitter"; +import { Package, isExported } from "./common"; +import { FastStringMap, assert, every } from "./util"; +import { Program } from "./program"; + +const GLOBAL_SCOPE_ID = 'global'; + +export class SymbolPath { + + constructor( + private parents: string[], + public isAbsolute: boolean, + public name: string + ) { + + } + + public hasParents(): boolean { + return this.parents.length > 0; + } + + public getParents() { + return this.parents; + } + +} + +export function getSymbolPathFromNode(node: BoltSyntax): SymbolPath { + switch (node.kind) { + case SyntaxKind.BoltIdentifier: + return new SymbolPath([], false, emitNode(node)); + case SyntaxKind.BoltQualName: + const name = emitNode(node.name); + if (node.modulePath === null) { + return new SymbolPath([], false, name); + } + return new SymbolPath(node.modulePath.map(id => id.text), false, name); + case SyntaxKind.BoltModulePath: + return new SymbolPath( + node.elements.slice(0, -1).map(el => el.text), + node.isAbsolute, + node.elements[node.elements.length-1].text + ); + default: + throw new Error(`Could not extract a symbol path from the given node.`); + } +} + +export enum ScopeType { + Type = 0x1, + Variable = 0x2, + Module = 0x4, + Any = Type | Variable, +} + +function* getAllSymbolKinds() { + for (let i = 1; i <= ScopeType.Any; i *= 2) { + yield i; + } +} + +interface ScopeSource { + readonly id: string; +} + +class PackageScopeSource implements ScopeSource { + + constructor(public pkg: Package) { + + } + + public get id() { + return `pkg:${this.pkg.id}` + } + +} + +class GlobalScopeSource { + + public get id() { + return GLOBAL_SCOPE_ID; + } + +} + +class NodeScopeSource implements ScopeSource { + + constructor(public node: Syntax) { + + } + + public get id() { + return `node:${this.node.id}` + } + +} + +interface ResolutionStrategy { + getSymbolName(node: Syntax): string; + getScopeType(node: Syntax): ScopeType; + getNextScopeSources(source: ScopeSource, kind: ScopeType): IterableIterator; +} + +export class BoltSymbolResolutionStrategy implements ResolutionStrategy { + + public hasSymbol(node: Syntax): boolean { + switch (node.kind) { + case SyntaxKind.BoltModule: + case SyntaxKind.BoltBindPattern: + case SyntaxKind.BoltFunctionDeclaration: + case SyntaxKind.BoltTypeAliasDeclaration: + case SyntaxKind.BoltRecordDeclaration: + case SyntaxKind.BoltBindPattern: + case SyntaxKind.BoltTraitDeclaration: + case SyntaxKind.BoltImplDeclaration: + return true; + default: + return false; + } + } + + public getSymbolName(node: Syntax): string { + switch (node.kind) { + case SyntaxKind.BoltModule: + return node.name[node.name.length-1].text; + case SyntaxKind.BoltBindPattern: + return node.name.text; + case SyntaxKind.BoltFunctionDeclaration: + return emitNode(node.name); + case SyntaxKind.BoltTypeAliasDeclaration: + return node.name.text; + case SyntaxKind.BoltRecordDeclaration: + return node.name.text; + case SyntaxKind.BoltBindPattern: + return node.name.text; + case SyntaxKind.BoltTraitDeclaration: + return node.name.text; + case SyntaxKind.BoltImplDeclaration: + return node.name.text; + default: + throw new Error(`Could not derive symbol name of node ${kindToString(node.kind)}`) + } + } + + public getScopeType(node: Syntax): ScopeType { + switch (node.kind) { + case SyntaxKind.BoltVariableDeclaration: + case SyntaxKind.BoltFunctionDeclaration: + return ScopeType.Variable; + case SyntaxKind.BoltImplDeclaration: + case SyntaxKind.BoltTraitDeclaration: + case SyntaxKind.BoltTypeAliasDeclaration: + case SyntaxKind.BoltRecordDeclaration: + return ScopeType.Type; + case SyntaxKind.BoltModule: + return ScopeType.Module; + default: + throw new Error(`Could not derive scope type of node ${kindToString(node.kind)}.`) + } + } + + public introducesNewScope(node: BoltSyntax, kind: ScopeType): boolean { + switch (kind) { + case ScopeType.Variable: + return node.kind === SyntaxKind.BoltSourceFile + || node.kind === SyntaxKind.BoltModule + || node.kind === SyntaxKind.BoltFunctionDeclaration + || node.kind === SyntaxKind.BoltBlockExpression; + case ScopeType.Type: + return node.kind === SyntaxKind.BoltModule + || node.kind === SyntaxKind.BoltSourceFile + || node.kind === SyntaxKind.BoltFunctionDeclaration + || node.kind === SyntaxKind.BoltRecordDeclaration + || node.kind === SyntaxKind.BoltTraitDeclaration + || node.kind === SyntaxKind.BoltImplDeclaration; + case ScopeType.Module: + return node.kind === SyntaxKind.BoltModule + || node.kind === SyntaxKind.BoltRecordDeclaration + || node.kind === SyntaxKind.BoltSourceFile; + default: + throw new Error(`Invalid scope type detected.`) + } + } + + public *getNextScopeSources(source: ScopeSource, kind: ScopeType): IterableIterator { + + // If we are at a scope that was created by an AST node, we + // search the nearest parent that introduces a new scope of + // the requested kind. If no such scope was found, then we + // return the local package scope. + if (source instanceof NodeScopeSource) { + let currNode = source.node; + while (true) { + if (currNode.kind === SyntaxKind.BoltSourceFile) { + yield new PackageScopeSource(currNode.package); + return; + } + if (this.introducesNewScope(currNode, kind)) { + yield source; + return; + } + assert(currNode.parentNode !== null); + currNode = currNode.parentNode; + } + } + + // If we already are at the local package scope level, we go one up + // to the global scope shared by all packages. + if (source instanceof PackageScopeSource) { + yield new GlobalScopeSource(); + return; + } + + // If we are in the global scope, there is no scope above it. + if (source instanceof GlobalScopeSource) { + return; + } + + } + +} + +class Scope { + + private static scopeCache = new FastStringMap(); + + private nextScope: Scope | null | undefined; + private symbols = new FastStringMap(); + + constructor( + private resolver: SymbolResolver, + public kind: ScopeType, + public source: ScopeSource, + ) { + + } + + private get globallyUniqueKey() { + return `${this.kind}:${this.source.id}`; + } + + public getScope(kind: ScopeType) { + if (Scope.scopeCache.has(this.globallyUniqueKey)) { + return Scope.scopeCache.get(this.globallyUniqueKey); + } + const newScope = new Scope(this.resolver, kind, this.source); + Scope.scopeCache.set(this.globallyUniqueKey, newScope); + return newScope; + } + + public *getNextScopes(): IterableIterator { + let results = []; + for (const nextSource of this.resolver.strategy.getNextScopeSources(this.source, this.kind)) { + const key = `${this.kind}:${nextSource.id}`; + if (Scope.scopeCache.has(key)) { + yield Scope.scopeCache.get(this.globallyUniqueKey); + } else { + const newScope = new Scope(this.resolver, this.kind, nextSource); + Scope.scopeCache.set(this.globallyUniqueKey, newScope); + yield newScope; + } + } + } + + public getLocalSymbol(name: string) { + if (!this.symbols.has(name)) { + return null; + } + return this.symbols.get(name); + } + + public getExportedSymbol(name: string) { + if (!this.symbols.has(name)) { + return null; + } + const sym = this.symbols.get(name); + if (!sym.isExported) { + return null; + } + return sym; + } + + public getSymbol(name: string): SymbolInfo | null { + const stack: Scope[] = [ this ]; + while (stack.length > 0) { + const currScope = stack.pop()!; + const sym = currScope.getLocalSymbol(name); + if (sym !== null) { + return sym; + } + for (const nextScope of currScope.getNextScopes()) { + stack.push(nextScope); + } + } + return null; + } + + public addNodeAsSymbol(name: string, node: Syntax) { + if (this.symbols.has(name)) { + const sym = this.symbols.get(name); + if (!sym.declarations.has(node)) { + sym.declarations.add(node); + } + } else { + const sym = { + name, + scope: this, + declarations: new Set([ node ]), + isExported: isExported(node) + } as SymbolInfo; + this.symbols.set(name, sym); + } + } + +} + +interface SymbolInfo { + name: string; + scope: Scope; + isExported: boolean; + declarations: Set, +} + +export class SymbolResolver { + + constructor( + private program: Program, + public strategy: BoltSymbolResolutionStrategy + ) { + + } + + private symbols = new FastStringMap(); + + public registerSourceFile(node: SourceFile): void { + + for (const childNode of node.preorder()) { + if (this.strategy.hasSymbol(node)) { + const name = this.strategy.getSymbolName(node); + const scope = this.getScopeForNode(node, this.strategy.getScopeType(node)); + assert(scope !== null); + scope!.addNodeAsSymbol(name, node); + } + } + + for (const importDir of node.findAllChildrenOfKind(SyntaxKind.BoltImportDirective)) { + const sourceFile = this.program.resolveToSourceFile(importDir.file.value, importDir) as BoltSourceFile; + if (sourceFile !== null) { + if (importDir.symbols !== null) { + for (const importSymbol of importDir.symbols) { + switch (importSymbol.kind) { + case SyntaxKind.BoltPlainImportSymbol: + for (const scopeType of getAllSymbolKinds()) { + const scope = this.getScopeForNode(importDir, scopeType); + assert(scope !== null); + const exported = this.resolveSymbolPath(getSymbolPathFromNode(importSymbol), scope!); + if (exported !== null) { + for (const decl of exported.declarations) { + scope!.addNodeAsSymbol(this.strategy.getSymbolName(decl), decl); + } + } + } + } + } + } else { + for (const exportedNode of this.getAllExportedNodes(sourceFile)) { + const scope = this.getScopeForNode(importDir, this.strategy.getScopeType(exportedNode)); + assert(scope !== null); + scope!.addNodeAsSymbol(this.strategy.getSymbolName(exportedNode), exportedNode); + } + } + } + } + + } + + private *getAllExportedNodes(node: SourceFile): IterableIterator { + for (const element of node.elements) { + if (this.strategy.hasSymbol(element)) { + if (isExported(element)) { + yield element; + } + } + } + } + + public getScopeSurroundingNode(node: Syntax, kind: ScopeType): Scope | null { + assert(node.parentNode !== null); + return this.getScopeForNode(node.parentNode!, kind); + } + + public getScopeForNode(node: Syntax, kind: ScopeType): Scope | null { + let source: ScopeSource = new NodeScopeSource(node); + if (!this.strategy.introducesNewScope(source, kind)) { + const sources = [...this.strategy.getNextScopeSources(source, kind)]; + if (sources.length === 0) { + return null; + } + assert(sources.length === 1); + source = sources[0]; + } + return new Scope(this, kind, source); + } + + public resolveModulePath(path: string[], scope: Scope): Scope | null { + + const stack: Scope[] = [ scope ]; + + // We will keep looping until we are at the topmost module of + // the package corresponding to `node`. + while (true) { + + // An empty stack means we've looked everywhere but did not find a scope that contained + // the given module path. + if (stack.length === 0) { + return null; + } + + + let shouldSearchNextScopes = false; + let currScope = stack.pop()!; + + // Go through each of the parent names in normal order, resolving to the module + // that declared the name, and mark when we failed to look up the inner module. + for (const name of path) { + const sym = currScope.getSymbol(name); + if (sym === null) { + shouldSearchNextScopes = true; + break; + } + assert(every(sym.declarations.values(), decl => decl.kind === SyntaxKind.BoltModule)); + currScope = sym.scope; + } + + // If the previous loop did not fail, we are done. + if (!shouldSearchNextScopes) { + scope = currScope; + break; + } + + // We continue the outer loop by getting the parent module, which should be + // equivalent to getting the parent module scope. + for (const nextScope of scope.getNextScopes()) { + stack.push(nextScope); + } + + } + + return scope; + } + + public resolveSymbolPath(path: SymbolPath, scope: Scope): SymbolInfo | null { + + if (path.hasParents()) { + + if (path.isAbsolute) { + + // TODO + + } else { + + // Perform the acutal module resolution. + const resolvedScope = this.resolveModulePath(path.getParents(), scope); + + // Failing to find any module means that we cannot continue, because + // it does not make sense to get the symbol of a non-existent module. + if (resolvedScope === null) { + return null; + } + scope = resolvedScope; + + } + + } + + // Once we've handled any module path that might have been present, + // we resolve the actual symbol using a helper method. + + const sym = scope.getExportedSymbol(path.name); + + if (sym === null) { + return null; + } + + return sym; + } + + //public resolveTypeName(name: string, node: Syntax): Type | null { + // const sym = this.findSymbolInScopeOf(name, this.getScopeSurroundingNode(node)); + // if (sym === null) { + // return null; + // } + // return this.getTypeOfNode(sym.declarations[0]); + //} + +} \ No newline at end of file diff --git a/src/transforms/boltToJS.ts b/src/transforms/boltToJS.ts index bf714812e..0fb6fbaf5 100644 --- a/src/transforms/boltToJS.ts +++ b/src/transforms/boltToJS.ts @@ -1,8 +1,5 @@ -import { - TypeChecker, - Scope -} from "../checker" +import { TypeChecker } from "../types" import { Syntax, @@ -33,7 +30,6 @@ import { JSSyntax, JSSourceFile, isBoltSourceFile, - BoltImportDeclaration, BoltIdentifier, isBoltDeclaration, isBoltStatement, @@ -42,11 +38,12 @@ import { createJSParameter, } from "../ast" -import { hasPublicModifier, setOrigNodeRange } from "../util" -import { Program, SourceFile } from "../program" +import { setOrigNodeRange } from "../common" +import { Program } from "../program" import { Transformer, TransformManager } from "./index" import { assert } from "../util" import { inject } from "../di" +import { isExported } from "../common" export interface JSCompilerOptions { @@ -191,7 +188,7 @@ export class BoltToJSTransform implements Transformer { const params: JSParameter[] = []; let body: JSStatement[] = []; let modifiers = 0; - if (hasPublicModifier(node)) { + if (isExported(node)) { modifiers |= JSDeclarationModifiers.IsExported;; } let i = 0; diff --git a/src/transforms/constFold.ts b/src/transforms/constFold.ts index 1cc9fdaf3..735b056bc 100644 --- a/src/transforms/constFold.ts +++ b/src/transforms/constFold.ts @@ -1,13 +1,8 @@ -import { SourceFile } from "../program" -import { TransformManager } from "../transformers"; +import { SourceFile } from "../ast" export class ConstFoldTransform { - constructor(public transformers: TransformManager) { - - } - public isApplicable(node: SourceFile): boolean { return true; } diff --git a/src/transforms/expand.ts b/src/transforms/expand.ts index 54452920a..1e41dfb38 100644 --- a/src/transforms/expand.ts +++ b/src/transforms/expand.ts @@ -8,9 +8,10 @@ import { BoltPattern, isBoltSourceFile, BoltMacroCall, + BoltSourceFile, } from "../ast" -import { TypeChecker } from "../checker" +import { TypeChecker } from "../types" import { BoltTokenStream, Parser, isModifierKeyword } from "../parser" import { Evaluator, TRUE, FALSE } from "../evaluator" import { Transformer, TransformManager } from "./index" @@ -30,7 +31,6 @@ export class ExpandBoltTransform implements Transformer { private toExpand: BoltMacroCall[] = []; constructor( - private transforms: TransformManager, @inject private evaluator: Evaluator, @inject private checker: TypeChecker ) { @@ -57,8 +57,8 @@ export class ExpandBoltTransform implements Transformer { return isBoltSourceFile(node) } - public transform(node: BoltSyntax) { - return this.expand(node); + public transform(node: SourceFile) { + return this.expand(node as BoltSourceFile) as BoltSourceFile; } private expand(node: BoltSyntax) { diff --git a/src/types.ts b/src/types.ts index 57259b0d4..c274e54ad 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,5 +1,7 @@ -import { FastStringMap } from "./util"; +import { FastStringMap, assert } from "./util"; +import { SyntaxKind, Syntax, isBoltTypeExpression, BoltExpression, BoltFunctionDeclaration, BoltFunctionBodyElement, kindToString } from "./ast"; +import { getSymbolPathFromNode, ScopeType, SymbolResolver } from "./resolver"; enum TypeKind { OpaqueType, @@ -8,6 +10,7 @@ enum TypeKind { FunctionType, RecordType, VariantType, + UnionType, TupleType, } @@ -28,34 +31,14 @@ export class OpaqueType extends TypeBase { kind: TypeKind.OpaqueType = TypeKind.OpaqueType; } -export function isOpaqueType(value: any): value is OpaqueType { - return value.kind === TypeKind.OpaqueType; -} - -export function createOpaqueType(): OpaqueType { - return new OpaqueType(); -} - export class AnyType extends TypeBase { kind: TypeKind.AnyType = TypeKind.AnyType; } -export function createAnyType(): AnyType { - return new AnyType(); -} - -export function isAnyType(value: any): value is AnyType { - return value.kind === TypeKind.AnyType; -} - export class NeverType extends TypeBase { kind: TypeKind.NeverType = TypeKind.NeverType; } -export function isNeverType(value: any): value is NeverType { - return value instanceof NeverType; -} - export class FunctionType extends TypeBase { kind: TypeKind.FunctionType = TypeKind.FunctionType; @@ -80,10 +63,6 @@ export class FunctionType extends TypeBase { } -export function isFunctionType(value: any): value is FunctionType { - return value instanceof FunctionType; -} - export class VariantType extends TypeBase { kind: TypeKind.VariantType = TypeKind.VariantType; @@ -98,10 +77,6 @@ export class VariantType extends TypeBase { } -export function createVariantType(...elementTypes: Type[]): VariantType { - return new VariantType(elementTypes); -} - export function isVariantType(value: any): value is VariantType { return value instanceof VariantType; } @@ -144,18 +119,10 @@ export class TupleType extends TypeBase { } -export function createTupleType(...elementTypes: Type[]) { - return new TupleType(elementTypes); -} - export function isTupleType(value: any): value is TupleType { return value.kind === TypeKind.TupleType; } -export function createVoidType() { - return createTupleType(); -} - export function isVoidType(value: any) { return isTupleType(value) && value.elementTypes.length === 0; } @@ -190,32 +157,94 @@ export function intersectTypes(a: Type, b: Type): Type { return new NeverType(); } +export type TypeInfo = never; -export function isTypeAssignable(a: Type, b: Type): boolean { - if (isNeverType(a)) { - return false; - } - if (isAnyType(b)) { - return true; - } - if (isOpaqueType(a) && isOpaqueType(b)) { - return a === b; - } - if (a.kind !== b.kind) { - return false; - } - if (isFunctionType(a) && isFunctionType(b)) { - if (a.paramTypes.length !== b.paramTypes.length) { - return false; - } - const paramCount = a.getParameterCount(); - for (let i = 0; i < paramCount; i++) { - if (!isTypeAssignable(a.getParamTypeAtIndex(i), b.getParamTypeAtIndex(i))) { - return false; - } - } - return true; - } - throw new Error(`Should not get here.`); +interface AssignmentError { + node: Syntax; } +export class TypeChecker { + + constructor(private resolver: SymbolResolver) { + + } + + public isVoid(node: Syntax): boolean { + switch (node.kind) { + case SyntaxKind.BoltTupleExpression: + return node.elements.length === 0; + default: + throw new Error(`Could not determine whether the given type resolves to the void type.`) + } + } + + public *getAssignmentErrors(left: Syntax, right: Syntax): IterableIterator { + + // TODO For function bodies, we can do something special. + // Sort the return types and find the largest types, eliminating types that fall under other types. + // Next, add the resulting types as type hints to `fnReturnType`. + + } + + + public getCallableFunctions(node: BoltExpression): BoltFunctionDeclaration[] { + + const resolver = this.resolver; + + const results: BoltFunctionDeclaration[] = []; + visitExpression(node); + return results; + + function visitExpression(node: BoltExpression) { + switch (node.kind) { + case SyntaxKind.BoltMemberExpression: + { + visitExpression(node.expression); + break; + } + case SyntaxKind.BoltQuoteExpression: + { + // TODO visit all unquote expressions + //visitExpression(node.tokens); + break; + } + case SyntaxKind.BoltCallExpression: + { + // TODO + break; + } + case SyntaxKind.BoltReferenceExpression: + { + const scope = resolver.getScopeForNode(node, ScopeType.Variable); + assert(scope !== null); + const resolvedSym = resolver.resolveSymbolPath(getSymbolPathFromNode(node), scope!); + if (resolvedSym !== null) { + for (const decl of resolvedSym.declarations) { + visitFunctionBodyElement(decl as BoltFunctionBodyElement); + } + } + break; + } + default: + throw new Error(`Unexpected node type ${kindToString(node.kind)}`); + } + } + + function visitFunctionBodyElement(node: BoltFunctionBodyElement) { + switch (node.kind) { + case SyntaxKind.BoltFunctionDeclaration: + results.push(node); + break; + case SyntaxKind.BoltVariableDeclaration: + if (node.value !== null) { + visitExpression(node.value); + } + break; + default: + throw new Error(`Unexpected node type ${kindToString(node.kind)}`); + } + } + + } + +} diff --git a/src/util.ts b/src/util.ts index b34d4684c..33291f392 100644 --- a/src/util.ts +++ b/src/util.ts @@ -4,6 +4,24 @@ import * as fs from "fs" import moment from "moment" import chalk from "chalk" +export function isPowerOf(x: number, n: number):boolean { + const a = Math.log(x) / Math.log(n); + return Math.pow(a, n) == x; +} + +export function every(iterator: Iterator, pred: (value: T) => boolean): boolean { + while (true) { + const { value, done } = iterator.next(); + if (done) { + break; + } + if (!pred(value)) { + return false; + } + } + return true; +} + export function assert(test: boolean): void { if (!test) { throw new Error(`Invariant violation: an internal sanity check failed.`); @@ -248,7 +266,7 @@ export interface MapLike { [key: string]: T; } -export type FormatArg = string | Date | number +export type FormatArg = any; export function format(message: string, data: MapLike) {