Fix some TSLint and compiler warnings
This commit is contained in:
parent
7fcb195366
commit
ad239d1cdf
|
@ -1,6 +1,8 @@
|
|||
// Copyright 2016 Marapongo, Inc. All rights reserved.
|
||||
|
||||
import {Node} from "./nodes";
|
||||
import * as statements from "./statements";
|
||||
|
||||
import * as symbols from "../symbols";
|
||||
|
||||
// TODO(joe): consider refactoring modifiers from booleans to enums.
|
||||
|
@ -14,7 +16,7 @@ export type Definitions = Map<symbols.Identifier, Definition>;
|
|||
// A module contains other members, including submodules, variables, functions, and/or classes.
|
||||
export interface Module extends Definition {
|
||||
kind: ModuleKind;
|
||||
access?: Accessibility;
|
||||
access?: symbols.Accessibility;
|
||||
}
|
||||
export const moduleKind = "Module";
|
||||
export type ModuleKind = "Module";
|
||||
|
@ -36,15 +38,15 @@ export type ParameterKind = "Parameter";
|
|||
|
||||
// A module property is like a variable but has an accessibility modifier.
|
||||
export interface ModuleProperty extends Variable {
|
||||
kind: SimpleVariableKind;
|
||||
access?: Accessibility;
|
||||
kind: ModulePropertyKind;
|
||||
access?: symbols.Accessibility;
|
||||
}
|
||||
export const simpleVariableKind = "SimpleVariable";
|
||||
export type SimpleVariableKind = "SimpleVariable";
|
||||
export const modulePropertyKind = "ModuleProperty";
|
||||
export type ModulePropertyKind = "ModuleProperty";
|
||||
|
||||
// A class property is just like a module property with some extra attributes.
|
||||
export interface ClassProperty extends Variable {
|
||||
access?: ClassMemberAccessibility;
|
||||
access?: symbols.ClassMemberAccessibility;
|
||||
static?: boolean;
|
||||
primary?: boolean;
|
||||
}
|
||||
|
@ -55,13 +57,13 @@ export type ClassPropertyKind = "ClassProperty";
|
|||
export interface Function extends Definition {
|
||||
parameters?: Parameter[];
|
||||
returnType?: symbols.TypeToken;
|
||||
body?: ast.Block;
|
||||
body?: statements.Block;
|
||||
}
|
||||
|
||||
// A module method is just a function with an accessibility.
|
||||
export interface ModuleMethod extends Function {
|
||||
kind: ModuleMethodKind;
|
||||
access?: Accessibility;
|
||||
access?: symbols.Accessibility;
|
||||
}
|
||||
export const moduleMethodKind = "ModuleMethod";
|
||||
export type ModuleMethodKind = "ModuleMethod";
|
||||
|
@ -69,7 +71,7 @@ export type ModuleMethodKind = "ModuleMethod";
|
|||
// A class method is just like a module method with some extra attributes.
|
||||
export interface ClassMethod extends Function {
|
||||
kind: ClassMethodKind;
|
||||
access?: ClassMemberAccessibility;
|
||||
access?: symbols.ClassMemberAccessibility;
|
||||
static?: boolean;
|
||||
sealed?: boolean;
|
||||
abstract?: boolean;
|
||||
|
@ -79,16 +81,16 @@ export type ClassMethodKind = "ClassMethod";
|
|||
|
||||
// A class can be constructed to create an object, and exports properties, methods, and has a number of attributes.
|
||||
export interface Class extends Definition {
|
||||
kind: ClassKind;
|
||||
access?: Accessibility;
|
||||
extends?: symbols.TypeToken;
|
||||
implements?: symbols.TypeToken[];
|
||||
sealed?: boolean;
|
||||
abstract?: boolean;
|
||||
record?: boolean;
|
||||
interface?: boolean;
|
||||
properties?: ClassProperty[];
|
||||
methods?: ClassMethod[];
|
||||
kind: ClassKind;
|
||||
access?: symbols.Accessibility;
|
||||
extends?: symbols.TypeToken;
|
||||
implements?: symbols.TypeToken[];
|
||||
sealed?: boolean;
|
||||
abstract?: boolean;
|
||||
record?: boolean;
|
||||
interface?: boolean;
|
||||
properties?: ClassProperty[];
|
||||
methods?: ClassMethod[];
|
||||
}
|
||||
export const classKind = "Class";
|
||||
export type ClassKind = "Class";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright 2016 Marapongo, Inc. All rights reserved.
|
||||
|
||||
import * as symbols from "../symbols";
|
||||
import * as statements from "./statements";
|
||||
|
||||
export interface Expression extends Node {}
|
||||
|
||||
|
@ -106,7 +107,7 @@ export interface LambdaExpression extends Expression {
|
|||
kind: LambdaExpressionKind;
|
||||
signature: symbols.TypeToken; // the func signature type.
|
||||
parameters: symbols.VariableToken[]; // the parameter variables.
|
||||
body: Block; // the lambda's body block.
|
||||
body: statements.Block; // the lambda's body block.
|
||||
}
|
||||
export const lambdaExpressionKind = "LambdaExpression";
|
||||
export type LambdaExpressionKind = "LambdaExpression";
|
||||
|
|
|
@ -1,60 +1,52 @@
|
|||
// Copyright 2016 Marapongo, Inc. All rights reserved.
|
||||
|
||||
import {Location} from "./source";
|
||||
import * as symbols from "../symbols";
|
||||
import * as definitions from "./definitions";
|
||||
import * as expressions from "./expressions";
|
||||
import * as source from "./source";
|
||||
import * as statements from "./statements";
|
||||
|
||||
// Node is a discriminated type for all serialized blocks and instructions.
|
||||
export interface Node {
|
||||
kind: NodeKind;
|
||||
loc?: Location;
|
||||
loc?: source.Location;
|
||||
}
|
||||
|
||||
// NodeType contains all of the legal Node implementations. This effectively "seales" the discriminated node type,
|
||||
// and makes constructing and inspecting nodes a little more bulletproof (i.e., they aren't arbitrary strings).
|
||||
export type NodeKind =
|
||||
// # Statements
|
||||
definitions.ModuleKind |
|
||||
definitions.ParameterKind |
|
||||
definitions.ModulePropertyKind |
|
||||
definitions.ClassPropertyKind |
|
||||
definitions.ModuleMethodKind |
|
||||
definitions.ClassMethodKind |
|
||||
definitions.ClassKind |
|
||||
|
||||
// ## Blocks
|
||||
BlockKind |
|
||||
LocalVariableDeclarationKind |
|
||||
TryCatchFinallyKind |
|
||||
TryCatchBlockKind |
|
||||
statements.BlockKind |
|
||||
statements.LocalVariableDeclarationKind |
|
||||
statements.TryCatchFinallyKind |
|
||||
statements.TryCatchBlockKind |
|
||||
statements.BreakStatementKind |
|
||||
statements.ContinueStatementKind |
|
||||
statements.IfStatementKind |
|
||||
statements.LabeledStatementKind |
|
||||
statements.WhileStatementKind |
|
||||
statements.ExpressionStatementKind |
|
||||
|
||||
// ## Branches
|
||||
BreakStatementKind |
|
||||
ContinueStatementKind |
|
||||
IfStatementKind |
|
||||
LabeledStatementKind |
|
||||
WhileStatementKind |
|
||||
|
||||
// ## Miscellaneous
|
||||
ExpressionStatementKind |
|
||||
|
||||
// # Expressions
|
||||
|
||||
// ## Literals
|
||||
NullLiteralExpressionKind |
|
||||
BoolLiteralExpressionKind |
|
||||
NumberLiteralExpressionKind |
|
||||
StringLiteralExpressionKind |
|
||||
ObjectLiteralExpressionKind |
|
||||
ObjectLiteralInitializerKind |
|
||||
|
||||
// ## Loads
|
||||
LoadVariableExpressionKind |
|
||||
LoadFunctionExpressionKind |
|
||||
LoadDynamicExpressionKind |
|
||||
|
||||
// ## Functions
|
||||
InvokeFunctionExpressionKind |
|
||||
LambdaExpressionKind |
|
||||
|
||||
// ## Operators
|
||||
UnaryOperatorExpressionKind |
|
||||
BinaryOperatorExpressionKind |
|
||||
|
||||
// ## Miscellaneous
|
||||
CastExpressionKind |
|
||||
ConditionalExpressionKind
|
||||
expressions.NullLiteralExpressionKind |
|
||||
expressions.BoolLiteralExpressionKind |
|
||||
expressions.NumberLiteralExpressionKind |
|
||||
expressions.StringLiteralExpressionKind |
|
||||
expressions.ObjectLiteralExpressionKind |
|
||||
expressions.ObjectLiteralInitializerKind |
|
||||
expressions.LoadVariableExpressionKind |
|
||||
expressions.LoadFunctionExpressionKind |
|
||||
expressions.LoadDynamicExpressionKind |
|
||||
expressions.InvokeFunctionExpressionKind |
|
||||
expressions.LambdaExpressionKind |
|
||||
expressions.UnaryOperatorExpressionKind |
|
||||
expressions.BinaryOperatorExpressionKind |
|
||||
expressions.CastExpressionKind |
|
||||
expressions.ConditionalExpressionKind
|
||||
;
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// Copyright 2016 Marapongo, Inc. All rights reserved.
|
||||
|
||||
import {Node} from "./node";
|
||||
import {Expression} from "./expressions";
|
||||
import {Node} from "./nodes";
|
||||
|
||||
import * as symbols from "../symbols";
|
||||
|
||||
export interface Statement extends Node {}
|
||||
|
|
Loading…
Reference in a new issue