js-slang
Version:
Javascript-based implementations of Source, written in Typescript
25 lines (24 loc) • 1.41 kB
TypeScript
import type es from 'estree';
import { ErrorSeverity, ErrorType } from '../errors/base';
import { RuntimeSourceError } from '../errors/runtimeSourceError';
import { Chapter } from '../langs';
import type { 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;