Skip to content

Commit

Permalink
fix: node types
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Sep 8, 2021
1 parent 6adf46e commit 31de974
Show file tree
Hide file tree
Showing 68 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion src/ast/nodes/ArrayExpression.ts
Expand Up @@ -13,7 +13,7 @@ import { ObjectEntity, ObjectProperty } from './shared/ObjectEntity';

export default class ArrayExpression extends NodeBase {
elements!: (ExpressionNode | SpreadElement | null)[];
type!: NodeType.tArrayExpression;
declare type: NodeType.tArrayExpression;
private objectEntity: ObjectEntity | null = null;

deoptimizePath(path: ObjectPath): void {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ArrayPattern.ts
Expand Up @@ -9,7 +9,7 @@ import { PatternNode } from './shared/Pattern';

export default class ArrayPattern extends NodeBase implements PatternNode {
elements!: (PatternNode | null)[];
type!: NodeType.tArrayPattern;
declare type: NodeType.tArrayPattern;

addExportedVariables(
variables: Variable[],
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ArrowFunctionExpression.ts
Expand Up @@ -19,7 +19,7 @@ export default class ArrowFunctionExpression extends NodeBase {
params!: PatternNode[];
preventChildBlockScope!: true;
scope!: ReturnValueScope;
type!: NodeType.tArrowFunctionExpression;
declare type: NodeType.tArrowFunctionExpression;
private deoptimizedReturn = false;

createScope(parentScope: Scope): void {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/AssignmentExpression.ts
Expand Up @@ -38,7 +38,7 @@ export default class AssignmentExpression extends NodeBase {
| '&='
| '**=';
right!: ExpressionNode;
type!: NodeType.tAssignmentExpression;
declare type: NodeType.tAssignmentExpression;
protected deoptimized = false;

hasEffects(context: HasEffectsContext): boolean {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/AssignmentPattern.ts
Expand Up @@ -13,7 +13,7 @@ import { PatternNode } from './shared/Pattern';
export default class AssignmentPattern extends NodeBase implements PatternNode {
left!: PatternNode;
right!: ExpressionNode;
type!: NodeType.tAssignmentPattern;
declare type: NodeType.tAssignmentPattern;
protected deoptimized = false;

addExportedVariables(
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/AwaitExpression.ts
Expand Up @@ -7,7 +7,7 @@ import { ExpressionNode, IncludeChildren, Node, NodeBase } from './shared/Node';

export default class AwaitExpression extends NodeBase {
argument!: ExpressionNode;
type!: NodeType.tAwaitExpression;
declare type: NodeType.tAwaitExpression;
protected deoptimized = false;

hasEffects(): boolean {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/BinaryExpression.ts
Expand Up @@ -49,7 +49,7 @@ export default class BinaryExpression extends NodeBase implements DeoptimizableE
left!: ExpressionNode;
operator!: keyof typeof binaryOperators;
right!: ExpressionNode;
type!: NodeType.tBinaryExpression;
declare type: NodeType.tBinaryExpression;

deoptimizeCache(): void {}

Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/BlockStatement.ts
Expand Up @@ -11,7 +11,7 @@ import { IncludeChildren, Node, StatementBase, StatementNode } from './shared/No

export default class BlockStatement extends StatementBase {
body!: StatementNode[];
type!: NodeType.tBlockStatement;
declare type: NodeType.tBlockStatement;

private deoptimizeBody!: boolean;
private directlyIncluded = false;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/BreakStatement.ts
Expand Up @@ -10,7 +10,7 @@ import { StatementBase } from './shared/Node';

export default class BreakStatement extends StatementBase {
label!: Identifier | null;
type!: NodeType.tBreakStatement;
declare type: NodeType.tBreakStatement;

hasEffects(context: HasEffectsContext): boolean {
if (this.label) {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/CallExpression.ts
Expand Up @@ -34,7 +34,7 @@ export default class CallExpression extends NodeBase implements DeoptimizableEnt
arguments!: (ExpressionNode | SpreadElement)[];
callee!: ExpressionNode | Super;
optional!: boolean;
type!: NodeType.tCallExpression;
declare type: NodeType.tCallExpression;
protected deoptimized = false;
private callOptions!: CallOptions;
private deoptimizableDependentExpressions: DeoptimizableEntity[] = [];
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/CatchClause.ts
Expand Up @@ -11,7 +11,7 @@ export default class CatchClause extends NodeBase {
param!: PatternNode | null;
preventChildBlockScope!: true;
scope!: CatchScope;
type!: NodeType.tCatchClause;
declare type: NodeType.tCatchClause;

createScope(parentScope: Scope): void {
this.scope = new CatchScope(parentScope, this.context);
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ChainExpression.ts
Expand Up @@ -5,5 +5,5 @@ import { NodeBase } from './shared/Node';

export default class ChainExpression extends NodeBase {
expression!: CallExpression | MemberExpression;
type!: NodeType.tChainExpression;
declare type: NodeType.tChainExpression;
}
2 changes: 1 addition & 1 deletion src/ast/nodes/ClassBody.ts
Expand Up @@ -10,7 +10,7 @@ import { GenericEsTreeNode, IncludeChildren, NodeBase } from './shared/Node';
export default class ClassBody extends NodeBase {
body!: (MethodDefinition | PropertyDefinition)[];
scope!: ClassBodyScope;
type!: NodeType.tClassBody;
declare type: NodeType.tClassBody;

createScope(parentScope: Scope): void {
this.scope = new ClassBodyScope(parentScope, this.parent as ClassNode, this.context);
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ClassDeclaration.ts
Expand Up @@ -9,7 +9,7 @@ import { GenericEsTreeNode } from './shared/Node';

export default class ClassDeclaration extends ClassNode {
id!: IdentifierWithVariable | null;
type!: NodeType.tClassDeclaration;
declare type: NodeType.tClassDeclaration;

initialise(): void {
super.initialise();
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ClassExpression.ts
Expand Up @@ -5,7 +5,7 @@ import * as NodeType from './NodeType';
import ClassNode from './shared/ClassNode';

export default class ClassExpression extends ClassNode {
type!: NodeType.tClassExpression;
declare type: NodeType.tClassExpression;

render(
code: MagicString,
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ConditionalExpression.ts
Expand Up @@ -29,7 +29,7 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz
alternate!: ExpressionNode;
consequent!: ExpressionNode;
test!: ExpressionNode;
type!: NodeType.tConditionalExpression;
declare type: NodeType.tConditionalExpression;

private expressionsToBeDeoptimized: DeoptimizableEntity[] = [];
private isBranchResolutionAnalysed = false;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ContinueStatement.ts
Expand Up @@ -10,7 +10,7 @@ import { StatementBase } from './shared/Node';

export default class ContinueStatement extends StatementBase {
label!: Identifier | null;
type!: NodeType.tContinueStatement;
declare type: NodeType.tContinueStatement;

hasEffects(context: HasEffectsContext): boolean {
if (this.label) {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/DoWhileStatement.ts
Expand Up @@ -5,7 +5,7 @@ import { ExpressionNode, IncludeChildren, StatementBase, StatementNode } from '.
export default class DoWhileStatement extends StatementBase {
body!: StatementNode;
test!: ExpressionNode;
type!: NodeType.tDoWhileStatement;
declare type: NodeType.tDoWhileStatement;

hasEffects(context: HasEffectsContext): boolean {
if (this.test.hasEffects(context)) return true;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/EmptyStatement.ts
Expand Up @@ -2,7 +2,7 @@ import * as NodeType from './NodeType';
import { StatementBase } from './shared/Node';

export default class EmptyStatement extends StatementBase {
type!: NodeType.tEmptyStatement;
declare type: NodeType.tEmptyStatement;

hasEffects(): boolean {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ExportAllDeclaration.ts
Expand Up @@ -9,7 +9,7 @@ export default class ExportAllDeclaration extends NodeBase {
exported!: Identifier | null;
needsBoundaries!: true;
source!: Literal<string>;
type!: NodeType.tExportAllDeclaration;
declare type: NodeType.tExportAllDeclaration;

hasEffects(): boolean {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ExportDefaultDeclaration.ts
Expand Up @@ -44,7 +44,7 @@ export default class ExportDefaultDeclaration extends NodeBase {
declaration!: FunctionDeclaration | ClassDeclaration | ExpressionNode;
needsBoundaries!: true;
scope!: ModuleScope;
type!: NodeType.tExportDefaultDeclaration;
declare type: NodeType.tExportDefaultDeclaration;
variable!: ExportDefaultVariable;

private declarationName: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ExportNamedDeclaration.ts
Expand Up @@ -14,7 +14,7 @@ export default class ExportNamedDeclaration extends NodeBase {
needsBoundaries!: true;
source!: Literal<string> | null;
specifiers!: ExportSpecifier[];
type!: NodeType.tExportNamedDeclaration;
declare type: NodeType.tExportNamedDeclaration;

bind(): void {
// Do not bind specifiers
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ExportSpecifier.ts
Expand Up @@ -5,5 +5,5 @@ import { NodeBase } from './shared/Node';
export default class ExportSpecifier extends NodeBase {
exported!: Identifier;
local!: Identifier;
type!: NodeType.tExportSpecifier;
declare type: NodeType.tExportSpecifier;
}
2 changes: 1 addition & 1 deletion src/ast/nodes/ForInStatement.ts
Expand Up @@ -13,7 +13,7 @@ export default class ForInStatement extends StatementBase {
body!: StatementNode;
left!: VariableDeclaration | PatternNode;
right!: ExpressionNode;
type!: NodeType.tForInStatement;
declare type: NodeType.tForInStatement;
protected deoptimized = false;

createScope(parentScope: Scope): void {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ForOfStatement.ts
Expand Up @@ -14,7 +14,7 @@ export default class ForOfStatement extends StatementBase {
body!: StatementNode;
left!: VariableDeclaration | PatternNode;
right!: ExpressionNode;
type!: NodeType.tForOfStatement;
declare type: NodeType.tForOfStatement;
protected deoptimized = false;

createScope(parentScope: Scope): void {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ForStatement.ts
Expand Up @@ -11,7 +11,7 @@ export default class ForStatement extends StatementBase {
body!: StatementNode;
init!: VariableDeclaration | ExpressionNode | null;
test!: ExpressionNode | null;
type!: NodeType.tForStatement;
declare type: NodeType.tForStatement;
update!: ExpressionNode | null;

createScope(parentScope: Scope): void {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/FunctionDeclaration.ts
Expand Up @@ -5,7 +5,7 @@ import FunctionNode from './shared/FunctionNode';
import { GenericEsTreeNode } from './shared/Node';

export default class FunctionDeclaration extends FunctionNode {
type!: NodeType.tFunctionDeclaration;
declare type: NodeType.tFunctionDeclaration;

initialise(): void {
super.initialise();
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/FunctionExpression.ts
Expand Up @@ -5,7 +5,7 @@ import * as NodeType from './NodeType';
import FunctionNode from './shared/FunctionNode';

export default class FunctionExpression extends FunctionNode {
type!: NodeType.tFunctionExpression;
declare type: NodeType.tFunctionExpression;

render(
code: MagicString,
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/Identifier.ts
Expand Up @@ -30,7 +30,7 @@ const tdzVariableKinds = {

export default class Identifier extends NodeBase implements PatternNode {
name!: string;
type!: NodeType.tIdentifier;
declare type: NodeType.tIdentifier;
variable: Variable | null = null;
protected deoptimized = false;
private isTDZAccess: boolean | null = null;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/IfStatement.ts
Expand Up @@ -22,7 +22,7 @@ export default class IfStatement extends StatementBase implements DeoptimizableE
alternate!: StatementNode | null;
consequent!: StatementNode;
test!: ExpressionNode;
type!: NodeType.tIfStatement;
declare type: NodeType.tIfStatement;

private alternateScope?: TrackingScope;
private consequentScope!: TrackingScope;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ImportDeclaration.ts
Expand Up @@ -11,7 +11,7 @@ export default class ImportDeclaration extends NodeBase {
needsBoundaries!: true;
source!: Literal<string>;
specifiers!: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[];
type!: NodeType.tImportDeclaration;
declare type: NodeType.tImportDeclaration;

// Do not bind specifiers
bind(): void {}
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ImportDefaultSpecifier.ts
Expand Up @@ -4,5 +4,5 @@ import { NodeBase } from './shared/Node';

export default class ImportDefaultSpecifier extends NodeBase {
local!: Identifier;
type!: NodeType.tImportDefaultSpecifier;
declare type: NodeType.tImportDefaultSpecifier;
}
2 changes: 1 addition & 1 deletion src/ast/nodes/ImportExpression.ts
Expand Up @@ -22,7 +22,7 @@ interface DynamicImportMechanism {
export default class ImportExpression extends NodeBase {
inlineNamespace: NamespaceVariable | null = null;
source!: ExpressionNode;
type!: NodeType.tImportExpression;
declare type: NodeType.tImportExpression;

private mechanism: DynamicImportMechanism | null = null;
private resolution: Module | ExternalModule | string | null = null;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ImportNamespaceSpecifier.ts
Expand Up @@ -4,5 +4,5 @@ import { NodeBase } from './shared/Node';

export default class ImportNamespaceSpecifier extends NodeBase {
local!: Identifier;
type!: NodeType.tImportNamespaceSpecifier;
declare type: NodeType.tImportNamespaceSpecifier;
}
2 changes: 1 addition & 1 deletion src/ast/nodes/ImportSpecifier.ts
Expand Up @@ -5,5 +5,5 @@ import { NodeBase } from './shared/Node';
export default class ImportSpecifier extends NodeBase {
imported!: Identifier;
local!: Identifier;
type!: NodeType.tImportSpecifier;
declare type: NodeType.tImportSpecifier;
}
2 changes: 1 addition & 1 deletion src/ast/nodes/LabeledStatement.ts
Expand Up @@ -12,7 +12,7 @@ import { IncludeChildren, StatementBase, StatementNode } from './shared/Node';
export default class LabeledStatement extends StatementBase {
body!: StatementNode;
label!: Identifier;
type!: NodeType.tLabeledStatement;
declare type: NodeType.tLabeledStatement;

hasEffects(context: HasEffectsContext): boolean {
const brokenFlow = context.brokenFlow;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/Literal.ts
Expand Up @@ -24,7 +24,7 @@ export default class Literal<T extends LiteralValue = LiteralValue> extends Node
flags: string;
pattern: string;
};
type!: NodeType.tLiteral;
declare type: NodeType.tLiteral;
value!: T;

private members!: { [key: string]: MemberDescription };
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/LogicalExpression.ts
Expand Up @@ -30,7 +30,7 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable
left!: ExpressionNode;
operator!: LogicalOperator;
right!: ExpressionNode;
type!: NodeType.tLogicalExpression;
declare type: NodeType.tLogicalExpression;

// We collect deoptimization information if usedBranch !== null
private expressionsToBeDeoptimized: DeoptimizableEntity[] = [];
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/MemberExpression.ts
Expand Up @@ -86,7 +86,7 @@ export default class MemberExpression extends NodeBase implements DeoptimizableE
optional!: boolean;
property!: ExpressionNode | PrivateIdentifier;
propertyKey!: ObjectPathKey | null;
type!: NodeType.tMemberExpression;
declare type: NodeType.tMemberExpression;
variable: Variable | null = null;
protected deoptimized = false;
private bound = false;
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/MetaProperty.ts
Expand Up @@ -17,7 +17,7 @@ const FILE_PREFIX = 'ROLLUP_FILE_URL_';
export default class MetaProperty extends NodeBase {
meta!: Identifier;
property!: Identifier;
type!: NodeType.tMetaProperty;
declare type: NodeType.tMetaProperty;

private metaProperty?: string | null;

Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/MethodDefinition.ts
Expand Up @@ -8,6 +8,6 @@ export default class MethodDefinition extends MethodBase {
key!: ExpressionNode | PrivateIdentifier;
kind!: 'constructor' | 'method' | 'get' | 'set';
static!: boolean;
type!: NodeType.tMethodDefinition;
declare type: NodeType.tMethodDefinition;
value!: FunctionExpression;
}
2 changes: 1 addition & 1 deletion src/ast/nodes/NewExpression.ts
Expand Up @@ -8,7 +8,7 @@ import { ExpressionNode, NodeBase } from './shared/Node';
export default class NewExpression extends NodeBase {
arguments!: ExpressionNode[];
callee!: ExpressionNode;
type!: NodeType.tNewExpression;
declare type: NodeType.tNewExpression;
protected deoptimized = false;
private callOptions!: CallOptions;

Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ObjectExpression.ts
Expand Up @@ -24,7 +24,7 @@ import { OBJECT_PROTOTYPE } from './shared/ObjectPrototype';

export default class ObjectExpression extends NodeBase implements DeoptimizableEntity {
properties!: (Property | SpreadElement)[];
type!: NodeType.tObjectExpression;
declare type: NodeType.tObjectExpression;
private objectEntity: ObjectEntity | null = null;

deoptimizeCache(): void {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/ObjectPattern.ts
Expand Up @@ -11,7 +11,7 @@ import { PatternNode } from './shared/Pattern';

export default class ObjectPattern extends NodeBase implements PatternNode {
properties!: (Property | RestElement)[];
type!: NodeType.tObjectPattern;
declare type: NodeType.tObjectPattern;

addExportedVariables(
variables: Variable[],
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/PrivateIdentifier.ts
Expand Up @@ -3,5 +3,5 @@ import { NodeBase } from './shared/Node';

export default class PrivateIdentifier extends NodeBase {
name!: string;
type!: NodeType.tPrivateIdentifier;
declare type: NodeType.tPrivateIdentifier;
}

0 comments on commit 31de974

Please sign in to comment.