Multiple fixes and a rewrite of the type checker

- Improve the quality of the type checker
 - Fix multiple bugs in the parser
 - Fix some inconsistencies in the AST spec
 - Update package dependencies
This commit is contained in:
Sam Vervaeck 2020-10-29 21:12:11 +01:00
parent 4420c0325a
commit 3ac8d1802b
16 changed files with 1911 additions and 3994 deletions

4101
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -20,44 +20,44 @@
"dependencies": { "dependencies": {
"@types/commonmark": "^0.27.4", "@types/commonmark": "^0.27.4",
"@types/diff": "^4.0.2", "@types/diff": "^4.0.2",
"@types/fs-extra": "^9.0.1", "@types/fs-extra": "^9.0.2",
"@types/glob": "^7.1.2", "@types/glob": "^7.1.3",
"@types/js-yaml": "^3.12.4", "@types/js-yaml": "^3.12.5",
"@types/microtime": "^2.1.0", "@types/microtime": "^2.1.0",
"@types/minimist": "^1.2.0", "@types/minimist": "^1.2.0",
"@types/node": "^14.0.13", "@types/node": "^14.14.6",
"@types/ora": "^3.2.0", "@types/ora": "^3.2.0",
"@types/semver": "^7.2.0", "@types/semver": "^7.3.4",
"@types/uuid": "^8.0.0", "@types/uuid": "^8.3.0",
"@types/yargs": "^15.0.5", "@types/yargs": "^15.0.9",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"commonmark": "^0.29.1", "commonmark": "^0.29.2",
"diff": "^4.0.2", "diff": "^4.0.2",
"fs-extra": "^9.0.1", "fs-extra": "^9.0.1",
"glob": "^7.1.6", "glob": "^7.1.6",
"js-yaml": "^3.14.0", "js-yaml": "^3.14.0",
"microtime": "^3.0.0", "microtime": "^3.0.0",
"minimist": "^1.2.5", "minimist": "^1.2.5",
"moment": "^2.26.0", "moment": "^2.29.1",
"ora": "^4.0.4", "ora": "^5.1.0",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"semver": "^7.3.2", "semver": "^7.3.2",
"source-map-support": "^0.5.19", "source-map-support": "^0.5.19",
"uuid": "^8.1.0", "uuid": "^8.3.1",
"yargs": "^15.3.1" "yargs": "^16.1.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.10.2", "@babel/core": "^7.12.3",
"@babel/plugin-proposal-class-properties": "^7.10.1", "@babel/plugin-proposal-class-properties": "^7.12.1",
"@types/chai": "^4.2.11", "@types/chai": "^4.2.14",
"@types/tape": "^4.13.0", "@types/tape": "^4.13.0",
"babel-loader": "^8.1.0", "babel-loader": "^8.1.0",
"concurrently": "^5.2.0", "concurrently": "^5.3.0",
"tap-min": "^2.0.0", "tap-min": "^2.0.0",
"tape": "^5.0.1", "tape": "^5.0.1",
"ts-loader": "^7.0.5", "ts-loader": "^8.0.7",
"typescript": "^3.9.5", "typescript": "^4.0.5",
"webpack": "^4.43.0", "webpack": "^5.3.1",
"webpack-cli": "^3.3.11" "webpack-cli": "^4.1.0"
} }
} }

View file

@ -1,11 +1,11 @@
import { Type } from "./types"
import { TextSpan } from "./text" import { TextSpan } from "./text"
import { Value } from "./evaluator" import { Value } from "./evaluator"
import { Package } from "./package" import { Package } from "./package"
import { Diagnostic } from "./diagnostics"; import { Diagnostic } from "./diagnostics";
import { MapLike, serializeTag, inspectTag, indent } from "./util"; import { serializeTag, inspectTag, indent } from "./util";
import { InspectOptions, InspectOptionsStylized, inspect } from "util"; import { InspectOptionsStylized, inspect } from "util";
import { TypeRef } from "./checker";
let nextNodeId = 1; let nextNodeId = 1;
@ -17,10 +17,10 @@ export abstract class Syntax {
public id: number; public id: number;
public type?: Type;
public errors: Diagnostic[] = []; public errors: Diagnostic[] = [];
public type?: TypeRef;
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
// NOTE The following properties and methods are only valid when inside a BoltTraitDeclaration // NOTE The following properties and methods are only valid when inside a BoltTraitDeclaration
// TODO Move this to BoltTraitDeclaration as soon as tsastgen supports this // TODO Move this to BoltTraitDeclaration as soon as tsastgen supports this
@ -289,6 +289,18 @@ export interface BoltRecordPattern extends BoltPattern {
export interface BoltExpression extends BoltSyntax {} export interface BoltExpression extends BoltSyntax {}
export interface BoltRecordExpression extends BoltExpression {
typeRef: BoltReferenceTypeExpression;
fields: BoltRecordExpressionElement[];
}
export interface BoltRecordExpressionElement extends BoltSyntax {}
export interface BoltRecordFieldValue extends BoltRecordExpressionElement {
name: BoltIdentifier;
value: BoltExpression | null;
}
export interface BoltQuoteExpression extends BoltExpression { export interface BoltQuoteExpression extends BoltExpression {
tokens: (Token | BoltExpression)[], tokens: (Token | BoltExpression)[],
} }
@ -371,6 +383,11 @@ export interface BoltExpressionStatement extends BoltStatement {
expression: BoltExpression, expression: BoltExpression,
} }
export interface BoltAssignStatement extends BoltStatement {
lhs: BoltPattern;
rhs: BoltExpression;
}
export interface BoltLoopStatement extends BoltStatement { export interface BoltLoopStatement extends BoltStatement {
elements: BoltFunctionBodyElement[], elements: BoltFunctionBodyElement[],
} }
@ -408,7 +425,7 @@ export interface BoltFunctionDeclaration extends BoltFunctionBodyElement, BoltDe
params: BoltParameter[], params: BoltParameter[],
returnType: BoltTypeExpression | null, returnType: BoltTypeExpression | null,
typeParams: BoltTypeParameter[] | null, typeParams: BoltTypeParameter[] | null,
body: BoltFunctionBodyElement[], body: BoltFunctionBodyElement[] | null,
} }
export interface BoltVariableDeclaration extends BoltFunctionBodyElement, BoltDeclaration, BoltDeclarationLike { export interface BoltVariableDeclaration extends BoltFunctionBodyElement, BoltDeclaration, BoltDeclarationLike {
@ -468,9 +485,9 @@ export interface BoltTypeAliasDeclaration extends BoltDeclarationLike, BoltTypeD
typeExpr: BoltTypeExpression, typeExpr: BoltTypeExpression,
} }
export interface BoltRecordMember extends BoltSyntax {} export interface BoltRecordDeclartionElement extends BoltSyntax {}
export interface BoltRecordField extends BoltRecordMember { export interface BoltRecordDeclarationField extends BoltRecordDeclartionElement {
name: BoltIdentifier, name: BoltIdentifier,
typeExpr: BoltTypeExpression, typeExpr: BoltTypeExpression,
} }
@ -479,12 +496,12 @@ export interface BoltRecordDeclaration extends BoltDeclaration, BoltTypeDeclarat
modifiers: BoltModifiers, modifiers: BoltModifiers,
name: BoltIdentifier, name: BoltIdentifier,
typeParms: BoltTypeParameter[] | null, typeParms: BoltTypeParameter[] | null,
members: BoltRecordMember[] | null, members: BoltRecordDeclartionElement[] | null,
} }
export interface BoltSourceElement {} export interface BoltSourceElement {}
export interface BoltMacroCall extends BoltRecordMember, BoltSourceElement, BoltTraitOrImplElement, BoltFunctionBodyElement { export interface BoltMacroCall extends BoltRecordDeclartionElement, BoltSourceElement, BoltTraitOrImplElement, BoltFunctionBodyElement {
name: BoltIdentifier, name: BoltIdentifier,
text: string, text: string,
} }

View file

