js-slang
Version:
Javascript-based implementations of Source, written in Typescript
23 lines (22 loc) • 1.34 kB
TypeScript
import * as es from 'estree';
import { RuntimeSourceError } from '../errors/runtimeSourceError';
import { Chapter, ErrorSeverity, ErrorType, Node, Value } from '../types';
export declare class TypeError extends RuntimeSourceError {
side: string;
expected: string;
got: string;
chapter: Chapter;
type: ErrorType;
severity: ErrorSeverity;
location: es.SourceLocation;
constructor(node: Node, side: string, expected: string, got: string, chapter?: Chapter);
explain(): string;
elaborate(): string;
}
export declare const checkUnaryExpression: (node: Node, operator: es.UnaryOperator, value: Value, chapter?: Chapter) => TypeError | undefined;
export declare const checkBinaryExpression: (node: Node, operator: es.BinaryOperator, chapter: Chapter, left: Value, right: Value) => TypeError | undefined;
export declare const checkIfStatement: (node: Node, test: Value, chapter?: Chapter) => TypeError | undefined;
export declare const checkoutofRange: (node: Node, index: Value, chapter?: Chapter) => TypeError | undefined;
export declare const checkMemberAccess: (node: Node, obj: Value, prop: Value) => TypeError | undefined;
export declare const isIdentifier: (node: any) => node is es.Identifier;
export declare const checkArray: (node: Node, maybeArray: Value, chapter?: Chapter) => TypeError | undefined;