Mark some AST members as optional
This commit is contained in:
parent
1948380eb2
commit
96c7f4fa52
|
@ -18,20 +18,18 @@ export interface Definition extends Node {
|
|||
|
||||
// A module contains members, including variables, functions, and/or classes.
|
||||
export interface Module extends Definition {
|
||||
kind: ModuleKind;
|
||||
members: ModuleMembers;
|
||||
kind: ModuleKind;
|
||||
members?: ModuleMembers;
|
||||
}
|
||||
export const moduleKind = "Module";
|
||||
export type ModuleKind = "Module";
|
||||
export type Modules = { [token: string /*symbols.Token*/]: Definition };
|
||||
export type Modules = { [token: string /*symbols.ModuleToken*/]: Module };
|
||||
|
||||
// A module member is a definition that belongs to a module.
|
||||
export interface ModuleMember extends Definition {
|
||||
access?: symbols.Accessibility;
|
||||
}
|
||||
export type ModuleMembers = { [token: string /*symbols.ModuleToken*/]: ModuleMember };
|
||||
|
||||
/* Classes */
|
||||
export type ModuleMembers = { [token: string /*symbols.Token*/]: ModuleMember };
|
||||
|
||||
// An export definition re-exports a definition from another module, possibly with a different name.
|
||||
export interface Export extends ModuleMember {
|
||||
|
@ -41,6 +39,8 @@ export interface Export extends ModuleMember {
|
|||
export const exportKind = "Export";
|
||||
export type ExportKind = "Export";
|
||||
|
||||
/* Classes */
|
||||
|
||||
// A class can be constructed to create an object, and exports properties, methods, and has a number of attributes.
|
||||
export interface Class extends ModuleMember {
|
||||
kind: ClassKind;
|
||||
|
@ -60,7 +60,7 @@ export interface ClassMember extends Definition {
|
|||
access?: symbols.ClassMemberAccessibility;
|
||||
static?: boolean;
|
||||
}
|
||||
export type ClassMembers = { [token: string /*symbols.TypeToken*/]: ClassMember };
|
||||
export type ClassMembers = { [token: string /*symbols.Token*/]: ClassMember };
|
||||
|
||||
/* Variables */
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ export type StringLiteralKind = "StringLiteral";
|
|||
// A array literal plus optional initialization.
|
||||
export interface ArrayLiteral extends Literal {
|
||||
kind: ArrayLiteralKind;
|
||||
type: symbols.TypeToken; // the type of array to produce.
|
||||
size?: Expression; // an optiojnal expression for the array size.
|
||||
type?: symbols.TypeToken; // the type of array to produce.
|
||||
size?: Expression; // an optional expression for the array size.
|
||||
elements?: Expression[]; // an optional array of element expressions to store into the array.
|
||||
}
|
||||
export const arrayLiteralKind = "ArrayLiteral";
|
||||
|
@ -57,7 +57,7 @@ export type ArrayLiteralKind = "ArrayLiteral";
|
|||
// An object literal plus optional initialization.
|
||||
export interface ObjectLiteral extends Literal {
|
||||
kind: ObjectLiteralKind;
|
||||
type: symbols.TypeToken; // the type of object to produce.
|
||||
type?: symbols.TypeToken; // the type of object to produce.
|
||||
properties?: ObjectLiteralProperty[]; // an optional array of property initializers.
|
||||
}
|
||||
export const objectLiteralKind = "ObjectLiteral";
|
||||
|
@ -137,7 +137,7 @@ export interface UnaryOperatorExpression extends Expression {
|
|||
kind: UnaryOperatorExpressionKind;
|
||||
operator: UnaryOperator; // the operator type.
|
||||
operand: Expression; // the right hand side operand.
|
||||
postfix: boolean; // whether this is a postifx operator (only legal for UnaryPfixOperator).
|
||||
postfix?: boolean; // whether this is a postifx operator (only legal for UnaryPfixOperator).
|
||||
}
|
||||
export const unaryOperatorExpressionKind = "UnaryOperatorExpression";
|
||||
export type UnaryOperatorExpressionKind = "UnaryOperatorExpression";
|
||||
|
|
|
@ -38,9 +38,9 @@ export const tryCatchFinallyKind = "TryCatchFinally";
|
|||
export type TryCatchFinallyKind = "TryCatchFinally";
|
||||
|
||||
export interface TryCatchBlock extends Node {
|
||||
kind: TryCatchBlockKind;
|
||||
exception: symbols.TypeToken;
|
||||
block: Block;
|
||||
kind: TryCatchBlockKind;
|
||||
block: Block;
|
||||
exception?: symbols.TypeToken;
|
||||
}
|
||||
export const tryCatchBlockKind = "TryCatchBlock";
|
||||
export type TryCatchBlockKind = "TryCatchBlock";
|
||||
|
@ -120,7 +120,8 @@ export type EmptyStatementKind = "EmptyStatement";
|
|||
|
||||
// Multiple statements in one (unlike a block, this doesn't introduce a new scope).
|
||||
export interface MultiStatement extends Statement {
|
||||
kind: MultiStatementKind;
|
||||
kind: MultiStatementKind;
|
||||
statements: Statement[];
|
||||
}
|
||||
export const multiStatementKind = "MultiStatement";
|
||||
export type MultiStatementKind = "MultiStatement";
|
||||
|
|
Loading…
Reference in a new issue