@ -1,5 +1,3 @@
import { Type } from "./types";
import { TextSpan } from "./text"; import { TextSpan } from "./text";
import { Value } from "./evaluator"; import { Value } from "./evaluator";
@ -8,9 +6,11 @@ import { Package } from "./package";
import { Diagnostic } from "./diagnostics"; import { Diagnostic } from "./diagnostics";
import { MapLike, serializeTag, inspectTag, indent } from "./util"; import { serializeTag, inspectTag, indent } from "./util";
import { InspectOptions, InspectOptionsStylized, inspect } from "util"; import { InspectOptionsStylized, inspect } from "util";
import { TypeRef } from "./checker";
let nextNodeId = 1; let nextNodeId = 1;
@ -20,8 +20,8 @@ export type ResolveSyntaxKind<K extends SyntaxKind> = Extract<Syntax, {
export abstract class SyntaxBase { export abstract class SyntaxBase {
public id: number; public id: number;
public type?: Type;
public errors: Diagnostic[] = []; public errors: Diagnostic[] = [];
public type?: TypeRef;
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
// NOTE The following properties and methods are only valid when inside a BoltTraitDeclaration // NOTE The following properties and methods are only valid when inside a BoltTraitDeclaration
// TODO Move this to BoltTraitDeclaration as soon as tsastgen supports this // TODO Move this to BoltTraitDeclaration as soon as tsastgen supports this
@ -142,11 +142,11 @@ export type Token = JSNotOp | JSBNotOp | JSBAndOp | JSBXorOp | JSBOrOp | JSGtOp
export type SourceFile = JSSourceFile | BoltSourceFile; export type SourceFile = JSSourceFile | BoltSourceFile;
export type FunctionBodyElement = JSLetDeclaration | JSArrowFunctionDeclaration | JSFunctionDeclaration | JSImportDeclaration | JSReturnStatement | JSConditionalStatement | JSExpressionStatement | JSTryCatchStatement | BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement; export type FunctionBodyElement = JSLetDeclaration | JSArrowFunctionDeclaration | JSFunctionDeclaration | JSImportDeclaration | JSReturnStatement | JSConditionalStatement | JSExpressionStatement | JSTryCatchStatement | BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement;
export type ReturnStatement = JSReturnStatement | BoltReturnStatement; export type ReturnStatement = JSReturnStatement | BoltReturnStatement;
export type BoltSyntax = BoltMacroCall | BoltRecordField | BoltPlainExportSymbol | BoltImportDirective | BoltPlainImportSymbol | BoltModule | BoltRecordDeclaration | BoltTypeAliasDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration | BoltParameter | BoltConditionalCase | BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | BoltCase | BoltMatchArm | BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordFieldPattern | BoltTuplePatternElement | BoltRecordPattern | BoltTuplePattern | BoltExpressionPattern | BoltTypePattern | BoltBindPattern | BoltTypeParameter | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltQualName | BoltSourceFile | BoltBracketed | BoltBraced | BoltParenthesized | BoltImplKeyword | BoltTraitKeyword | BoltTypeKeyword | BoltStructKeyword | BoltEnumKeyword | BoltMutKeyword | BoltModKeyword | BoltPubKeyword | BoltExportKeyword | BoltImportKeyword | BoltMatchKeyword | BoltYieldKeyword | BoltLoopKeyword | BoltReturnKeyword | BoltLetKeyword | BoltForKeyword | BoltForeignKeyword | BoltFnKeyword | BoltQuoteKeyword | BoltWhereKeyword | BoltVBar | BoltLtSign | BoltExMark | BoltGtSign | BoltEqSign | BoltLArrow | BoltRArrowAlt | BoltRArrow | BoltDotDot | BoltDot | BoltColonColon | BoltColon | BoltSemi | BoltComma | BoltAssignment | BoltOperator | BoltIdentifier | BoltIntegerLiteral | BoltStringLiteral | EndOfFile; export type BoltSyntax = BoltMacroCall | BoltRecordDeclarationField | BoltPlainExportSymbol | BoltImportDirective | BoltPlainImportSymbol | BoltModule | BoltRecordDeclaration | BoltTypeAliasDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration | BoltParameter | BoltConditionalCase | BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | BoltCase | BoltMatchArm | BoltRecordFieldValue | BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | BoltRecordFieldPattern | BoltTuplePatternElement | BoltRecordPattern | BoltTuplePattern | BoltExpressionPattern | BoltTypePattern | BoltBindPattern | BoltTypeParameter | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltQualName | BoltSourceFile | BoltBracketed | BoltBraced | BoltParenthesized | BoltImplKeyword | BoltTraitKeyword | BoltTypeKeyword | BoltStructKeyword | BoltEnumKeyword | BoltMutKeyword | BoltModKeyword | BoltPubKeyword | BoltExportKeyword | BoltImportKeyword | BoltMatchKeyword | BoltYieldKeyword | BoltLoopKeyword | BoltReturnKeyword | BoltLetKeyword | BoltForKeyword | BoltForeignKeyword | BoltFnKeyword | BoltQuoteKeyword | BoltWhereKeyword | BoltVBar | BoltLtSign | BoltExMark | BoltGtSign | BoltEqSign | BoltLArrow | BoltRArrowAlt | BoltRArrow | BoltDotDot | BoltDot | BoltColonColon | BoltColon | BoltSemi | BoltComma | BoltAssignment | BoltOperator | BoltIdentifier | BoltIntegerLiteral | BoltStringLiteral | EndOfFile;
export type BoltToken = BoltBracketed | BoltBraced | BoltParenthesized | BoltImplKeyword | BoltTraitKeyword | BoltTypeKeyword | BoltStructKeyword | BoltEnumKeyword | BoltMutKeyword | BoltModKeyword | BoltPubKeyword | BoltExportKeyword | BoltImportKeyword | BoltMatchKeyword | BoltYieldKeyword | BoltLoopKeyword | BoltReturnKeyword | BoltLetKeyword | BoltForKeyword | BoltForeignKeyword | BoltFnKeyword | BoltQuoteKeyword | BoltWhereKeyword | BoltVBar | BoltLtSign | BoltExMark | BoltGtSign | BoltEqSign | BoltLArrow | BoltRArrowAlt | BoltRArrow | BoltDotDot | BoltDot | BoltColonColon | BoltColon | BoltSemi | BoltComma | BoltAssignment | BoltOperator | BoltIdentifier | BoltIntegerLiteral | BoltStringLiteral | EndOfFile; export type BoltToken = BoltBracketed | BoltBraced | BoltParenthesized | BoltImplKeyword | BoltTraitKeyword | BoltTypeKeyword | BoltStructKeyword | BoltEnumKeyword | BoltMutKeyword | BoltModKeyword | BoltPubKeyword | BoltExportKeyword | BoltImportKeyword | BoltMatchKeyword | BoltYieldKeyword | BoltLoopKeyword | BoltReturnKeyword | BoltLetKeyword | BoltForKeyword | BoltForeignKeyword | BoltFnKeyword | BoltQuoteKeyword | BoltWhereKeyword | BoltVBar | BoltLtSign | BoltExMark | BoltGtSign | BoltEqSign | BoltLArrow | BoltRArrowAlt | BoltRArrow | BoltDotDot | BoltDot | BoltColonColon | BoltColon | BoltSemi | BoltComma | BoltAssignment | BoltOperator | BoltIdentifier | BoltIntegerLiteral | BoltStringLiteral | EndOfFile;
@ -181,7 +181,7 @@ export class BoltIdentifier extends SyntaxBase {
*getChildNodes(): IterableIterator<BoltIdentifierChild> { } *getChildNodes(): IterableIterator<BoltIdentifierChild> { }
} }
type BoltIdentifierParent = BoltQualName | BoltTypeParameter | BoltBindPattern | BoltRecordFieldPattern | BoltMemberExpression | BoltPlainImportSymbol | BoltPlainExportSymbol | BoltTraitDeclaration | BoltRecordField | BoltFunctionDeclaration | BoltTypeAliasDeclaration | BoltRecordDeclaration | BoltModule | BoltMacroCall | never; type BoltIdentifierParent = BoltQualName | BoltTypeParameter | BoltBindPattern | BoltRecordFieldPattern | BoltRecordFieldValue | BoltMemberExpression | BoltPlainImportSymbol | BoltPlainExportSymbol | BoltTraitDeclaration | BoltRecordDeclarationField | BoltFunctionDeclaration | BoltTypeAliasDeclaration | BoltRecordDeclaration | BoltModule | BoltMacroCall | never;
type BoltIdentifierChild = never; type BoltIdentifierChild = never;
@ -630,7 +630,7 @@ export class BoltSourceFile extends SyntaxBase {
type BoltSourceFileParent = never; type BoltSourceFileParent = never;
type BoltSourceFileChild = BoltMacroCall | BoltExportDirective | BoltImportDirective | BoltModule | BoltRecordDeclaration | BoltTypeAliasDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | never; type BoltSourceFileChild = BoltMacroCall | BoltExportDirective | BoltImportDirective | BoltModule | BoltRecordDeclaration | BoltTypeAliasDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | never;
export class BoltQualName extends SyntaxBase { export class BoltQualName extends SyntaxBase {
parentNode: null | BoltQualNameParent = null; parentNode: null | BoltQualNameParent = null;
@ -653,9 +653,9 @@ export class BoltTypeOfExpression extends SyntaxBase {
*getChildNodes(): IterableIterator<BoltTypeOfExpressionChild> { yield this.expression; } *getChildNodes(): IterableIterator<BoltTypeOfExpressionChild> { yield this.expression; }
} }
type BoltTypeOfExpressionParent = BoltReferenceTypeExpression | BoltFunctionTypeExpression | BoltTypeParameter | BoltTypePattern | BoltRecordPattern | BoltFunctionExpression | BoltParameter | BoltTraitDeclaration | BoltRecordField | BoltFunctionDeclaration | BoltVariableDeclaration | BoltTypeAliasDeclaration | never; type BoltTypeOfExpressionParent = BoltReferenceTypeExpression | BoltFunctionTypeExpression | BoltTypeParameter | BoltTypePattern | BoltRecordPattern | BoltFunctionExpression | BoltParameter | BoltTraitDeclaration | BoltRecordDeclarationField | BoltFunctionDeclaration | BoltVariableDeclaration | BoltTypeAliasDeclaration | never;
type BoltTypeOfExpressionChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltTypeOfExpressionChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltReferenceTypeExpression extends SyntaxBase { export class BoltReferenceTypeExpression extends SyntaxBase {
parentNode: null | BoltReferenceTypeExpressionParent = null; parentNode: null | BoltReferenceTypeExpressionParent = null;
@ -666,7 +666,7 @@ export class BoltReferenceTypeExpression extends SyntaxBase {
yield element; } yield element; }
} }
type BoltReferenceTypeExpressionParent = BoltReferenceTypeExpression | BoltFunctionTypeExpression | BoltTypeParameter | BoltTypePattern | BoltRecordPattern | BoltFunctionExpression | BoltParameter | BoltTraitDeclaration | BoltImplDeclaration | BoltRecordField | BoltFunctionDeclaration | BoltVariableDeclaration | BoltTypeAliasDeclaration | never; type BoltReferenceTypeExpressionParent = BoltReferenceTypeExpression | BoltFunctionTypeExpression | BoltTypeParameter | BoltTypePattern | BoltRecordPattern | BoltRecordExpression | BoltFunctionExpression | BoltParameter | BoltTraitDeclaration | BoltImplDeclaration | BoltRecordDeclarationField | BoltFunctionDeclaration | BoltVariableDeclaration | BoltTypeAliasDeclaration | never;
type BoltReferenceTypeExpressionChild = BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltQualName | never; type BoltReferenceTypeExpressionChild = BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltQualName | never;
@ -679,7 +679,7 @@ export class BoltFunctionTypeExpression extends SyntaxBase {
yield this.returnType; } yield this.returnType; }
} }
type BoltFunctionTypeExpressionParent = BoltReferenceTypeExpression | BoltFunctionTypeExpression | BoltTypeParameter | BoltTypePattern | BoltRecordPattern | BoltFunctionExpression | BoltParameter | BoltTraitDeclaration | BoltRecordField | BoltFunctionDeclaration | BoltVariableDeclaration | BoltTypeAliasDeclaration | never; type BoltFunctionTypeExpressionParent = BoltReferenceTypeExpression | BoltFunctionTypeExpression | BoltTypeParameter | BoltTypePattern | BoltRecordPattern | BoltFunctionExpression | BoltParameter | BoltTraitDeclaration | BoltRecordDeclarationField | BoltFunctionDeclaration | BoltVariableDeclaration | BoltTypeAliasDeclaration | never;
type BoltFunctionTypeExpressionChild = BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltParameter | never; type BoltFunctionTypeExpressionChild = BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltParameter | never;
@ -690,9 +690,9 @@ export class BoltLiftedTypeExpression extends SyntaxBase {
*getChildNodes(): IterableIterator<BoltLiftedTypeExpressionChild> { yield this.expression; } *getChildNodes(): IterableIterator<BoltLiftedTypeExpressionChild> { yield this.expression; }
} }
type BoltLiftedTypeExpressionParent = BoltReferenceTypeExpression | BoltFunctionTypeExpression | BoltTypeParameter | BoltTypePattern | BoltRecordPattern | BoltFunctionExpression | BoltParameter | BoltTraitDeclaration | BoltRecordField | BoltFunctionDeclaration | BoltVariableDeclaration | BoltTypeAliasDeclaration | never; type BoltLiftedTypeExpressionParent = BoltReferenceTypeExpression | BoltFunctionTypeExpression | BoltTypeParameter | BoltTypePattern | BoltRecordPattern | BoltFunctionExpression | BoltParameter | BoltTraitDeclaration | BoltRecordDeclarationField | BoltFunctionDeclaration | BoltVariableDeclaration | BoltTypeAliasDeclaration | never;
type BoltLiftedTypeExpressionChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltLiftedTypeExpressionChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltTypeParameter extends SyntaxBase { export class BoltTypeParameter extends SyntaxBase {
parentNode: null | BoltTypeParameterParent = null; parentNode: null | BoltTypeParameterParent = null;
@ -716,7 +716,7 @@ export class BoltBindPattern extends SyntaxBase {
*getChildNodes(): IterableIterator<BoltBindPatternChild> { yield this.name; } *getChildNodes(): IterableIterator<BoltBindPatternChild> { yield this.name; }
} }
type BoltBindPatternParent = BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern | BoltMatchArm | BoltParameter | BoltVariableDeclaration | never; type BoltBindPatternParent = BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern | BoltMatchArm | BoltParameter | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltBindPatternChild = BoltIdentifier | never; type BoltBindPatternChild = BoltIdentifier | never;
@ -727,7 +727,7 @@ export class BoltTypePattern extends SyntaxBase {
*getChildNodes(): IterableIterator<BoltTypePatternChild> { yield this.typeExpr; yield this.nestedPattern; } *getChildNodes(): IterableIterator<BoltTypePatternChild> { yield this.typeExpr; yield this.nestedPattern; }
} }
type BoltTypePatternParent = BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern | BoltMatchArm | BoltParameter | BoltVariableDeclaration | never; type BoltTypePatternParent = BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern | BoltMatchArm | BoltParameter | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltTypePatternChild = BoltRecordPattern | BoltTuplePattern | BoltExpressionPattern | BoltTypePattern | BoltBindPattern | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | never; type BoltTypePatternChild = BoltRecordPattern | BoltTuplePattern | BoltExpressionPattern | BoltTypePattern | BoltBindPattern | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | never;
@ -738,9 +738,9 @@ export class BoltExpressionPattern extends SyntaxBase {
*getChildNodes(): IterableIterator<BoltExpressionPatternChild> { yield this.expression; } *getChildNodes(): IterableIterator<BoltExpressionPatternChild> { yield this.expression; }
} }
type BoltExpressionPatternParent = BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern | BoltMatchArm | BoltParameter | BoltVariableDeclaration | never; type BoltExpressionPatternParent = BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern | BoltMatchArm | BoltParameter | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltExpressionPatternChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltExpressionPatternChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltTuplePatternElement extends SyntaxBase { export class BoltTuplePatternElement extends SyntaxBase {
parentNode: null | BoltTuplePatternElementParent = null; parentNode: null | BoltTuplePatternElementParent = null;
@ -761,7 +761,7 @@ export class BoltTuplePattern extends SyntaxBase {
yield element; } yield element; }
} }
type BoltTuplePatternParent = BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern | BoltMatchArm | BoltParameter | BoltVariableDeclaration | never; type BoltTuplePatternParent = BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern | BoltMatchArm | BoltParameter | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltTuplePatternChild = BoltTuplePatternElement | never; type BoltTuplePatternChild = BoltTuplePatternElement | never;
@ -786,11 +786,37 @@ export class BoltRecordPattern extends SyntaxBase {
yield element; } yield element; }
} }
type BoltRecordPatternParent = BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern | BoltMatchArm | BoltParameter | BoltVariableDeclaration | never; type BoltRecordPatternParent = BoltTypePattern | BoltTuplePatternElement | BoltRecordFieldPattern | BoltMatchArm | BoltParameter | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltRecordPatternChild = BoltRecordFieldPattern | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | never; type BoltRecordPatternChild = BoltRecordFieldPattern | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | never;
export type BoltExpression = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression; export type BoltExpression = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression;
export class BoltRecordExpression extends SyntaxBase {
parentNode: null | BoltRecordExpressionParent = null;
kind: SyntaxKind.BoltRecordExpression = SyntaxKind.BoltRecordExpression;
constructor(public typeRef: BoltReferenceTypeExpression, public fields: BoltRecordExpressionElement[], span: TextSpan | null = null) { super(span); }
*getChildNodes(): IterableIterator<BoltRecordExpressionChild> { yield this.typeRef; for (let element of this.fields)
yield element; }
}
type BoltRecordExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltRecordExpressionChild = BoltRecordFieldValue | BoltReferenceTypeExpression | never;
export type BoltRecordExpressionElement = BoltRecordFieldValue;
export class BoltRecordFieldValue extends SyntaxBase {
parentNode: null | BoltRecordFieldValueParent = null;
kind: SyntaxKind.BoltRecordFieldValue = SyntaxKind.BoltRecordFieldValue;
constructor(public name: BoltIdentifier, public value: BoltExpression | null, span: TextSpan | null = null) { super(span); }
*getChildNodes(): IterableIterator<BoltRecordFieldValueChild> { yield this.name; if (this.value !== null)
yield this.value; }
}
type BoltRecordFieldValueParent = BoltRecordExpression | never;
type BoltRecordFieldValueChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | BoltIdentifier | never;
export class BoltQuoteExpression extends SyntaxBase { export class BoltQuoteExpression extends SyntaxBase {
parentNode: null | BoltQuoteExpressionParent = null; parentNode: null | BoltQuoteExpressionParent = null;
@ -799,7 +825,7 @@ export class BoltQuoteExpression extends SyntaxBase {
*getChildNodes(): IterableIterator<BoltQuoteExpressionChild> { } *getChildNodes(): IterableIterator<BoltQuoteExpressionChild> { }
} }
type BoltQuoteExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltVariableDeclaration | never; type BoltQuoteExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltQuoteExpressionChild = never; type BoltQuoteExpressionChild = never;
@ -811,9 +837,9 @@ export class BoltTupleExpression extends SyntaxBase {
yield element; } yield element; }
} }
type BoltTupleExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltVariableDeclaration | never; type BoltTupleExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltTupleExpressionChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltTupleExpressionChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltReferenceExpression extends SyntaxBase { export class BoltReferenceExpression extends SyntaxBase {
parentNode: null | BoltReferenceExpressionParent = null; parentNode: null | BoltReferenceExpressionParent = null;
@ -822,7 +848,7 @@ export class BoltReferenceExpression extends SyntaxBase {
*getChildNodes(): IterableIterator<BoltReferenceExpressionChild> { yield this.name; } *getChildNodes(): IterableIterator<BoltReferenceExpressionChild> { yield this.name; }
} }
type BoltReferenceExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltVariableDeclaration | never; type BoltReferenceExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltReferenceExpressionChild = BoltQualName | never; type BoltReferenceExpressionChild = BoltQualName | never;
@ -834,9 +860,9 @@ export class BoltMemberExpression extends SyntaxBase {
yield element; } yield element; }
} }
type BoltMemberExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltVariableDeclaration | never; type BoltMemberExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltMemberExpressionChild = BoltIdentifier | BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltMemberExpressionChild = BoltIdentifier | BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltFunctionExpression extends SyntaxBase { export class BoltFunctionExpression extends SyntaxBase {
parentNode: null | BoltFunctionExpressionParent = null; parentNode: null | BoltFunctionExpressionParent = null;
@ -848,9 +874,9 @@ export class BoltFunctionExpression extends SyntaxBase {
yield element; } yield element; }
} }
type BoltFunctionExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltVariableDeclaration | never; type BoltFunctionExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltFunctionExpressionChild = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltParameter | never; type BoltFunctionExpressionChild = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltParameter | never;
export class BoltCallExpression extends SyntaxBase { export class BoltCallExpression extends SyntaxBase {
parentNode: null | BoltCallExpressionParent = null; parentNode: null | BoltCallExpressionParent = null;
@ -860,9 +886,9 @@ export class BoltCallExpression extends SyntaxBase {
yield element; } yield element; }
} }
type BoltCallExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltVariableDeclaration | never; type BoltCallExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltCallExpressionChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltCallExpressionChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltYieldExpression extends SyntaxBase { export class BoltYieldExpression extends SyntaxBase {
parentNode: null | BoltYieldExpressionParent = null; parentNode: null | BoltYieldExpressionParent = null;
@ -871,9 +897,9 @@ export class BoltYieldExpression extends SyntaxBase {
*getChildNodes(): IterableIterator<BoltYieldExpressionChild> { yield this.value; } *getChildNodes(): IterableIterator<BoltYieldExpressionChild> { yield this.value; }
} }
type BoltYieldExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltVariableDeclaration | never; type BoltYieldExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltYieldExpressionChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltYieldExpressionChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltMatchArm extends SyntaxBase { export class BoltMatchArm extends SyntaxBase {
parentNode: null | BoltMatchArmParent = null; parentNode: null | BoltMatchArmParent = null;
@ -884,7 +910,7 @@ export class BoltMatchArm extends SyntaxBase {
type BoltMatchArmParent = BoltMatchExpression | never; type BoltMatchArmParent = BoltMatchExpression | never;
type BoltMatchArmChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordPattern | BoltTuplePattern | BoltExpressionPattern | BoltTypePattern | BoltBindPattern | never; type BoltMatchArmChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | BoltRecordPattern | BoltTuplePattern | BoltExpressionPattern | BoltTypePattern | BoltBindPattern | never;
export class BoltMatchExpression extends SyntaxBase { export class BoltMatchExpression extends SyntaxBase {
parentNode: null | BoltMatchExpressionParent = null; parentNode: null | BoltMatchExpressionParent = null;
@ -894,9 +920,9 @@ export class BoltMatchExpression extends SyntaxBase {
yield element; } yield element; }
} }
type BoltMatchExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltVariableDeclaration | never; type BoltMatchExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltMatchExpressionChild = BoltMatchArm | BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltMatchExpressionChild = BoltMatchArm | BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltCase extends SyntaxBase { export class BoltCase extends SyntaxBase {
parentNode: null | BoltCaseParent = null; parentNode: null | BoltCaseParent = null;
@ -907,7 +933,7 @@ export class BoltCase extends SyntaxBase {
type BoltCaseParent = BoltCaseExpression | never; type BoltCaseParent = BoltCaseExpression | never;
type BoltCaseChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltCaseChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltCaseExpression extends SyntaxBase { export class BoltCaseExpression extends SyntaxBase {
parentNode: null | BoltCaseExpressionParent = null; parentNode: null | BoltCaseExpressionParent = null;
@ -917,7 +943,7 @@ export class BoltCaseExpression extends SyntaxBase {
yield element; } yield element; }
} }
type BoltCaseExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltVariableDeclaration | never; type BoltCaseExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltCaseExpressionChild = BoltCase | never; type BoltCaseExpressionChild = BoltCase | never;
@ -929,9 +955,9 @@ export class BoltBlockExpression extends SyntaxBase {
yield element; } yield element; }
} }
type BoltBlockExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltVariableDeclaration | never; type BoltBlockExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltBlockExpressionChild = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | never; type BoltBlockExpressionChild = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | never;
export class BoltConstantExpression extends SyntaxBase { export class BoltConstantExpression extends SyntaxBase {
parentNode: null | BoltConstantExpressionParent = null; parentNode: null | BoltConstantExpressionParent = null;
@ -940,11 +966,11 @@ export class BoltConstantExpression extends SyntaxBase {
*getChildNodes(): IterableIterator<BoltConstantExpressionChild> { } *getChildNodes(): IterableIterator<BoltConstantExpressionChild> { }
} }
type BoltConstantExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltVariableDeclaration | never; type BoltConstantExpressionParent = BoltTypeOfExpression | BoltLiftedTypeExpression | BoltExpressionPattern | BoltRecordFieldValue | BoltTupleExpression | BoltMemberExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltConditionalCase | BoltParameter | BoltReturnStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltVariableDeclaration | never;
type BoltConstantExpressionChild = never; type BoltConstantExpressionChild = never;
export type BoltStatement = BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement; export type BoltStatement = BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement;
export class BoltReturnStatement extends SyntaxBase { export class BoltReturnStatement extends SyntaxBase {
parentNode: null | BoltReturnStatementParent = null; parentNode: null | BoltReturnStatementParent = null;
@ -956,7 +982,7 @@ export class BoltReturnStatement extends SyntaxBase {
type BoltReturnStatementParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never; type BoltReturnStatementParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never;
type BoltReturnStatementChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltReturnStatementChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltConditionalCase extends SyntaxBase { export class BoltConditionalCase extends SyntaxBase {
parentNode: null | BoltConditionalCaseParent = null; parentNode: null | BoltConditionalCaseParent = null;
@ -969,7 +995,7 @@ export class BoltConditionalCase extends SyntaxBase {
type BoltConditionalCaseParent = BoltConditionalStatement | never; type BoltConditionalCaseParent = BoltConditionalStatement | never;
type BoltConditionalCaseChild = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltConditionalCaseChild = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltConditionalStatement extends SyntaxBase { export class BoltConditionalStatement extends SyntaxBase {
parentNode: null | BoltConditionalStatementParent = null; parentNode: null | BoltConditionalStatementParent = null;
@ -992,7 +1018,7 @@ export class BoltResumeStatement extends SyntaxBase {
type BoltResumeStatementParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never; type BoltResumeStatementParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never;
type BoltResumeStatementChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltResumeStatementChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltExpressionStatement extends SyntaxBase { export class BoltExpressionStatement extends SyntaxBase {
parentNode: null | BoltExpressionStatementParent = null; parentNode: null | BoltExpressionStatementParent = null;
@ -1003,7 +1029,18 @@ export class BoltExpressionStatement extends SyntaxBase {
type BoltExpressionStatementParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never; type BoltExpressionStatementParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never;
type BoltExpressionStatementChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | never; type BoltExpressionStatementChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | never;
export class BoltAssignStatement extends SyntaxBase {
parentNode: null | BoltAssignStatementParent = null;
kind: SyntaxKind.BoltAssignStatement = SyntaxKind.BoltAssignStatement;
constructor(public lhs: BoltPattern, public rhs: BoltExpression, span: TextSpan | null = null) { super(span); }
*getChildNodes(): IterableIterator<BoltAssignStatementChild> { yield this.lhs; yield this.rhs; }
}
type BoltAssignStatementParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never;
type BoltAssignStatementChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | BoltRecordPattern | BoltTuplePattern | BoltExpressionPattern | BoltTypePattern | BoltBindPattern | never;
export class BoltLoopStatement extends SyntaxBase { export class BoltLoopStatement extends SyntaxBase {
parentNode: null | BoltLoopStatementParent = null; parentNode: null | BoltLoopStatementParent = null;
@ -1015,7 +1052,7 @@ export class BoltLoopStatement extends SyntaxBase {
type BoltLoopStatementParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never; type BoltLoopStatementParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never;
type BoltLoopStatementChild = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | never; type BoltLoopStatementChild = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | never;
export class BoltParameter extends SyntaxBase { export class BoltParameter extends SyntaxBase {
parentNode: null | BoltParameterParent = null; parentNode: null | BoltParameterParent = null;
@ -1028,7 +1065,7 @@ export class BoltParameter extends SyntaxBase {
type BoltParameterParent = BoltFunctionTypeExpression | BoltFunctionExpression | BoltFunctionDeclaration | never; type BoltParameterParent = BoltFunctionTypeExpression | BoltFunctionExpression | BoltFunctionDeclaration | never;
type BoltParameterChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltRecordPattern | BoltTuplePattern | BoltExpressionPattern | BoltTypePattern | BoltBindPattern | never; type BoltParameterChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltRecordPattern | BoltTuplePattern | BoltExpressionPattern | BoltTypePattern | BoltBindPattern | never;
export type BoltDeclaration = BoltRecordDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration; export type BoltDeclaration = BoltRecordDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration;
@ -1045,27 +1082,28 @@ export class BoltModule extends SyntaxBase {
type BoltModuleParent = BoltSourceFile | BoltModule | never; type BoltModuleParent = BoltSourceFile | BoltModule | never;
type BoltModuleChild = BoltMacroCall | BoltExportDirective | BoltImportDirective | BoltModule | BoltRecordDeclaration | BoltTypeAliasDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | BoltIdentifier | never; type BoltModuleChild = BoltMacroCall | BoltExportDirective | BoltImportDirective | BoltModule | BoltRecordDeclaration | BoltTypeAliasDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | BoltIdentifier | never;
export type BoltDeclarationLike = BoltRecordDeclaration | BoltTypeAliasDeclaration | BoltImplDeclaration | BoltTraitDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration; export type BoltDeclarationLike = BoltRecordDeclaration | BoltTypeAliasDeclaration | BoltImplDeclaration | BoltTraitDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration;
export type BoltFunctionBodyElement = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement; export type BoltFunctionBodyElement = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement;
export class BoltFunctionDeclaration extends SyntaxBase { export class BoltFunctionDeclaration extends SyntaxBase {
parentNode: null | BoltFunctionDeclarationParent = null; parentNode: null | BoltFunctionDeclarationParent = null;
kind: SyntaxKind.BoltFunctionDeclaration = SyntaxKind.BoltFunctionDeclaration; kind: SyntaxKind.BoltFunctionDeclaration = SyntaxKind.BoltFunctionDeclaration;
constructor(public modifiers: BoltModifiers, public target: string, public name: BoltSymbol, public params: BoltParameter[], public returnType: BoltTypeExpression | null, public typeParams: BoltTypeParameter[] | null, public body: BoltFunctionBodyElement[], span: TextSpan | null = null) { super(span); } constructor(public modifiers: BoltModifiers, public target: string, public name: BoltSymbol, public params: BoltParameter[], public returnType: BoltTypeExpression | null, public typeParams: BoltTypeParameter[] | null, public body: BoltFunctionBodyElement[] | null, span: TextSpan | null = null) { super(span); }
*getChildNodes(): IterableIterator<BoltFunctionDeclarationChild> { yield this.name; for (let element of this.params) *getChildNodes(): IterableIterator<BoltFunctionDeclarationChild> { yield this.name; for (let element of this.params)
yield element; if (this.returnType !== null) yield element; if (this.returnType !== null)
yield this.returnType; if (this.typeParams !== null) yield this.returnType; if (this.typeParams !== null)
for (let element of this.typeParams) for (let element of this.typeParams)
yield element; for (let element of this.body) yield element; if (this.body !== null)
for (let element of this.body)
yield element; } yield element; }
} }
type BoltFunctionDeclarationParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltTraitDeclaration | BoltImplDeclaration | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never; type BoltFunctionDeclarationParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltTraitDeclaration | BoltImplDeclaration | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never;
type BoltFunctionDeclarationChild = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | BoltTypeParameter | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltParameter | BoltOperator | BoltVBar | BoltLtSign | BoltExMark | BoltGtSign | BoltIdentifier | never; type BoltFunctionDeclarationChild = BoltMacroCall | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement | BoltTypeParameter | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltParameter | BoltOperator | BoltVBar | BoltLtSign | BoltExMark | BoltGtSign | BoltIdentifier | never;
export class BoltVariableDeclaration extends SyntaxBase { export class BoltVariableDeclaration extends SyntaxBase {
parentNode: null | BoltVariableDeclarationParent = null; parentNode: null | BoltVariableDeclarationParent = null;
@ -1078,7 +1116,7 @@ export class BoltVariableDeclaration extends SyntaxBase {
type BoltVariableDeclarationParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never; type BoltVariableDeclarationParent = BoltSourceFile | BoltFunctionExpression | BoltBlockExpression | BoltConditionalCase | BoltLoopStatement | BoltFunctionDeclaration | BoltModule | never;
type BoltVariableDeclarationChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltRecordPattern | BoltTuplePattern | BoltExpressionPattern | BoltTypePattern | BoltBindPattern | never; type BoltVariableDeclarationChild = BoltConstantExpression | BoltBlockExpression | BoltCaseExpression | BoltMatchExpression | BoltYieldExpression | BoltCallExpression | BoltFunctionExpression | BoltMemberExpression | BoltReferenceExpression | BoltTupleExpression | BoltQuoteExpression | BoltRecordExpression | BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltRecordPattern | BoltTuplePattern | BoltExpressionPattern | BoltTypePattern | BoltBindPattern | never;
export type BoltImportSymbol = BoltPlainImportSymbol; export type BoltImportSymbol = BoltPlainImportSymbol;
@ -1177,23 +1215,23 @@ type BoltTypeAliasDeclarationParent = BoltSourceFile | BoltTraitDeclaration | Bo
type BoltTypeAliasDeclarationChild = BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltTypeParameter | BoltIdentifier | never; type BoltTypeAliasDeclarationChild = BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltTypeParameter | BoltIdentifier | never;
export type BoltRecordMember = BoltMacroCall | BoltRecordField; export type BoltRecordDeclartionElement = BoltMacroCall | BoltRecordDeclarationField;
export class BoltRecordField extends SyntaxBase { export class BoltRecordDeclarationField extends SyntaxBase {
parentNode: null | BoltRecordFieldParent = null; parentNode: null | BoltRecordDeclarationFieldParent = null;
kind: SyntaxKind.BoltRecordField = SyntaxKind.BoltRecordField; kind: SyntaxKind.BoltRecordDeclarationField = SyntaxKind.BoltRecordDeclarationField;
constructor(public name: BoltIdentifier, public typeExpr: BoltTypeExpression, span: TextSpan | null = null) { super(span); } constructor(public name: BoltIdentifier, public typeExpr: BoltTypeExpression, span: TextSpan | null = null) { super(span); }
*getChildNodes(): IterableIterator<BoltRecordFieldChild> { yield this.name; yield this.typeExpr; } *getChildNodes(): IterableIterator<BoltRecordDeclarationFieldChild> { yield this.name; yield this.typeExpr; }
} }
type BoltRecordFieldParent = BoltRecordDeclaration | never; type BoltRecordDeclarationFieldParent = BoltRecordDeclaration | never;
type BoltRecordFieldChild = BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltIdentifier | never; type BoltRecordDeclarationFieldChild = BoltLiftedTypeExpression | BoltFunctionTypeExpression | BoltReferenceTypeExpression | BoltTypeOfExpression | BoltIdentifier | never;
export class BoltRecordDeclaration extends SyntaxBase { export class BoltRecordDeclaration extends SyntaxBase {
parentNode: null | BoltRecordDeclarationParent = null; parentNode: null | BoltRecordDeclarationParent = null;
kind: SyntaxKind.BoltRecordDeclaration = SyntaxKind.BoltRecordDeclaration; kind: SyntaxKind.BoltRecordDeclaration = SyntaxKind.BoltRecordDeclaration;
constructor(public modifiers: BoltModifiers, public name: BoltIdentifier, public typeParms: BoltTypeParameter[] | null, public members: BoltRecordMember[] | null, span: TextSpan | null = null) { super(span); } constructor(public modifiers: BoltModifiers, public name: BoltIdentifier, public typeParms: BoltTypeParameter[] | null, public members: BoltRecordDeclartionElement[] | null, span: TextSpan | null = null) { super(span); }
*getChildNodes(): IterableIterator<BoltRecordDeclarationChild> { yield this.name; if (this.typeParms !== null) *getChildNodes(): IterableIterator<BoltRecordDeclarationChild> { yield this.name; if (this.typeParms !== null)
for (let element of this.typeParms) for (let element of this.typeParms)
yield element; if (this.members !== null) yield element; if (this.members !== null)
@ -1203,9 +1241,9 @@ export class BoltRecordDeclaration extends SyntaxBase {
type BoltRecordDeclarationParent = BoltSourceFile | BoltModule | never; type BoltRecordDeclarationParent = BoltSourceFile | BoltModule | never;
type BoltRecordDeclarationChild = BoltMacroCall | BoltRecordField | BoltTypeParameter | BoltIdentifier | never; type BoltRecordDeclarationChild = BoltMacroCall | BoltRecordDeclarationField | BoltTypeParameter | BoltIdentifier | never;
export type BoltSourceElement = BoltMacroCall | BoltExportDirective | BoltImportDirective | BoltModule | BoltRecordDeclaration | BoltTypeAliasDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement; export type BoltSourceElement = BoltMacroCall | BoltExportDirective | BoltImportDirective | BoltModule | BoltRecordDeclaration | BoltTypeAliasDeclaration | BoltVariableDeclaration | BoltFunctionDeclaration | BoltLoopStatement | BoltAssignStatement | BoltExpressionStatement | BoltResumeStatement | BoltConditionalStatement | BoltReturnStatement;
export class BoltMacroCall extends SyntaxBase { export class BoltMacroCall extends SyntaxBase {
parentNode: null | BoltMacroCallParent = null; parentNode: null | BoltMacroCallParent = null;
@ -2066,6 +2104,10 @@ export function createBoltRecordFieldPattern(isRest: boolean, name: BoltIdentifi
export function createBoltRecordPattern(name: BoltTypeExpression, fields: BoltRecordFieldPattern[], span: TextSpan | null = null): BoltRecordPattern { return new BoltRecordPattern(name, fields, span); } export function createBoltRecordPattern(name: BoltTypeExpression, fields: BoltRecordFieldPattern[], span: TextSpan | null = null): BoltRecordPattern { return new BoltRecordPattern(name, fields, span); }
export function createBoltRecordExpression(typeRef: BoltReferenceTypeExpression, fields: BoltRecordExpressionElement[], span: TextSpan | null = null): BoltRecordExpression { return new BoltRecordExpression(typeRef, fields, span); }
export function createBoltRecordFieldValue(name: BoltIdentifier, value: BoltExpression | null, span: TextSpan | null = null): BoltRecordFieldValue { return new BoltRecordFieldValue(name, value, span); }
export function createBoltQuoteExpression(tokens: (Token | BoltExpression)[], span: TextSpan | null = null): BoltQuoteExpression { return new BoltQuoteExpression(tokens, span); } export function createBoltQuoteExpression(tokens: (Token | BoltExpression)[], span: TextSpan | null = null): BoltQuoteExpression { return new BoltQuoteExpression(tokens, span); }
export function createBoltTupleExpression(elements: BoltExpression[], span: TextSpan | null = null): BoltTupleExpression { return new BoltTupleExpression(elements, span); } export function createBoltTupleExpression(elements: BoltExpression[], span: TextSpan | null = null): BoltTupleExpression { return new BoltTupleExpression(elements, span); }
@ -2102,13 +2144,15 @@ export function createBoltResumeStatement(value: BoltExpression, span: TextSpan
export function createBoltExpressionStatement(expression: BoltExpression, span: TextSpan | null = null): BoltExpressionStatement { return new BoltExpressionStatement(expression, span); } export function createBoltExpressionStatement(expression: BoltExpression, span: TextSpan | null = null): BoltExpressionStatement { return new BoltExpressionStatement(expression, span); }
export function createBoltAssignStatement(lhs: BoltPattern, rhs: BoltExpression, span: TextSpan | null = null): BoltAssignStatement { return new BoltAssignStatement(lhs, rhs, span); }
export function createBoltLoopStatement(elements: BoltFunctionBodyElement[], span: TextSpan | null = null): BoltLoopStatement { return new BoltLoopStatement(elements, span); } export function createBoltLoopStatement(elements: BoltFunctionBodyElement[], span: TextSpan | null = null): BoltLoopStatement { return new BoltLoopStatement(elements, span); }
export function createBoltParameter(index: number, bindings: BoltPattern, typeExpr: BoltTypeExpression | null, defaultValue: BoltExpression | null, span: TextSpan | null = null): BoltParameter { return new BoltParameter(index, bindings, typeExpr, defaultValue, span); } export function createBoltParameter(index: number, bindings: BoltPattern, typeExpr: BoltTypeExpression | null, defaultValue: BoltExpression | null, span: TextSpan | null = null): BoltParameter { return new BoltParameter(index, bindings, typeExpr, defaultValue, span); }
export function createBoltModule(modifiers: BoltModifiers, name: BoltIdentifier[], elements: BoltSourceElement[], span: TextSpan | null = null): BoltModule { return new BoltModule(modifiers, name, elements, span); } export function createBoltModule(modifiers: BoltModifiers, name: BoltIdentifier[], elements: BoltSourceElement[], span: TextSpan | null = null): BoltModule { return new BoltModule(modifiers, name, elements, span); }
export function createBoltFunctionDeclaration(modifiers: BoltModifiers, target: string, name: BoltSymbol, params: BoltParameter[], returnType: BoltTypeExpression | null, typeParams: BoltTypeParameter[] | null, body: BoltFunctionBodyElement[], span: TextSpan | null = null): BoltFunctionDeclaration { return new BoltFunctionDeclaration(modifiers, target, name, params, returnType, typeParams, body, span); } export function createBoltFunctionDeclaration(modifiers: BoltModifiers, target: string, name: BoltSymbol, params: BoltParameter[], returnType: BoltTypeExpression | null, typeParams: BoltTypeParameter[] | null, body: BoltFunctionBodyElement[] | null, span: TextSpan | null = null): BoltFunctionDeclaration { return new BoltFunctionDeclaration(modifiers, target, name, params, returnType, typeParams, body, span); }
export function createBoltVariableDeclaration(modifiers: BoltModifiers, bindings: BoltPattern, typeExpr: BoltTypeExpression | null, value: BoltExpression | null, span: TextSpan | null = null): BoltVariableDeclaration { return new BoltVariableDeclaration(modifiers, bindings, typeExpr, value, span); } export function createBoltVariableDeclaration(modifiers: BoltModifiers, bindings: BoltPattern, typeExpr: BoltTypeExpression | null, value: BoltExpression | null, span: TextSpan | null = null): BoltVariableDeclaration { return new BoltVariableDeclaration(modifiers, bindings, typeExpr, value, span); }
@ -2126,9 +2170,9 @@ export function createBoltImplDeclaration(modifiers: BoltModifiers, typeParams:
export function createBoltTypeAliasDeclaration(modifiers: BoltModifiers, name: BoltIdentifier, typeParams: BoltTypeParameter[] | null, typeExpr: BoltTypeExpression, span: TextSpan | null = null): BoltTypeAliasDeclaration { return new BoltTypeAliasDeclaration(modifiers, name, typeParams, typeExpr, span); } export function createBoltTypeAliasDeclaration(modifiers: BoltModifiers, name: BoltIdentifier, typeParams: BoltTypeParameter[] | null, typeExpr: BoltTypeExpression, span: TextSpan | null = null): BoltTypeAliasDeclaration { return new BoltTypeAliasDeclaration(modifiers, name, typeParams, typeExpr, span); }
export function createBoltRecordField(name: BoltIdentifier, typeExpr: BoltTypeExpression, span: TextSpan | null = null): BoltRecordField { return new BoltRecordField(name, typeExpr, span); } export function createBoltRecordDeclarationField(name: BoltIdentifier, typeExpr: BoltTypeExpression, span: TextSpan | null = null): BoltRecordDeclarationField { return new BoltRecordDeclarationField(name, typeExpr, span); }
export function createBoltRecordDeclaration(modifiers: BoltModifiers, name: BoltIdentifier, typeParms: BoltTypeParameter[] | null, members: BoltRecordMember[] | null, span: TextSpan | null = null): BoltRecordDeclaration { return new BoltRecordDeclaration(modifiers, name, typeParms, members, span); } export function createBoltRecordDeclaration(modifiers: BoltModifiers, name: BoltIdentifier, typeParms: BoltTypeParameter[] | null, members: BoltRecordDeclartionElement[] | null, span: TextSpan | null = null): BoltRecordDeclaration { return new BoltRecordDeclaration(modifiers, name, typeParms, members, span); }
export function createBoltMacroCall(name: BoltIdentifier, text: string, span: TextSpan | null = null): BoltMacroCall { return new BoltMacroCall(name, text, span); } export function createBoltMacroCall(name: BoltIdentifier, text: string, span: TextSpan | null = null): BoltMacroCall { return new BoltMacroCall(name, text, span); }
@ -2264,11 +2308,11 @@ export function isToken(value: any): value is Token { return value.kind === Synt
export function isSourceFile(value: any): value is SourceFile { return value.kind === SyntaxKind.JSSourceFile || value.kind === SyntaxKind.BoltSourceFile; } export function isSourceFile(value: any): value is SourceFile { return value.kind === SyntaxKind.JSSourceFile || value.kind === SyntaxKind.BoltSourceFile; }
export function isFunctionBodyElement(value: any): value is FunctionBodyElement { return value.kind === SyntaxKind.JSLetDeclaration || value.kind === SyntaxKind.JSArrowFunctionDeclaration || value.kind === SyntaxKind.JSFunctionDeclaration || value.kind === SyntaxKind.JSImportDeclaration || value.kind === SyntaxKind.JSReturnStatement || value.kind === SyntaxKind.JSConditionalStatement || value.kind === SyntaxKind.JSExpressionStatement || value.kind === SyntaxKind.JSTryCatchStatement || value.kind === SyntaxKind.BoltMacroCall || value.kind === SyntaxKind.BoltVariableDeclaration || value.kind === SyntaxKind.BoltFunctionDeclaration || value.kind === SyntaxKind.BoltLoopStatement || value.kind === SyntaxKind.BoltExpressionStatement || value.kind === SyntaxKind.BoltResumeStatement || value.kind === SyntaxKind.BoltConditionalStatement || value.kind === SyntaxKind.BoltReturnStatement; } export function isFunctionBodyElement(value: any): value is FunctionBodyElement { return value.kind === SyntaxKind.JSLetDeclaration || value.kind === SyntaxKind.JSArrowFunctionDeclaration || value.kind === SyntaxKind.JSFunctionDeclaration || value.kind === SyntaxKind.JSImportDeclaration || value.kind === SyntaxKind.JSReturnStatement || value.kind === SyntaxKind.JSConditionalStatement || value.kind === SyntaxKind.JSExpressionStatement || value.kind === SyntaxKind.JSTryCatchStatement || value.kind === SyntaxKind.BoltMacroCall || value.kind === SyntaxKind.BoltVariableDeclaration || value.kind === SyntaxKind.BoltFunctionDeclaration || value.kind === SyntaxKind.BoltLoopStatement || value.kind === SyntaxKind.BoltAssignStatement || value.kind === SyntaxKind.BoltExpressionStatement || value.kind === SyntaxKind.BoltResumeStatement || value.kind === SyntaxKind.BoltConditionalStatement || value.kind === SyntaxKind.BoltReturnStatement; }
export function isReturnStatement(value: any): value is ReturnStatement { return value.kind === SyntaxKind.JSReturnStatement || value.kind === SyntaxKind.BoltReturnStatement; } export function isReturnStatement(value: any): value is ReturnStatement { return value.kind === SyntaxKind.JSReturnStatement || value.kind === SyntaxKind.BoltReturnStatement; }
export function isBoltSyntax(value: any): value is BoltSyntax { return value.kind === SyntaxKind.BoltMacroCall || value.kind === SyntaxKind.BoltRecordField || value.kind === SyntaxKind.BoltPlainExportSymbol || value.kind === SyntaxKind.BoltImportDirective || value.kind === SyntaxKind.BoltPlainImportSymbol || value.kind === SyntaxKind.BoltModule || value.kind === SyntaxKind.BoltRecordDeclaration || value.kind === SyntaxKind.BoltTypeAliasDeclaration || value.kind === SyntaxKind.BoltVariableDeclaration || value.kind === SyntaxKind.BoltFunctionDeclaration || value.kind === SyntaxKind.BoltParameter || value.kind === SyntaxKind.BoltConditionalCase || value.kind === SyntaxKind.BoltLoopStatement || value.kind === SyntaxKind.BoltExpressionStatement || value.kind === SyntaxKind.BoltResumeStatement || value.kind === SyntaxKind.BoltConditionalStatement || value.kind === SyntaxKind.BoltReturnStatement || value.kind === SyntaxKind.BoltCase || value.kind === SyntaxKind.BoltMatchArm || value.kind === SyntaxKind.BoltConstantExpression || value.kind === SyntaxKind.BoltBlockExpression || value.kind === SyntaxKind.BoltCaseExpression || value.kind === SyntaxKind.BoltMatchExpression || value.kind === SyntaxKind.BoltYieldExpression || value.kind === SyntaxKind.BoltCallExpression || value.kind === SyntaxKind.BoltFunctionExpression || value.kind === SyntaxKind.BoltMemberExpression || value.kind === SyntaxKind.BoltReferenceExpression || value.kind === SyntaxKind.BoltTupleExpression || value.kind === SyntaxKind.BoltQuoteExpression || value.kind === SyntaxKind.BoltRecordFieldPattern || value.kind === SyntaxKind.BoltTuplePatternElement || value.kind === SyntaxKind.BoltRecordPattern || value.kind === SyntaxKind.BoltTuplePattern || value.kind === SyntaxKind.BoltExpressionPattern || value.kind === SyntaxKind.BoltTypePattern || value.kind === SyntaxKind.BoltBindPattern || value.kind === SyntaxKind.BoltTypeParameter || value.kind === SyntaxKind.BoltLiftedTypeExpression || value.kind === SyntaxKind.BoltFunctionTypeExpression || value.kind === SyntaxKind.BoltReferenceTypeExpression || value.kind === SyntaxKind.BoltTypeOfExpression || value.kind === SyntaxKind.BoltQualName || value.kind === SyntaxKind.BoltSourceFile || value.kind === SyntaxKind.BoltBracketed || value.kind === SyntaxKind.BoltBraced || value.kind === SyntaxKind.BoltParenthesized || value.kind === SyntaxKind.BoltImplKeyword || value.kind === SyntaxKind.BoltTraitKeyword || value.kind === SyntaxKind.BoltTypeKeyword || value.kind === SyntaxKind.BoltStructKeyword || value.kind === SyntaxKind.BoltEnumKeyword || value.kind === SyntaxKind.BoltMutKeyword || value.kind === SyntaxKind.BoltModKeyword || value.kind === SyntaxKind.BoltPubKeyword || value.kind === SyntaxKind.BoltExportKeyword || value.kind === SyntaxKind.BoltImportKeyword || value.kind === SyntaxKind.BoltMatchKeyword || value.kind === SyntaxKind.BoltYieldKeyword || value.kind === SyntaxKind.BoltLoopKeyword || value.kind === SyntaxKind.BoltReturnKeyword || value.kind === SyntaxKind.BoltLetKeyword || value.kind === SyntaxKind.BoltForKeyword || value.kind === SyntaxKind.BoltForeignKeyword || value.kind === SyntaxKind.BoltFnKeyword || value.kind === SyntaxKind.BoltQuoteKeyword || value.kind === SyntaxKind.BoltWhereKeyword || value.kind === SyntaxKind.BoltVBar || value.kind === SyntaxKind.BoltLtSign || value.kind === SyntaxKind.BoltExMark || value.kind === SyntaxKind.BoltGtSign || value.kind === SyntaxKind.BoltEqSign || value.kind === SyntaxKind.BoltLArrow || value.kind === SyntaxKind.BoltRArrowAlt || value.kind === SyntaxKind.BoltRArrow || value.kind === SyntaxKind.BoltDotDot || value.kind === SyntaxKind.BoltDot || value.kind === SyntaxKind.BoltColonColon || value.kind === SyntaxKind.BoltColon || value.kind === SyntaxKind.BoltSemi || value.kind === SyntaxKind.BoltComma || value.kind === SyntaxKind.BoltAssignment || value.kind === SyntaxKind.BoltOperator || value.kind === SyntaxKind.BoltIdentifier || value.kind === SyntaxKind.BoltIntegerLiteral || value.kind === SyntaxKind.BoltStringLiteral || value.kind === SyntaxKind.EndOfFile; } export function isBoltSyntax(value: any): value is BoltSyntax { return value.kind === SyntaxKind.BoltMacroCall || value.kind === SyntaxKind.BoltRecordDeclarationField || value.kind === SyntaxKind.BoltPlainExportSymbol || value.kind === SyntaxKind.BoltImportDirective || value.kind === SyntaxKind.BoltPlainImportSymbol || value.kind === SyntaxKind.BoltModule || value.kind === SyntaxKind.BoltRecordDeclaration || value.kind === SyntaxKind.BoltTypeAliasDeclaration || value.kind === SyntaxKind.BoltVariableDeclaration || value.kind === SyntaxKind.BoltFunctionDeclaration || value.kind === SyntaxKind.BoltParameter || value.kind === SyntaxKind.BoltConditionalCase || value.kind === SyntaxKind.BoltLoopStatement || value.kind === SyntaxKind.BoltAssignStatement || value.kind === SyntaxKind.BoltExpressionStatement || value.kind === SyntaxKind.BoltResumeStatement || value.kind === SyntaxKind.BoltConditionalStatement || value.kind === SyntaxKind.BoltReturnStatement || value.kind === SyntaxKind.BoltCase || value.kind === SyntaxKind.BoltMatchArm || value.kind === SyntaxKind.BoltRecordFieldValue || value.kind === SyntaxKind.BoltConstantExpression || value.kind === SyntaxKind.BoltBlockExpression || value.kind === SyntaxKind.BoltCaseExpression || value.kind === SyntaxKind.BoltMatchExpression || value.kind === SyntaxKind.BoltYieldExpression || value.kind === SyntaxKind.BoltCallExpression || value.kind === SyntaxKind.BoltFunctionExpression || value.kind === SyntaxKind.BoltMemberExpression || value.kind === SyntaxKind.BoltReferenceExpression || value.kind === SyntaxKind.BoltTupleExpression || value.kind === SyntaxKind.BoltQuoteExpression || value.kind === SyntaxKind.BoltRecordExpression || value.kind === SyntaxKind.BoltRecordFieldPattern || value.kind === SyntaxKind.BoltTuplePatternElement || value.kind === SyntaxKind.BoltRecordPattern || value.kind === SyntaxKind.BoltTuplePattern || value.kind === SyntaxKind.BoltExpressionPattern || value.kind === SyntaxKind.BoltTypePattern || value.kind === SyntaxKind.BoltBindPattern || value.kind === SyntaxKind.BoltTypeParameter || value.kind === SyntaxKind.BoltLiftedTypeExpression || value.kind === SyntaxKind.BoltFunctionTypeExpression || value.kind === SyntaxKind.BoltReferenceTypeExpression || value.kind === SyntaxKind.BoltTypeOfExpression || value.kind === SyntaxKind.BoltQualName || value.kind === SyntaxKind.BoltSourceFile || value.kind === SyntaxKind.BoltBracketed || value.kind === SyntaxKind.BoltBraced || value.kind === SyntaxKind.BoltParenthesized || value.kind === SyntaxKind.BoltImplKeyword || value.kind === SyntaxKind.BoltTraitKeyword || value.kind === SyntaxKind.BoltTypeKeyword || value.kind === SyntaxKind.BoltStructKeyword || value.kind === SyntaxKind.BoltEnumKeyword || value.kind === SyntaxKind.BoltMutKeyword || value.kind === SyntaxKind.BoltModKeyword || value.kind === SyntaxKind.BoltPubKeyword || value.kind === SyntaxKind.BoltExportKeyword || value.kind === SyntaxKind.BoltImportKeyword || value.kind === SyntaxKind.BoltMatchKeyword || value.kind === SyntaxKind.BoltYieldKeyword || value.kind === SyntaxKind.BoltLoopKeyword || value.kind === SyntaxKind.BoltReturnKeyword || value.kind === SyntaxKind.BoltLetKeyword || value.kind === SyntaxKind.BoltForKeyword || value.kind === SyntaxKind.BoltForeignKeyword || value.kind === SyntaxKind.BoltFnKeyword || value.kind === SyntaxKind.BoltQuoteKeyword || value.kind === SyntaxKind.BoltWhereKeyword || value.kind === SyntaxKind.BoltVBar || value.kind === SyntaxKind.BoltLtSign || value.kind === SyntaxKind.BoltExMark || value.kind === SyntaxKind.BoltGtSign || value.kind === SyntaxKind.BoltEqSign || value.kind === SyntaxKind.BoltLArrow || value.kind === SyntaxKind.BoltRArrowAlt || value.kind === SyntaxKind.BoltRArrow || value.kind === SyntaxKind.BoltDotDot || value.kind === SyntaxKind.BoltDot || value.kind === SyntaxKind.BoltColonColon || value.kind === SyntaxKind.BoltColon || value.kind === SyntaxKind.BoltSemi || value.kind === SyntaxKind.BoltComma || value.kind === SyntaxKind.BoltAssignment || value.kind === SyntaxKind.BoltOperator || value.kind === SyntaxKind.BoltIdentifier || value.kind === SyntaxKind.BoltIntegerLiteral || value.kind === SyntaxKind.BoltStringLiteral || value.kind === SyntaxKind.EndOfFile; }
export function isBoltToken(value: any): value is BoltToken { return value.kind === SyntaxKind.BoltBracketed || value.kind === SyntaxKind.BoltBraced || value.kind === SyntaxKind.BoltParenthesized || value.kind === SyntaxKind.BoltImplKeyword || value.kind === SyntaxKind.BoltTraitKeyword || value.kind === SyntaxKind.BoltTypeKeyword || value.kind === SyntaxKind.BoltStructKeyword || value.kind === SyntaxKind.BoltEnumKeyword || value.kind === SyntaxKind.BoltMutKeyword || value.kind === SyntaxKind.BoltModKeyword || value.kind === SyntaxKind.BoltPubKeyword || value.kind === SyntaxKind.BoltExportKeyword || value.kind === SyntaxKind.BoltImportKeyword || value.kind === SyntaxKind.BoltMatchKeyword || value.kind === SyntaxKind.BoltYieldKeyword || value.kind === SyntaxKind.BoltLoopKeyword || value.kind === SyntaxKind.BoltReturnKeyword || value.kind === SyntaxKind.BoltLetKeyword || value.kind === SyntaxKind.BoltForKeyword || value.kind === SyntaxKind.BoltForeignKeyword || value.kind === SyntaxKind.BoltFnKeyword || value.kind === SyntaxKind.BoltQuoteKeyword || value.kind === SyntaxKind.BoltWhereKeyword || value.kind === SyntaxKind.BoltVBar || value.kind === SyntaxKind.BoltLtSign || value.kind === SyntaxKind.BoltExMark || value.kind === SyntaxKind.BoltGtSign || value.kind === SyntaxKind.BoltEqSign || value.kind === SyntaxKind.BoltLArrow || value.kind === SyntaxKind.BoltRArrowAlt || value.kind === SyntaxKind.BoltRArrow || value.kind === SyntaxKind.BoltDotDot || value.kind === SyntaxKind.BoltDot || value.kind === SyntaxKind.BoltColonColon || value.kind === SyntaxKind.BoltColon || value.kind === SyntaxKind.BoltSemi || value.kind === SyntaxKind.BoltComma || value.kind === SyntaxKind.BoltAssignment || value.kind === SyntaxKind.BoltOperator || value.kind === SyntaxKind.BoltIdentifier || value.kind === SyntaxKind.BoltIntegerLiteral || value.kind === SyntaxKind.BoltStringLiteral || value.kind === SyntaxKind.EndOfFile; } export function isBoltToken(value: any): value is BoltToken { return value.kind === SyntaxKind.BoltBracketed || value.kind === SyntaxKind.BoltBraced || value.kind === SyntaxKind.BoltParenthesized || value.kind === SyntaxKind.BoltImplKeyword || value.kind === SyntaxKind.BoltTraitKeyword || value.kind === SyntaxKind.BoltTypeKeyword || value.kind === SyntaxKind.BoltStructKeyword || value.kind === SyntaxKind.BoltEnumKeyword || value.kind === SyntaxKind.BoltMutKeyword || value.kind === SyntaxKind.BoltModKeyword || value.kind === SyntaxKind.BoltPubKeyword || value.kind === SyntaxKind.BoltExportKeyword || value.kind === SyntaxKind.BoltImportKeyword || value.kind === SyntaxKind.BoltMatchKeyword || value.kind === SyntaxKind.BoltYieldKeyword || value.kind === SyntaxKind.BoltLoopKeyword || value.kind === SyntaxKind.BoltReturnKeyword || value.kind === SyntaxKind.BoltLetKeyword || value.kind === SyntaxKind.BoltForKeyword || value.kind === SyntaxKind.BoltForeignKeyword || value.kind === SyntaxKind.BoltFnKeyword || value.kind === SyntaxKind.BoltQuoteKeyword || value.kind === SyntaxKind.BoltWhereKeyword || value.kind === SyntaxKind.BoltVBar || value.kind === SyntaxKind.BoltLtSign || value.kind === SyntaxKind.BoltExMark || value.kind === SyntaxKind.BoltGtSign || value.kind === SyntaxKind.BoltEqSign || value.kind === SyntaxKind.BoltLArrow || value.kind === SyntaxKind.BoltRArrowAlt || value.kind === SyntaxKind.BoltRArrow || value.kind === SyntaxKind.BoltDotDot || value.kind === SyntaxKind.BoltDot || value.kind === SyntaxKind.BoltColonColon || value.kind === SyntaxKind.BoltColon || value.kind === SyntaxKind.BoltSemi || value.kind === SyntaxKind.BoltComma || value.kind === SyntaxKind.BoltAssignment || value.kind === SyntaxKind.BoltOperator || value.kind === SyntaxKind.BoltIdentifier || value.kind === SyntaxKind.BoltIntegerLiteral || value.kind === SyntaxKind.BoltStringLiteral || value.kind === SyntaxKind.EndOfFile; }
@ -2396,7 +2440,13 @@ export function isBoltRecordFieldPattern(value: any): value is BoltRecordFieldPa
export function isBoltRecordPattern(value: any): value is BoltRecordPattern { return value.kind === SyntaxKind.BoltRecordPattern; } export function isBoltRecordPattern(value: any): value is BoltRecordPattern { return value.kind === SyntaxKind.BoltRecordPattern; }
export function isBoltExpression(value: any): value is BoltExpression { return value.kind === SyntaxKind.BoltConstantExpression || value.kind === SyntaxKind.BoltBlockExpression || value.kind === SyntaxKind.BoltCaseExpression || value.kind === SyntaxKind.BoltMatchExpression || value.kind === SyntaxKind.BoltYieldExpression || value.kind === SyntaxKind.BoltCallExpression || value.kind === SyntaxKind.BoltFunctionExpression || value.kind === SyntaxKind.BoltMemberExpression || value.kind === SyntaxKind.BoltReferenceExpression || value.kind === SyntaxKind.BoltTupleExpression || value.kind === SyntaxKind.BoltQuoteExpression; } export function isBoltExpression(value: any): value is BoltExpression { return value.kind === SyntaxKind.BoltConstantExpression || value.kind === SyntaxKind.BoltBlockExpression || value.kind === SyntaxKind.BoltCaseExpression || value.kind === SyntaxKind.BoltMatchExpression || value.kind === SyntaxKind.BoltYieldExpression || value.kind === SyntaxKind.BoltCallExpression || value.kind === SyntaxKind.BoltFunctionExpression || value.kind === SyntaxKind.BoltMemberExpression || value.kind === SyntaxKind.BoltReferenceExpression || value.kind === SyntaxKind.BoltTupleExpression || value.kind === SyntaxKind.BoltQuoteExpression || value.kind === SyntaxKind.BoltRecordExpression; }
export function isBoltRecordExpression(value: any): value is BoltRecordExpression { return value.kind === SyntaxKind.BoltRecordExpression; }
export function isBoltRecordExpressionElement(value: any): value is BoltRecordExpressionElement { return value.kind === SyntaxKind.BoltRecordFieldValue; }
export function isBoltRecordFieldValue(value: any): value is BoltRecordFieldValue { return value.kind === SyntaxKind.BoltRecordFieldValue; }
export function isBoltQuoteExpression(value: any): value is BoltQuoteExpression { return value.kind === SyntaxKind.BoltQuoteExpression; } export function isBoltQuoteExpression(value: any): value is BoltQuoteExpression { return value.kind === SyntaxKind.BoltQuoteExpression; }
@ -2424,7 +2474,7 @@ export function isBoltBlockExpression(value: any): value is BoltBlockExpression
export function isBoltConstantExpression(value: any): value is BoltConstantExpression { return value.kind === SyntaxKind.BoltConstantExpression; } export function isBoltConstantExpression(value: any): value is BoltConstantExpression { return value.kind === SyntaxKind.BoltConstantExpression; }
export function isBoltStatement(value: any): value is BoltStatement { return value.kind === SyntaxKind.BoltLoopStatement || value.kind === SyntaxKind.BoltExpressionStatement || value.kind === SyntaxKind.BoltResumeStatement || value.kind === SyntaxKind.BoltConditionalStatement || value.kind === SyntaxKind.BoltReturnStatement; } export function isBoltStatement(value: any): value is BoltStatement { return value.kind === SyntaxKind.BoltLoopStatement || value.kind === SyntaxKind.BoltAssignStatement || value.kind === SyntaxKind.BoltExpressionStatement || value.kind === SyntaxKind.BoltResumeStatement || value.kind === SyntaxKind.BoltConditionalStatement || value.kind === SyntaxKind.BoltReturnStatement; }
export function isBoltReturnStatement(value: any): value is BoltReturnStatement { return value.kind === SyntaxKind.BoltReturnStatement; } export function isBoltReturnStatement(value: any): value is BoltReturnStatement { return value.kind === SyntaxKind.BoltReturnStatement; }
@ -2436,6 +2486,8 @@ export function isBoltResumeStatement(value: any): value is BoltResumeStatement
export function isBoltExpressionStatement(value: any): value is BoltExpressionStatement { return value.kind === SyntaxKind.BoltExpressionStatement; } export function isBoltExpressionStatement(value: any): value is BoltExpressionStatement { return value.kind === SyntaxKind.BoltExpressionStatement; }
export function isBoltAssignStatement(value: any): value is BoltAssignStatement { return value.kind === SyntaxKind.BoltAssignStatement; }
export function isBoltLoopStatement(value: any): value is BoltLoopStatement { return value.kind === SyntaxKind.BoltLoopStatement; } export function isBoltLoopStatement(value: any): value is BoltLoopStatement { return value.kind === SyntaxKind.BoltLoopStatement; }
export function isBoltParameter(value: any): value is BoltParameter { return value.kind === SyntaxKind.BoltParameter; } export function isBoltParameter(value: any): value is BoltParameter { return value.kind === SyntaxKind.BoltParameter; }
@ -2448,7 +2500,7 @@ export function isBoltModule(value: any): value is BoltModule { return value.kin
export function isBoltDeclarationLike(value: any): value is BoltDeclarationLike { return value.kind === SyntaxKind.BoltRecordDeclaration || value.kind === SyntaxKind.BoltTypeAliasDeclaration || value.kind === SyntaxKind.BoltImplDeclaration || value.kind === SyntaxKind.BoltTraitDeclaration || value.kind === SyntaxKind.BoltVariableDeclaration || value.kind === SyntaxKind.BoltFunctionDeclaration; } export function isBoltDeclarationLike(value: any): value is BoltDeclarationLike { return value.kind === SyntaxKind.BoltRecordDeclaration || value.kind === SyntaxKind.BoltTypeAliasDeclaration || value.kind === SyntaxKind.BoltImplDeclaration || value.kind === SyntaxKind.BoltTraitDeclaration || value.kind === SyntaxKind.BoltVariableDeclaration || value.kind === SyntaxKind.BoltFunctionDeclaration; }
export function isBoltFunctionBodyElement(value: any): value is BoltFunctionBodyElement { return value.kind === SyntaxKind.BoltMacroCall || value.kind === SyntaxKind.BoltVariableDeclaration || value.kind === SyntaxKind.BoltFunctionDeclaration || value.kind === SyntaxKind.BoltLoopStatement || value.kind === SyntaxKind.BoltExpressionStatement || value.kind === SyntaxKind.BoltResumeStatement || value.kind === SyntaxKind.BoltConditionalStatement || value.kind === SyntaxKind.BoltReturnStatement; } export function isBoltFunctionBodyElement(value: any): value is BoltFunctionBodyElement { return value.kind === SyntaxKind.BoltMacroCall || value.kind === SyntaxKind.BoltVariableDeclaration || value.kind === SyntaxKind.BoltFunctionDeclaration || value.kind === SyntaxKind.BoltLoopStatement || value.kind === SyntaxKind.BoltAssignStatement || value.kind === SyntaxKind.BoltExpressionStatement || value.kind === SyntaxKind.BoltResumeStatement || value.kind === SyntaxKind.BoltConditionalStatement || value.kind === SyntaxKind.BoltReturnStatement; }
export function isBoltFunctionDeclaration(value: any): value is BoltFunctionDeclaration { return value.kind === SyntaxKind.BoltFunctionDeclaration; } export function isBoltFunctionDeclaration(value: any): value is BoltFunctionDeclaration { return value.kind === SyntaxKind.BoltFunctionDeclaration; }
@ -2474,13 +2526,13 @@ export function isBoltImplDeclaration(value: any): value is BoltImplDeclaration
export function isBoltTypeAliasDeclaration(value: any): value is BoltTypeAliasDeclaration { return value.kind === SyntaxKind.BoltTypeAliasDeclaration; } export function isBoltTypeAliasDeclaration(value: any): value is BoltTypeAliasDeclaration { return value.kind === SyntaxKind.BoltTypeAliasDeclaration; }
export function isBoltRecordMember(value: any): value is BoltRecordMember { return value.kind === SyntaxKind.BoltMacroCall || value.kind === SyntaxKind.BoltRecordField; } export function isBoltRecordDeclartionElement(value: any): value is BoltRecordDeclartionElement { return value.kind === SyntaxKind.BoltMacroCall || value.kind === SyntaxKind.BoltRecordDeclarationField; }
export function isBoltRecordField(value: any): value is BoltRecordField { return value.kind === SyntaxKind.BoltRecordField; } export function isBoltRecordDeclarationField(value: any): value is BoltRecordDeclarationField { return value.kind === SyntaxKind.BoltRecordDeclarationField; }
export function isBoltRecordDeclaration(value: any): value is BoltRecordDeclaration { return value.kind === SyntaxKind.BoltRecordDeclaration; } export function isBoltRecordDeclaration(value: any): value is BoltRecordDeclaration { return value.kind === SyntaxKind.BoltRecordDeclaration; }
export function isBoltSourceElement(value: any): value is BoltSourceElement { return value.kind === SyntaxKind.BoltMacroCall || value.kind === SyntaxKind.BoltExportDirective || value.kind === SyntaxKind.BoltImportDirective || value.kind === SyntaxKind.BoltModule || value.kind === SyntaxKind.BoltRecordDeclaration || value.kind === SyntaxKind.BoltTypeAliasDeclaration || value.kind === SyntaxKind.BoltVariableDeclaration || value.kind === SyntaxKind.BoltFunctionDeclaration || value.kind === SyntaxKind.BoltLoopStatement || value.kind === SyntaxKind.BoltExpressionStatement || value.kind === SyntaxKind.BoltResumeStatement || value.kind === SyntaxKind.BoltConditionalStatement || value.kind === SyntaxKind.BoltReturnStatement; } export function isBoltSourceElement(value: any): value is BoltSourceElement { return value.kind === SyntaxKind.BoltMacroCall || value.kind === SyntaxKind.BoltExportDirective || value.kind === SyntaxKind.BoltImportDirective || value.kind === SyntaxKind.BoltModule || value.kind === SyntaxKind.BoltRecordDeclaration || value.kind === SyntaxKind.BoltTypeAliasDeclaration || value.kind === SyntaxKind.BoltVariableDeclaration || value.kind === SyntaxKind.BoltFunctionDeclaration || value.kind === SyntaxKind.BoltLoopStatement || value.kind === SyntaxKind.BoltAssignStatement || value.kind === SyntaxKind.BoltExpressionStatement || value.kind === SyntaxKind.BoltResumeStatement || value.kind === SyntaxKind.BoltConditionalStatement || value.kind === SyntaxKind.BoltReturnStatement; }
export function isBoltMacroCall(value: any): value is BoltMacroCall { return value.kind === SyntaxKind.BoltMacroCall; } export function isBoltMacroCall(value: any): value is BoltMacroCall { return value.kind === SyntaxKind.BoltMacroCall; }
@ -2805,6 +2857,12 @@ export class Visitor {
case SyntaxKind.BoltRecordPattern: case SyntaxKind.BoltRecordPattern:
this.visitBoltRecordPattern((node as BoltRecordPattern)); this.visitBoltRecordPattern((node as BoltRecordPattern));
break; break;
case SyntaxKind.BoltRecordExpression:
this.visitBoltRecordExpression((node as BoltRecordExpression));
break;
case SyntaxKind.BoltRecordFieldValue:
this.visitBoltRecordFieldValue((node as BoltRecordFieldValue));
break;
case SyntaxKind.BoltQuoteExpression: case SyntaxKind.BoltQuoteExpression:
this.visitBoltQuoteExpression((node as BoltQuoteExpression)); this.visitBoltQuoteExpression((node as BoltQuoteExpression));
break; break;
@ -2859,6 +2917,9 @@ export class Visitor {
case SyntaxKind.BoltExpressionStatement: case SyntaxKind.BoltExpressionStatement:
this.visitBoltExpressionStatement((node as BoltExpressionStatement)); this.visitBoltExpressionStatement((node as BoltExpressionStatement));
break; break;
case SyntaxKind.BoltAssignStatement:
this.visitBoltAssignStatement((node as BoltAssignStatement));
break;
case SyntaxKind.BoltLoopStatement: case SyntaxKind.BoltLoopStatement:
this.visitBoltLoopStatement((node as BoltLoopStatement)); this.visitBoltLoopStatement((node as BoltLoopStatement));
break; break;
@ -2895,8 +2956,8 @@ export class Visitor {
case SyntaxKind.BoltTypeAliasDeclaration: case SyntaxKind.BoltTypeAliasDeclaration:
this.visitBoltTypeAliasDeclaration((node as BoltTypeAliasDeclaration)); this.visitBoltTypeAliasDeclaration((node as BoltTypeAliasDeclaration));
break; break;
case SyntaxKind.BoltRecordField: case SyntaxKind.BoltRecordDeclarationField:
this.visitBoltRecordField((node as BoltRecordField)); this.visitBoltRecordDeclarationField((node as BoltRecordDeclarationField));
break; break;
case SyntaxKind.BoltRecordDeclaration: case SyntaxKind.BoltRecordDeclaration:
this.visitBoltRecordDeclaration((node as BoltRecordDeclaration)); this.visitBoltRecordDeclaration((node as BoltRecordDeclaration));
@ -3165,6 +3226,9 @@ export class Visitor {
protected visitBoltRecordFieldPattern(node: BoltRecordFieldPattern): void { this.visitBoltSyntax(node); } protected visitBoltRecordFieldPattern(node: BoltRecordFieldPattern): void { this.visitBoltSyntax(node); }
protected visitBoltRecordPattern(node: BoltRecordPattern): void { this.visitBoltPattern(node); } protected visitBoltRecordPattern(node: BoltRecordPattern): void { this.visitBoltPattern(node); }
protected visitBoltExpression(node: BoltExpression): void { this.visitBoltSyntax(node); } protected visitBoltExpression(node: BoltExpression): void { this.visitBoltSyntax(node); }
protected visitBoltRecordExpression(node: BoltRecordExpression): void { this.visitBoltExpression(node); }
protected visitBoltRecordExpressionElement(node: BoltRecordExpressionElement): void { this.visitBoltSyntax(node); }
protected visitBoltRecordFieldValue(node: BoltRecordFieldValue): void { this.visitBoltRecordExpressionElement(node); }
protected visitBoltQuoteExpression(node: BoltQuoteExpression): void { this.visitBoltExpression(node); } protected visitBoltQuoteExpression(node: BoltQuoteExpression): void { this.visitBoltExpression(node); }
protected visitBoltTupleExpression(node: BoltTupleExpression): void { this.visitBoltExpression(node); } protected visitBoltTupleExpression(node: BoltTupleExpression): void { this.visitBoltExpression(node); }
protected visitBoltReferenceExpression(node: BoltReferenceExpression): void { this.visitBoltExpression(node); } protected visitBoltReferenceExpression(node: BoltReferenceExpression): void { this.visitBoltExpression(node); }
@ -3184,6 +3248,7 @@ export class Visitor {
protected visitBoltConditionalStatement(node: BoltConditionalStatement): void { this.visitBoltStatement(node); } protected visitBoltConditionalStatement(node: BoltConditionalStatement): void { this.visitBoltStatement(node); }
protected visitBoltResumeStatement(node: BoltResumeStatement): void { this.visitBoltStatement(node); } protected visitBoltResumeStatement(node: BoltResumeStatement): void { this.visitBoltStatement(node); }
protected visitBoltExpressionStatement(node: BoltExpressionStatement): void { this.visitBoltStatement(node); } protected visitBoltExpressionStatement(node: BoltExpressionStatement): void { this.visitBoltStatement(node); }
protected visitBoltAssignStatement(node: BoltAssignStatement): void { this.visitBoltStatement(node); }
protected visitBoltLoopStatement(node: BoltLoopStatement): void { this.visitBoltStatement(node); } protected visitBoltLoopStatement(node: BoltLoopStatement): void { this.visitBoltStatement(node); }
protected visitBoltParameter(node: BoltParameter): void { this.visitBoltSyntax(node); } protected visitBoltParameter(node: BoltParameter): void { this.visitBoltSyntax(node); }
protected visitBoltDeclaration(node: BoltDeclaration): void { this.visitBoltSyntax(node); this.visitBoltSourceElement(node); } protected visitBoltDeclaration(node: BoltDeclaration): void { this.visitBoltSyntax(node); this.visitBoltSourceElement(node); }
@ -3203,11 +3268,11 @@ export class Visitor {
protected visitBoltTraitDeclaration(node: BoltTraitDeclaration): void { this.visitBoltDeclarationLike(node); } protected visitBoltTraitDeclaration(node: BoltTraitDeclaration): void { this.visitBoltDeclarationLike(node); }
protected visitBoltImplDeclaration(node: BoltImplDeclaration): void { this.visitBoltDeclarationLike(node); } protected visitBoltImplDeclaration(node: BoltImplDeclaration): void { this.visitBoltDeclarationLike(node); }
protected visitBoltTypeAliasDeclaration(node: BoltTypeAliasDeclaration): void { this.visitBoltDeclarationLike(node); this.visitBoltTypeDeclaration(node); this.visitBoltTraitOrImplElement(node); } protected visitBoltTypeAliasDeclaration(node: BoltTypeAliasDeclaration): void { this.visitBoltDeclarationLike(node); this.visitBoltTypeDeclaration(node); this.visitBoltTraitOrImplElement(node); }
protected visitBoltRecordMember(node: BoltRecordMember): void { this.visitBoltSyntax(node); } protected visitBoltRecordDeclartionElement(node: BoltRecordDeclartionElement): void { this.visitBoltSyntax(node); }
protected visitBoltRecordField(node: BoltRecordField): void { this.visitBoltRecordMember(node); } protected visitBoltRecordDeclarationField(node: BoltRecordDeclarationField): void { this.visitBoltRecordDeclartionElement(node); }
protected visitBoltRecordDeclaration(node: BoltRecordDeclaration): void { this.visitBoltDeclaration(node); this.visitBoltTypeDeclaration(node); this.visitBoltDeclarationLike(node); } protected visitBoltRecordDeclaration(node: BoltRecordDeclaration): void { this.visitBoltDeclaration(node); this.visitBoltTypeDeclaration(node); this.visitBoltDeclarationLike(node); }
protected visitBoltSourceElement(node: BoltSourceElement): void { this.visitSyntax(node); } protected visitBoltSourceElement(node: BoltSourceElement): void { this.visitSyntax(node); }
protected visitBoltMacroCall(node: BoltMacroCall): void { this.visitBoltRecordMember(node); this.visitBoltSourceElement(node); this.visitBoltTraitOrImplElement(node); this.visitBoltFunctionBodyElement(node); } protected visitBoltMacroCall(node: BoltMacroCall): void { this.visitBoltRecordDeclartionElement(node); this.visitBoltSourceElement(node); this.visitBoltTraitOrImplElement(node); this.visitBoltFunctionBodyElement(node); }
protected visitJSSyntax(node: JSSyntax): void { this.visitSyntax(node); } protected visitJSSyntax(node: JSSyntax): void { this.visitSyntax(node); }
protected visitJSToken(node: JSToken): void { this.visitJSSyntax(node); this.visitToken(node); } protected visitJSToken(node: JSToken): void { this.visitJSSyntax(node); this.visitToken(node); }
protected visitJSIdentifier(node: JSIdentifier): void { this.visitJSToken(node); } protected visitJSIdentifier(node: JSIdentifier): void { this.visitJSToken(node); }
@ -3286,9 +3351,9 @@ export class Visitor {
export function kindToString(kind: SyntaxKind): string { if (SyntaxKind[kind] === undefined) export function kindToString(kind: SyntaxKind): string { if (SyntaxKind[kind] === undefined)
throw new Error("The SyntaxKind value that was passed in was not found."); return SyntaxKind[kind]; } throw new Error("The SyntaxKind value that was passed in was not found."); return SyntaxKind[kind]; }
export type Syntax = EndOfFile | BoltStringLiteral | BoltIntegerLiteral | BoltIdentifier | 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 | BoltSourceFile | BoltQualName | BoltTypeOfExpression | BoltReferenceTypeExpression | BoltFunctionTypeExpression | BoltLiftedTypeExpression | BoltTypeParameter | BoltBindPattern | BoltTypePattern | BoltExpressionPattern | BoltTuplePatternElement | BoltTuplePattern | BoltRecordFieldPattern | BoltRecordPattern | BoltQuoteExpression | BoltTupleExpression | BoltReferenceExpression | BoltMemberExpression | BoltFunctionExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltCaseExpression | BoltBlockExpression | BoltConstantExpression | BoltReturnStatement | BoltConditionalCase | BoltConditionalStatement | BoltResumeStatement | BoltExpressionStatement | BoltLoopStatement | BoltParameter | BoltModule | BoltFunctionDeclaration | BoltVariableDeclaration | BoltPlainImportSymbol | BoltImportDirective | BoltPlainExportSymbol | BoltExportDirective | BoltTraitDeclaration | BoltImplDeclaration | BoltTypeAliasDeclaration | BoltRecordField | BoltRecordDeclaration | BoltMacroCall | JSIdentifier | JSString | JSInteger | JSFromKeyword | JSReturnKeyword | JSTryKeyword | JSFinallyKeyword | JSCatchKeyword | JSImportKeyword | JSAsKeyword | JSConstKeyword | JSLetKeyword | JSExportKeyword | JSFunctionKeyword | JSWhileKeyword | JSForKeyword | JSOperator | JSCloseBrace | JSCloseBracket | JSCloseParen | JSOpenBrace | JSOpenBracket | JSOpenParen | JSSemi | JSComma | JSDot | JSDotDotDot | JSMulOp | JSAddOp | JSDivOp | JSSubOp | JSLtOp | JSGtOp | JSBOrOp | JSBXorOp | JSBAndOp | JSBNotOp | JSNotOp | JSBindPattern | JSConstantExpression | JSMemberExpression | JSCallExpression | JSBinaryExpression | JSUnaryExpression | JSNewExpression | JSSequenceExpression | JSConditionalExpression | JSLiteralExpression | JSReferenceExpression | JSCatchBlock | JSTryCatchStatement | JSExpressionStatement | JSConditionalCase | JSConditionalStatement | JSReturnStatement | JSParameter | JSImportStarBinding | JSImportAsBinding | JSImportDeclaration | JSFunctionDeclaration | JSArrowFunctionDeclaration | JSLetDeclaration | JSSourceFile; export type Syntax = EndOfFile | BoltStringLiteral | BoltIntegerLiteral | BoltIdentifier | 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 | BoltSourceFile | BoltQualName | BoltTypeOfExpression | BoltReferenceTypeExpression | BoltFunctionTypeExpression | BoltLiftedTypeExpression | BoltTypeParameter | BoltBindPattern | BoltTypePattern | BoltExpressionPattern | BoltTuplePatternElement | BoltTuplePattern | BoltRecordFieldPattern | BoltRecordPattern | BoltRecordExpression | BoltRecordFieldValue | BoltQuoteExpression | BoltTupleExpression | BoltReferenceExpression | BoltMemberExpression | BoltFunctionExpression | BoltCallExpression | BoltYieldExpression | BoltMatchArm | BoltMatchExpression | BoltCase | BoltCaseExpression | BoltBlockExpression | BoltConstantExpression | BoltReturnStatement | BoltConditionalCase | BoltConditionalStatement | BoltResumeStatement | BoltExpressionStatement | BoltAssignStatement | BoltLoopStatement | BoltParameter | BoltModule | BoltFunctionDeclaration | BoltVariableDeclaration | BoltPlainImportSymbol | BoltImportDirective | BoltPlainExportSymbol | BoltExportDirective | BoltTraitDeclaration | BoltImplDeclaration | BoltTypeAliasDeclaration | BoltRecordDeclarationField | BoltRecordDeclaration | BoltMacroCall | JSIdentifier | JSString | JSInteger | JSFromKeyword | JSReturnKeyword | JSTryKeyword | JSFinallyKeyword | JSCatchKeyword | JSImportKeyword | JSAsKeyword | JSConstKeyword | JSLetKeyword | JSExportKeyword | JSFunctionKeyword | JSWhileKeyword | JSForKeyword | JSOperator | JSCloseBrace | JSCloseBracket | JSCloseParen | JSOpenBrace | JSOpenBracket | JSOpenParen | JSSemi | JSComma | JSDot | JSDotDotDot | JSMulOp | JSAddOp | JSDivOp | JSSubOp | JSLtOp | JSGtOp | JSBOrOp | JSBXorOp | JSBAndOp | JSBNotOp | JSNotOp | JSBindPattern | JSConstantExpression | JSMemberExpression | JSCallExpression | JSBinaryExpression | JSUnaryExpression | JSNewExpression | JSSequenceExpression | JSConditionalExpression | JSLiteralExpression | JSReferenceExpression | JSCatchBlock | JSTryCatchStatement | JSExpressionStatement | JSConditionalCase | JSConditionalStatement | JSReturnStatement | JSParameter | JSImportStarBinding | JSImportAsBinding | JSImportDeclaration | JSFunctionDeclaration | JSArrowFunctionDeclaration | JSLetDeclaration | JSSourceFile;
export const NODE_TYPES = { EndOfFile, BoltStringLiteral, BoltIntegerLiteral, BoltIdentifier, 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, BoltSourceFile, BoltQualName, BoltTypeOfExpression, BoltReferenceTypeExpression, BoltFunctionTypeExpression, BoltLiftedTypeExpression, BoltTypeParameter, BoltBindPattern, BoltTypePattern, BoltExpressionPattern, BoltTuplePatternElement, BoltTuplePattern, BoltRecordFieldPattern, BoltRecordPattern, BoltQuoteExpression, BoltTupleExpression, BoltReferenceExpression, BoltMemberExpression, BoltFunctionExpression, BoltCallExpression, BoltYieldExpression, BoltMatchArm, BoltMatchExpression, BoltCase, BoltCaseExpression, BoltBlockExpression, BoltConstantExpression, BoltReturnStatement, BoltConditionalCase, BoltConditionalStatement, BoltResumeStatement, BoltExpressionStatement, BoltLoopStatement, BoltParameter, BoltModule, BoltFunctionDeclaration, BoltVariableDeclaration, BoltPlainImportSymbol, BoltImportDirective, BoltPlainExportSymbol, BoltExportDirective, BoltTraitDeclaration, BoltImplDeclaration, BoltTypeAliasDeclaration, BoltRecordField, BoltRecordDeclaration, BoltMacroCall, JSIdentifier, JSString, JSInteger, JSFromKeyword, JSReturnKeyword, JSTryKeyword, JSFinallyKeyword, JSCatchKeyword, JSImportKeyword, JSAsKeyword, JSConstKeyword, JSLetKeyword, JSExportKeyword, JSFunctionKeyword, JSWhileKeyword, JSForKeyword, JSOperator, JSCloseBrace, JSCloseBracket, JSCloseParen, JSOpenBrace, JSOpenBracket, JSOpenParen, JSSemi, JSComma, JSDot, JSDotDotDot, JSMulOp, JSAddOp, JSDivOp, JSSubOp, JSLtOp, JSGtOp, JSBOrOp, JSBXorOp, JSBAndOp, JSBNotOp, JSNotOp, JSBindPattern, JSConstantExpression, JSMemberExpression, JSCallExpression, JSBinaryExpression, JSUnaryExpression, JSNewExpression, JSSequenceExpression, JSConditionalExpression, JSLiteralExpression, JSReferenceExpression, JSCatchBlock, JSTryCatchStatement, JSExpressionStatement, JSConditionalCase, JSConditionalStatement, JSReturnStatement, JSParameter, JSImportStarBinding, JSImportAsBinding, JSImportDeclaration, JSFunctionDeclaration, JSArrowFunctionDeclaration, JSLetDeclaration, JSSourceFile }; export const NODE_TYPES = { EndOfFile, BoltStringLiteral, BoltIntegerLiteral, BoltIdentifier, 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, BoltSourceFile, BoltQualName, BoltTypeOfExpression, BoltReferenceTypeExpression, BoltFunctionTypeExpression, BoltLiftedTypeExpression, BoltTypeParameter, BoltBindPattern, BoltTypePattern, BoltExpressionPattern, BoltTuplePatternElement, BoltTuplePattern, BoltRecordFieldPattern, BoltRecordPattern, BoltRecordExpression, BoltRecordFieldValue, BoltQuoteExpression, BoltTupleExpression, BoltReferenceExpression, BoltMemberExpression, BoltFunctionExpression, BoltCallExpression, BoltYieldExpression, BoltMatchArm, BoltMatchExpression, BoltCase, BoltCaseExpression, BoltBlockExpression, BoltConstantExpression, BoltReturnStatement, BoltConditionalCase, BoltConditionalStatement, BoltResumeStatement, BoltExpressionStatement, BoltAssignStatement, BoltLoopStatement, BoltParameter, BoltModule, BoltFunctionDeclaration, BoltVariableDeclaration, BoltPlainImportSymbol, BoltImportDirective, BoltPlainExportSymbol, BoltExportDirective, BoltTraitDeclaration, BoltImplDeclaration, BoltTypeAliasDeclaration, BoltRecordDeclarationField, BoltRecordDeclaration, BoltMacroCall, JSIdentifier, JSString, JSInteger, JSFromKeyword, JSReturnKeyword, JSTryKeyword, JSFinallyKeyword, JSCatchKeyword, JSImportKeyword, JSAsKeyword, JSConstKeyword, JSLetKeyword, JSExportKeyword, JSFunctionKeyword, JSWhileKeyword, JSForKeyword, JSOperator, JSCloseBrace, JSCloseBracket, JSCloseParen, JSOpenBrace, JSOpenBracket, JSOpenParen, JSSemi, JSComma, JSDot, JSDotDotDot, JSMulOp, JSAddOp, JSDivOp, JSSubOp, JSLtOp, JSGtOp, JSBOrOp, JSBXorOp, JSBAndOp, JSBNotOp, JSNotOp, JSBindPattern, JSConstantExpression, JSMemberExpression, JSCallExpression, JSBinaryExpression, JSUnaryExpression, JSNewExpression, JSSequenceExpression, JSConditionalExpression, JSLiteralExpression, JSReferenceExpression, JSCatchBlock, JSTryCatchStatement, JSExpressionStatement, JSConditionalCase, JSConditionalStatement, JSReturnStatement, JSParameter, JSImportStarBinding, JSImportAsBinding, JSImportDeclaration, JSFunctionDeclaration, JSArrowFunctionDeclaration, JSLetDeclaration, JSSourceFile };
export enum SyntaxKind { export enum SyntaxKind {
EndOfFile, EndOfFile,
@ -3348,6 +3413,8 @@ export enum SyntaxKind {
BoltTuplePattern, BoltTuplePattern,
BoltRecordFieldPattern, BoltRecordFieldPattern,
BoltRecordPattern, BoltRecordPattern,
BoltRecordExpression,
BoltRecordFieldValue,
BoltQuoteExpression, BoltQuoteExpression,
BoltTupleExpression, BoltTupleExpression,
BoltReferenceExpression, BoltReferenceExpression,
@ -3366,6 +3433,7 @@ export enum SyntaxKind {
BoltConditionalStatement, BoltConditionalStatement,
BoltResumeStatement, BoltResumeStatement,
BoltExpressionStatement, BoltExpressionStatement,
BoltAssignStatement,
BoltLoopStatement, BoltLoopStatement,
BoltParameter, BoltParameter,
BoltModule, BoltModule,
@ -3378,7 +3446,7 @@ export enum SyntaxKind {
BoltTraitDeclaration, BoltTraitDeclaration,
BoltImplDeclaration, BoltImplDeclaration,
BoltTypeAliasDeclaration, BoltTypeAliasDeclaration,
BoltRecordField, BoltRecordDeclarationField,
BoltRecordDeclaration, BoltRecordDeclaration,
BoltMacroCall, BoltMacroCall,
JSIdentifier, JSIdentifier,

File diff suppressed because it is too large Load diff

View file

@ -144,18 +144,18 @@ export class CheckTypeAssignments extends Visitor {
} }
//export class CheckTypeAssignments extends NodeVisitor { //export class CheckTypeAssignments extends NodeVisitor {
//
// constructor( // constructor(
// @inject private diagnostics: DiagnosticPrinter, // @inject private diagnostics: DiagnosticPrinter,
// @inject private checker: TypeChecker, // @inject private checker: TypeChecker,
// ) { // ) {
// super(); // super();
// } // }
//
// protected visitBoltReturnStatement(node: BoltReturnStatement) { // protected visitBoltReturnStatement(node: BoltReturnStatement) {
//
// const fnDecl = node.getParentOfKind(SyntaxKind.BoltFunctionDeclaration)!; // const fnDecl = node.getParentOfKind(SyntaxKind.BoltFunctionDeclaration)!;
//
// if ((this.checker.isVoidType(node) && !this.checker.isVoidType(fnDecl)) { // if ((this.checker.isVoidType(node) && !this.checker.isVoidType(fnDecl)) {
// this.diagnostics.add({ // this.diagnostics.add({
// message: E_MUST_RETURN_A_VALUE, // message: E_MUST_RETURN_A_VALUE,
@ -177,9 +177,9 @@ export class CheckTypeAssignments extends Visitor {
// }); // });
// } // }
// } // }
//
// } // }
//
// protected visitBoltParameter(node: BoltParameter) { // protected visitBoltParameter(node: BoltParameter) {
// if (node.defaultValue !== null) { // if (node.defaultValue !== null) {
// for (const error of this.checker.checkAssignment(node.bindings, node.defaultValue)) { // for (const error of this.checker.checkAssignment(node.bindings, node.defaultValue)) {
@ -191,7 +191,7 @@ export class CheckTypeAssignments extends Visitor {
// } // }
// } // }
// } // }
//
// protected visitBoltCallExpression(node: BoltCallExpression) { // protected visitBoltCallExpression(node: BoltCallExpression) {
// for (const fnDecl of this.checker.getCallableFunctions(node)) { // for (const fnDecl of this.checker.getCallableFunctions(node)) {
// for (const error of this.checker.checkAssignment(fnDecl, node)) { // for (const error of this.checker.checkAssignment(fnDecl, node)) {
@ -203,5 +203,5 @@ export class CheckTypeAssignments extends Visitor {
// } // }
// } // }
// } // }
//
//} //}

View file

@ -14,10 +14,11 @@ import {
BoltSyntax, BoltSyntax,
BoltModifiers, BoltModifiers,
ReturnStatement, ReturnStatement,
FunctionBodyElement FunctionBodyElement,
BoltToken
} from "./ast"; } from "./ast";
import { BOLT_SUPPORTED_LANGUAGES } from "./constants" import { BOLT_SUPPORTED_LANGUAGES } from "./constants"
import { FastStringMap, enumOr, escapeChar, assert, registerClass, Newable } from "./util"; import { FastStringMap, enumOr, escapeChar, assert, registerClass, Newable, GeneratorStream } from "./util";
import { TextSpan, TextPos, TextFile } from "./text"; import { TextSpan, TextPos, TextFile } from "./text";
import { Scanner } from "./scanner"; import { Scanner } from "./scanner";
import { convertNodeToSymbolPath, SymbolPath } from "./resolver"; import { convertNodeToSymbolPath, SymbolPath } from "./resolver";
@ -58,7 +59,8 @@ export function createTokenStream(node: Syntax) {
if (isBoltPunctuated(node)) { if (isBoltPunctuated(node)) {
const origPos = node.span!.start; const origPos = node.span!.start;
const startPos = new TextPos(origPos.offset+1, origPos.line, origPos.column+1); const startPos = new TextPos(origPos.offset+1, origPos.line, origPos.column+1);
return new Scanner(node.span!.file, node.text, startPos); const scanner = new Scanner(node.span!.file, node.text, startPos);
return new GeneratorStream<BoltToken>(() => scanner.scan());
} else { } else {
throw new Error(`Could not convert ${kindToString(node.kind)} to a token stream.`); throw new Error(`Could not convert ${kindToString(node.kind)} to a token stream.`);
} }
@ -146,6 +148,10 @@ export class ParseError extends Error {
} }
} }
export class HardParseError extends ParseError {
}
export interface OperatorInfo { export interface OperatorInfo {
kind: OperatorKind; kind: OperatorKind;
arity: number; arity: number;
@ -153,11 +159,15 @@ export interface OperatorInfo {
precedence: number; precedence: number;
} }
export function assertToken(node: Token, kind: SyntaxKind) { export function assertToken(node: Token, kind: SyntaxKind, isHardError = false) {
if (node.kind !== kind) { if (node.kind !== kind) {
if (isHardError) {
throw new HardParseError(node, [kind]);
} else {
throw new ParseError(node, [kind]); throw new ParseError(node, [kind]);
} }
} }
}
type OperatorTableList = [OperatorKind, number, string][][]; type OperatorTableList = [OperatorKind, number, string][][];
@ -382,6 +392,8 @@ export function describeKind(kind: SyntaxKind): string {
return "'try'"; return "'try'";
case SyntaxKind.BoltRArrowAlt: case SyntaxKind.BoltRArrowAlt:
return "'=>'"; return "'=>'";
case SyntaxKind.BoltBraced:
return "'{ ... }'";
default: default:
throw new Error(`failed to describe ${kindToString(kind)}`) throw new Error(`failed to describe ${kindToString(kind)}`)
} }

View file

@ -22,8 +22,10 @@ export const E_FIELD_MUST_BE_BOOLEAN = "Field '{name}' must be a either 'true' o
export const E_TYPE_DECLARATION_NOT_FOUND = "A type declaration named '{name}' was not found." export const E_TYPE_DECLARATION_NOT_FOUND = "A type declaration named '{name}' was not found."
export const E_DECLARATION_NOT_FOUND = "Reference to an undefined declaration '{name}'."; export const E_DECLARATION_NOT_FOUND = "Reference to an undefined declaration '{name}'.";
export const E_TYPE_MISMATCH = "Types {left} and {right} are not semantically equivalent."; export const E_TYPE_MISMATCH = "Types {left} and {right} are not semantically equivalent.";
export const E_THIS_NODE_CAUSED_INVALID_TYPE = "This node resolved to the type {type}, which caused type matching to fail."
export const E_TOO_FEW_ARGUMENTS_FOR_FUNCTION_CALL = "Too few arguments for function call. Expected {expected} but got {actual}."; export const E_TOO_FEW_ARGUMENTS_FOR_FUNCTION_CALL = "Too few arguments for function call. Expected {expected} but got {actual}.";
export const E_TOO_MANY_ARGUMENTS_FOR_FUNCTION_CALL = "Too many arguments for function call. Expected {expected} but got {actual}."; export const E_TOO_MANY_ARGUMENTS_FOR_FUNCTION_CALL = "Too many arguments for function call. Expected {expected} but got {actual}.";
export const E_NOT_CALLABLE = "The result of this expression is not callable."
export const E_CANDIDATE_FUNCTION_REQUIRES_THIS_PARAMETER = "Candidate function requires this parameter." export const E_CANDIDATE_FUNCTION_REQUIRES_THIS_PARAMETER = "Candidate function requires this parameter."
export const E_ARGUMENT_HAS_NO_CORRESPONDING_PARAMETER = "This argument is missing a corresponding parameter." export const E_ARGUMENT_HAS_NO_CORRESPONDING_PARAMETER = "This argument is missing a corresponding parameter."
export const E_INVALID_ARGUMENTS = "Invalid arguments passed to function '{name}'" export const E_INVALID_ARGUMENTS = "Invalid arguments passed to function '{name}'"
@ -33,6 +35,8 @@ export const E_NODE_DOES_NOT_CONTAIN_MEMBER = "This node does not contain the th
export const E_MAY_NOT_RETURN_BECAUSE_TYPE_RESOLVES_TO_VOID = "May not return a value because the function's return type resolves to '()'" export const E_MAY_NOT_RETURN_BECAUSE_TYPE_RESOLVES_TO_VOID = "May not return a value because the function's return type resolves to '()'"
export const E_MUST_RETURN_BECAUSE_TYPE_DOES_NOT_RESOLVE_TO_VOID = "Must return a value because the function's return type does not resolve to '()'" export const E_MUST_RETURN_BECAUSE_TYPE_DOES_NOT_RESOLVE_TO_VOID = "Must return a value because the function's return type does not resolve to '()'"
export const E_ARGUMENT_TYPE_NOT_ASSIGNABLE = "This argument's type is not assignable to the function's parameter type." export const E_ARGUMENT_TYPE_NOT_ASSIGNABLE = "This argument's type is not assignable to the function's parameter type."
export const E_PARAMETER_DECLARED_HERE = "Function parameter was declared here."
export const E_BUILTIN_TYPE_MISSING = "A built-in type named '{name}' in the prelude."
export const TYPE_ERROR_MESSAGES = [ export const TYPE_ERROR_MESSAGES = [
E_TOO_FEW_ARGUMENTS_FOR_FUNCTION_CALL, E_TOO_FEW_ARGUMENTS_FOR_FUNCTION_CALL,
@ -109,6 +113,7 @@ export class DiagnosticPrinter {
case 'fatal': case 'fatal':
this.hasFatal = true; this.hasFatal = true;
out += chalk.bold.red('fatal:' ); out += chalk.bold.red('fatal:' );
break;
case 'warning': case 'warning':
this.hasErrors = true; this.hasErrors = true;
out += chalk.bold.red('warning: '); out += chalk.bold.red('warning: ');

View file

@ -2,7 +2,7 @@
import { Syntax, SyntaxKind, BoltQualName, BoltExpression, kindToString, BoltSyntax, isBoltStatement } from "./ast" import { Syntax, SyntaxKind, BoltQualName, BoltExpression, kindToString, BoltSyntax, isBoltStatement } from "./ast"
import { FastStringMap, assert } from "./util" import { FastStringMap, assert } from "./util"
import { emitNode } from "./emitter"; import { emitNode } from "./emitter";
import { Type, TypeChecker, RecordType } from "./types"; import { TypeChecker } from "./checker";
export class Record { export class Record {

View file

@ -6,8 +6,8 @@ import { sync as globSync } from "glob"
import { Program } from "./program" import { Program } from "./program"
import { emitNode } from "./emitter" import { emitNode } from "./emitter"
import { Syntax, BoltSourceFile, SourceFile, setParents, kindToString, Visitor } from "./ast" import { Syntax, BoltSourceFile, SourceFile, setParents, kindToString, Visitor, BoltToken } from "./ast"
import { getFileStem, MapLike, assert, FastStringMap, upsearchSync } from "./util" import { getFileStem, MapLike, assert, FastStringMap, upsearchSync, GeneratorStream } from "./util"
import { verbose, memoize } from "./util" import { verbose, memoize } from "./util"
import { Container, Newable } from "./ioc" import { Container, Newable } from "./ioc"
import ExpandBoltTransform from "./transforms/expand" import ExpandBoltTransform from "./transforms/expand"
@ -15,7 +15,7 @@ import CompileBoltToJSTransform from "./transforms/boltToJS"
import ConstFoldTransform from "./transforms/constFold" import ConstFoldTransform from "./transforms/constFold"
import { TransformManager } from "./transforms/index" import { TransformManager } from "./transforms/index"
import {DiagnosticPrinter, E_PARSE_ERROR, E_STDLIB_NOT_FOUND, E_SSCAN_ERROR as E_SCAN_ERROR, E_NO_BOLTFILE_FOUND_IN_PATH_OR_PARENT_DIRS} from "./diagnostics" import {DiagnosticPrinter, E_PARSE_ERROR, E_STDLIB_NOT_FOUND, E_SSCAN_ERROR as E_SCAN_ERROR, E_NO_BOLTFILE_FOUND_IN_PATH_OR_PARENT_DIRS} from "./diagnostics"
import { TypeChecker } from "./types" import { TypeChecker } from "./checker"
import { CheckInvalidFilePaths, CheckTypeAssignments, CheckReferences } from "./checks" import { CheckInvalidFilePaths, CheckTypeAssignments, CheckReferences } from "./checks"
import { SymbolResolver, BoltSymbolResolutionStrategy } from "./resolver" import { SymbolResolver, BoltSymbolResolutionStrategy } from "./resolver"
import { Evaluator } from "./evaluator" import { Evaluator } from "./evaluator"
@ -86,7 +86,7 @@ export class Frontend {
public check(program: Program) { public check(program: Program) {
const resolver = new SymbolResolver(program, new BoltSymbolResolutionStrategy); const resolver = new SymbolResolver(program, new BoltSymbolResolutionStrategy);
const checker = new TypeChecker(resolver); const checker = new TypeChecker(resolver, this.diagnostics);
const container = new Container(); const container = new Container();
container.bindSelf(program); container.bindSelf(program);
@ -108,7 +108,9 @@ export class Frontend {
for (const sourceFile of program.getAllSourceFiles()) { for (const sourceFile of program.getAllSourceFiles()) {
checker.registerSourceFile(sourceFile); checker.registerSourceFile(sourceFile);
} }
checker.solve(program.getAllSourceFiles()); checker.solve(program.getAllSourceFiles());
for (const pkg of program.getAllPackages()) { for (const pkg of program.getAllPackages()) {
if (!pkg.isDependency) { if (!pkg.isDependency) {
for (const sourceFile of pkg.getAllSourceFiles()) { for (const sourceFile of pkg.getAllSourceFiles()) {
@ -161,7 +163,7 @@ export class Frontend {
public eval(program: Program) { public eval(program: Program) {
const resolver = new SymbolResolver(program, new BoltSymbolResolutionStrategy); const resolver = new SymbolResolver(program, new BoltSymbolResolutionStrategy);
const checker = new TypeChecker(resolver); const checker = new TypeChecker(resolver, this.diagnostics);
const evaluator = new Evaluator(checker) const evaluator = new Evaluator(checker)
for (const sourceFile of program.getAllSourceFiles()) { for (const sourceFile of program.getAllSourceFiles()) {
evaluator.eval(sourceFile) evaluator.eval(sourceFile)
@ -173,11 +175,12 @@ export class Frontend {
const file = new TextFile(filepath); const file = new TextFile(filepath);
const contents = fs.readFileSync(file.origPath, 'utf8'); const contents = fs.readFileSync(file.origPath, 'utf8');
const scanner = new Scanner(file, contents) const scanner = new Scanner(file, contents)
const tokens = new GeneratorStream<BoltToken>(() => scanner.scan());
const parser = new Parser(); const parser = new Parser();
let sourceFile; let sourceFile;
try { try {
sourceFile = parser.parseSourceFile(scanner, pkg); sourceFile = parser.parseSourceFile(tokens, pkg);
} catch (e) { } catch (e) {
if (e instanceof ScanError) { if (e instanceof ScanError) {
this.diagnostics.add({ this.diagnostics.add({

View file

@ -23,7 +23,6 @@ import {
createBoltParameter, createBoltParameter,
BoltBindPattern, BoltBindPattern,
createBoltRecordDeclaration, createBoltRecordDeclaration,
createBoltRecordField,
createBoltImportDirective, createBoltImportDirective,
BoltModifiers, BoltModifiers,
BoltStringLiteral, BoltStringLiteral,
@ -79,6 +78,15 @@ import {
BoltQualName, BoltQualName,
BoltLoopStatement, BoltLoopStatement,
createBoltLoopStatement, createBoltLoopStatement,
createBoltRecordDeclarationField,
createBoltRecordExpression,
BoltRecordExpressionElement,
createBoltRecordFieldValue,
BoltRecordExpression,
BoltForKeyword,
BoltBraced,
BoltAssignStatement,
createBoltAssignStatement,
} from "./ast" } from "./ast"
import { parseForeignLanguage } from "./foreign" import { parseForeignLanguage } from "./foreign"
@ -91,12 +99,14 @@ import {
setOrigNodeRange, setOrigNodeRange,
createTokenStream, createTokenStream,
} from "./common" } from "./common"
import { Stream, uniq, assert } from "./util" import { Stream, uniq, assert, isInsideDirectory } from "./util"
import { Scanner } from "./scanner" import { Scanner } from "./scanner"
import { TextSpan, TextPos } from "./text" import { TextSpan, TextPos } from "./text"
import {JSScanner} from "./foreign/js/scanner"; import {JSScanner} from "./foreign/js/scanner";
import { Package } from "./package" import { Package } from "./package"
import { Syntax } from "./ast-spec"
import { resourceUsage } from "process"
export type BoltTokenStream = Stream<BoltToken>; export type BoltTokenStream = Stream<BoltToken>;
@ -166,7 +176,7 @@ function isRightAssoc(kind: OperatorKind): boolean {
export class Parser { export class Parser {
exprOperatorTable = new OperatorTable([ private exprOperatorTable = new OperatorTable([
[ [
[OperatorKind.InfixL, 2, '&&'], [OperatorKind.InfixL, 2, '&&'],
[OperatorKind.InfixL, 2, '||'] [OperatorKind.InfixL, 2, '||']
@ -357,7 +367,9 @@ export class Parser {
setOrigNodeRange(result, expr, expr); setOrigNodeRange(result, expr, expr);
return result; return result;
} else { } else {
throw new ParseError(t0, [SyntaxKind.BoltIdentifier]) const expected = KIND_EXPRESSION_T0.slice();
expected.push(SyntaxKind.BoltOperator);
throw new ParseError(t0, expected)
} }
} }
@ -606,12 +618,12 @@ export class Parser {
const arm = createBoltMatchArm(pattern, expression); const arm = createBoltMatchArm(pattern, expression);
setOrigNodeRange(arm, pattern, expression); setOrigNodeRange(arm, pattern, expression);
matchArms.push(arm); matchArms.push(arm);
const t4 = tokens.peek(); const t4 = innerTokens.peek();
if (t4.kind === SyntaxKind.EndOfFile) { if (t4.kind === SyntaxKind.EndOfFile) {
break; break;
} }
assertToken(t4, SyntaxKind.BoltComma); assertToken(t4, SyntaxKind.BoltComma);
tokens.get(); innerTokens.get();
} }
const result = createBoltMatchExpression(expr, matchArms); const result = createBoltMatchExpression(expr, matchArms);
setOrigNodeRange(result, t0, t1); setOrigNodeRange(result, t0, t1);
@ -663,8 +675,100 @@ export class Parser {
return result; return result;
} }
private parseRecordExpression(tokens: BoltTokenStream): BoltRecordExpression {
const typeRef = this.parseReferenceTypeExpression(tokens);
const t1 = tokens.get();
assertToken(t1, SyntaxKind.BoltBraced);
const innerTokens = createTokenStream(t1);
const fields: BoltRecordExpressionElement[] = [];
while (true) {
let name;
let value = null;
const t1 = innerTokens.get();
if (t1.kind === SyntaxKind.EndOfFile) {
break;
}
assertToken(t1, SyntaxKind.BoltIdentifier);
name = t1 as BoltIdentifier
const t2 = innerTokens.peek();
if (t2.kind === SyntaxKind.BoltColon) {
innerTokens.get();
value = this.parseExpression(innerTokens);
}
const t3 = innerTokens.peek();
if (t3.kind === SyntaxKind.BoltComma) {
innerTokens.get();
} else {
assertToken(t3, SyntaxKind.EndOfFile)
}
const element = createBoltRecordFieldValue(name, value);
fields.push(element);
}
const result = createBoltRecordExpression(
typeRef,
fields
);
setOrigNodeRange(result, typeRef, t1)
return result;
}
private getTokenAfterTypeRef(tokens: BoltTokenStream, i = 1): number {
// Peek actual qualified name
let t0 = tokens.peek(i);
if (t0.kind === SyntaxKind.BoltColonColon) {
i++;
t0 = tokens.peek(i);
}
if (t0.kind !== SyntaxKind.BoltIdentifier) {
return -1;
}
i++;
while (tokens.peek(i).kind === SyntaxKind.BoltColonColon) {
i++;
if (tokens.peek(i).kind !== SyntaxKind.BoltIdentifier) {
return -1;
}
}
// Peek anything that comes between '<' and '>'
const t2 = tokens.peek(i);
if (t2.kind === SyntaxKind.BoltLtSign) {
let count = 1;
i++;
while (count > 0) {
const t3 = tokens.peek(i++);
if (t3.kind === SyntaxKind.BoltLtSign) {
count++;
}
if (t3.kind === SyntaxKind.BoltGtSign) {
count--;
}
}
}
// Return wherever position we landed
return i;
}
private parseExpression(tokens: BoltTokenStream): BoltExpression { private parseExpression(tokens: BoltTokenStream): BoltExpression {
try {
const forked = tokens.fork();
const recordExpr = this.parseRecordExpression(forked);
tokens.join(forked);
return recordExpr;
} catch (e) {
if (!(e instanceof ParseError)) {
throw e;
}
}
const t0 = tokens.peek(); const t0 = tokens.peek();
let result; let result;
@ -686,9 +790,13 @@ export class Parser {
while (true) { while (true) {
// FIXME The following expression is incorrectly parsed: 0..fac()
let t2 = tokens.peek(); let t2 = tokens.peek();
const firstToken = t2; const firstToken = t2;
// Parse all path elements of the member expression: a.foo.bar
const path: BoltIdentifier[] = []; const path: BoltIdentifier[] = [];
while (t2.kind === SyntaxKind.BoltDot) { while (t2.kind === SyntaxKind.BoltDot) {
@ -842,6 +950,16 @@ export class Parser {
return node; return node;
} }
public parseAsssignStatement(tokens: BoltTokenStream): BoltAssignStatement {
const pattern = this.parsePattern(tokens);
const t1 = tokens.get();
assertToken(t1, SyntaxKind.BoltEqSign);
const expr = this.parseExpression(tokens);
const result = createBoltAssignStatement(pattern, expr);
setOrigNodeRange(result, pattern, expr);
return result;
}
public parseLoopStatement(tokens: BoltTokenStream): BoltLoopStatement { public parseLoopStatement(tokens: BoltTokenStream): BoltLoopStatement {
const t0 = tokens.get(); const t0 = tokens.get();
assertToken(t0, SyntaxKind.BoltLoopKeyword); assertToken(t0, SyntaxKind.BoltLoopKeyword);
@ -855,6 +973,18 @@ export class Parser {
} }
public parseStatement(tokens: BoltTokenStream): BoltStatement { public parseStatement(tokens: BoltTokenStream): BoltStatement {
try {
const forked = tokens.fork();
const result = this.parseAsssignStatement(forked);
tokens.join(forked);
return result;
} catch (e) {
if (!(e instanceof ParseError)) {
throw e;
}
}
// if (this.lookaheadIsMacroCall(tokens)) { // if (this.lookaheadIsMacroCall(tokens)) {
// return this.parseMacroCall(tokens); // return this.parseMacroCall(tokens);
// } // }
@ -960,7 +1090,7 @@ export class Parser {
const t4 = innerTokens.get(); const t4 = innerTokens.get();
assertToken(t4, SyntaxKind.BoltColon); assertToken(t4, SyntaxKind.BoltColon);
const type = this.parseTypeExpression(innerTokens); const type = this.parseTypeExpression(innerTokens);
const field = createBoltRecordField(name as BoltIdentifier, type); const field = createBoltRecordDeclarationField(name as BoltIdentifier, type);
const t5 = innerTokens.get(); const t5 = innerTokens.get();
if (t5.kind === SyntaxKind.EndOfFile) { if (t5.kind === SyntaxKind.EndOfFile) {
break; break;

View file

@ -124,7 +124,6 @@ function isSymbol(ch: string) {
export class Scanner { export class Scanner {
private buffer: string[] = []; private buffer: string[] = [];
private scanned: BoltToken[] = [];
private currPos: TextPos; private currPos: TextPos;
private offset = 0; private offset = 0;
@ -470,18 +469,5 @@ export class Scanner {
return text; return text;
} }
public peek(count = 1): BoltToken {
while (this.scanned.length < count) {
this.scanned.push(this.scan());
}
return this.scanned[count - 1];
}
public get(): BoltToken {
return this.scanned.length > 0
? this.scanned.shift()!
: this.scan();
}
} }

View file

@ -1,4 +1,4 @@
import { AnyType, UnionType } from "../types" import { AnyType, UnionType } from "../checker"
import { createBoltIdentifier } from "../ast"; import { createBoltIdentifier } from "../ast";

View file

@ -1,5 +1,5 @@
import { TypeChecker } from "../types" import { TypeChecker } from "../checker"
import { import {
Syntax, Syntax,

View file

@ -11,7 +11,7 @@ import {
BoltSourceFile, BoltSourceFile,
} from "../ast" } from "../ast"
import { TypeChecker } from "../types" import { TypeChecker } from "../checker"
import { BoltTokenStream, Parser, isModifierKeyword } from "../parser" import { BoltTokenStream, Parser, isModifierKeyword } from "../parser"
import { Evaluator } from "../evaluator" import { Evaluator } from "../evaluator"
import { Transformer, TransformManager } from "./index" import { Transformer, TransformManager } from "./index"

View file

@ -6,6 +6,7 @@ import * as os from "os"
import moment from "moment" import moment from "moment"
import chalk from "chalk" import chalk from "chalk"
import { LOG_DATETIME_FORMAT } from "./constants" import { LOG_DATETIME_FORMAT } from "./constants"
import { timeStamp } from "console"
export function isPowerOf(x: number, n: number):boolean { export function isPowerOf(x: number, n: number):boolean {
const a = Math.log(x) / Math.log(n); const a = Math.log(x) / Math.log(n);
@ -276,68 +277,79 @@ export function deserializable() {
} }
} }
//export type TransparentProxy<T> = T & { updateHandle(value: T): void } export type Ref<T extends object = any> = T & {
replaceWith(value: T): void;
cloneRef(): Ref<T>;
}
//export function createTransparentProxy<T extends object>(value: T): TransparentProxy<T> { const refSymbolTag = Symbol('is reference');
// const handlerObject = {
// __HANDLE: value, export function isRef<T extends object>(value: T): value is Ref<T> {
// __IS_HANDLE: true, return typeof(value) === 'object'
// updateHandle(newValue: T) { && value !== null
// if (newValue.__IS_HANDLE) { && (value as any)[refSymbolTag] !== undefined
// newValue = newValue.__HANDLE; }
// }
// value = newValue; export function createRef<T extends object>(value: T): Ref<T> {
// handlerObject.__HANDLE = newValue; return new Proxy<any>({
// } [refSymbolTag]: { value },
// }; replaceWith(newValue: T) {
// return new Proxy<any>({}, { this[refSymbolTag].value = isRef(newValue) ? (newValue as any)[refSymbolTag].value : newValue;
// getPrototypeOf(target: T): object | null { },
// return Reflect.getPrototypeOf(value); cloneRef() {
// }, return createRef(this[refSymbolTag].value);
// setPrototypeOf(target: T, v: any): boolean { }
// return Reflect.setPrototypeOf(value, v); }, {
// }, getPrototypeOf(target: T): object | null {
// isExtensible(target: T): boolean { return Reflect.getPrototypeOf((target as any)[refSymbolTag].value);
// return Reflect.isExtensible(value); },
// }, setPrototypeOf(target: T, v: any): boolean {
// preventExtensions(target: T): boolean { return Reflect.setPrototypeOf((target as any)[refSymbolTag].value, v);
// return Reflect.preventExtensions(value); },
// }, isExtensible(target: T): boolean {
// getOwnPropertyDescriptor(target: T, p: PropertyKey): PropertyDescriptor | undefined { return Reflect.isExtensible((target as any)[refSymbolTag].value);
// return Reflect.getOwnPropertyDescriptor(value, p); },
// }, preventExtensions(target: T): boolean {
// has(target: T, p: PropertyKey): boolean { return Reflect.preventExtensions((target as any)[refSymbolTag].value);
// return Reflect.has(value, p); },
// }, getOwnPropertyDescriptor(target: T, p: PropertyKey): PropertyDescriptor | undefined {
// get(target: T, p: PropertyKey, receiver: any): any { return Reflect.getOwnPropertyDescriptor((target as any)[refSymbolTag].value, p);
// if (hasOwnProperty(handlerObject, p)) { },
// return Reflect.get(handlerObject, p); has(target: T, p: PropertyKey): boolean {
// } return Reflect.has((target as any)[refSymbolTag].value, p);
// return Reflect.get(value, p, receiver) },
// }, get(target: T, p: PropertyKey, receiver: any): any {
// set(target: T, p: PropertyKey, value: any, receiver: any): boolean { if (hasOwnProperty(target, p)) {
// return Reflect.set(value, p, value); return Reflect.get(target, p);
// }, }
// deleteProperty(target: T, p: PropertyKey): boolean { return Reflect.get((target as any)[refSymbolTag].value, p, receiver)
// return Reflect.deleteProperty(value, p); },
// }, set(target: T, p: PropertyKey, value: any, receiver: any): boolean {
// defineProperty(target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean { return Reflect.set((target as any)[refSymbolTag].value, p, value);
// return Reflect.defineProperty(value, p, attributes); },
// }, deleteProperty(target: T, p: PropertyKey): boolean {
// enumerate(target: T): PropertyKey[] { return Reflect.deleteProperty((target as any)[refSymbolTag].value, p);
// return [...Reflect.enumerate(value)]; },
// }, defineProperty(target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean {
// ownKeys(target: T): PropertyKey[] { return Reflect.defineProperty((target as any)[refSymbolTag].value, p, attributes);
// return Reflect.ownKeys(value); },
// }, enumerate(target: T): PropertyKey[] {
// apply(target: T, thisArg: any, argArray?: any): any { return [...Reflect.enumerate((target as any)[refSymbolTag].value)];
// return Reflect.apply(value as any, thisArg, argArray); },
// }, ownKeys(target: T): PropertyKey[] {
// construct(target: T, argArray: any, newTarget?: any): object { return Reflect.ownKeys((target as any)[refSymbolTag].value);
// return Reflect.construct(value as any, argArray, newTarget); },
// } apply(target: T, thisArg: any, argArray?: any): any {
// }); return Reflect.apply((target as any)[refSymbolTag].value as any, thisArg, argArray);
//} },
construct(target: T, argArray: any, newTarget?: any): object {
return Reflect.construct((target as any)[refSymbolTag].value as any, argArray, newTarget);
}
});
}
function delegate<T extends object, U extends object>(obj: T, handlerObject: U): T & U {
}
export const getKeyTag = Symbol('get key of object'); export const getKeyTag = Symbol('get key of object');
@ -353,14 +365,38 @@ function getKey(value: any): string {
} }
} }
class EmptyIterator implements IterableIterator<any> {
public [Symbol.iterator]() {
return this;
}
public next() {
return {
done: undefined,
value: undefined
} as IteratorYieldResult<any>;
}
}
export class FastMultiMap<K, V> { export class FastMultiMap<K, V> {
private mapping = Object.create(null); private mapping = Object.create(null);
public size = 0;
public clear(): void { public clear(): void {
this.mapping = Object.create(null); this.mapping = Object.create(null);
} }
public get(key: string): IterableIterator<V> {
if (this.mapping[key] === undefined) {
return new EmptyIterator;
}
return this.mapping[key][Symbol.iterator]();
}
public add(key: K, value: V) { public add(key: K, value: V) {
const keyStr = getKey(key); const keyStr = getKey(key);
if (keyStr in this.mapping) { if (keyStr in this.mapping) {
@ -368,6 +404,19 @@ export class FastMultiMap<K, V> {
} else { } else {
this.mapping[keyStr] = [ value ] this.mapping[keyStr] = [ value ]
} }
this.size++;
}
public has(key: K): boolean {
return key in this.mapping;
}
public *[Symbol.iterator]() {
for (const key of Object.keys(this.mapping)) {
for (const element of this.mapping[key]) {
yield [key, element];
}
}
} }
} }
@ -490,17 +539,56 @@ export function memoize(hasher: (...args: any[]) => string) {
export interface Stream<T> { export interface Stream<T> {
get(): T; get(): T;
peek(count?: number): T; peek(count?: number): T;
fork(): Stream<T>;
join(forked: Stream<T>): void;
}
export class GeneratorStream<T> implements Stream<T> {
public constructor(
protected generate: () => T,
private buffer: T[] = [],
private offset = 0,
) {
}
public get() {
while (this.buffer.length <= this.offset) {
this.buffer.push(this.generate());
}
return this.buffer[this.offset++];
}
public peek(i = 1) {
const offset = this.offset + i;
while (this.buffer.length < offset) {
this.buffer.push(this.generate());
}
return this.buffer[offset-1];
}
public fork(): GeneratorStream<T> {
return new GeneratorStream(this.generate, this.buffer, this.offset);
}
public join(other: GeneratorStream<T>) {
this.offset = Math.max(this.offset, other.offset);
}
} }
export class StreamWrapper<T> { export class StreamWrapper<T> {
offset = 0 constructor(
protected data: T[],
constructor(protected data: T[], protected createSentry: () => T) { protected createSentry: () => T,
protected offset = 0
) {
} }
peek(count = 1) { public peek(count = 1) {
const offset = this.offset + (count - 1); const offset = this.offset + (count - 1);
if (offset >= this.data.length) { if (offset >= this.data.length) {
return this.createSentry(); return this.createSentry();
@ -508,13 +596,21 @@ export class StreamWrapper<T> {
return this.data[offset]; return this.data[offset];
} }
get() { public get() {
if (this.offset >= this.data.length) { if (this.offset >= this.data.length) {
return this.createSentry(); return this.createSentry();
} }
return this.data[this.offset++]; return this.data[this.offset++];
} }
public fork() {
return new StreamWrapper(this.data, this.createSentry, this.offset);
}
public join(other: StreamWrapper<T>) {
this.offset = Math.max(this.offset, other.offset);
}
} }
export const inspectTag = require('util').inspect.custom; export const inspectTag = require('util').inspect.custom;