UNPKG

js-slang

Version:

Javascript-based implementations of Source, written in Typescript

45 lines (44 loc) 5.79 kB
import type es from 'estree'; import { AllowedDeclarations, type BlockExpression, type FunctionDeclarationExpression, type Node, type StatementSequence } from '../../types'; export declare const locationDummyNode: (line: number, column: number, source: string | null) => es.Literal; export declare const identifier: (name: string, loc?: es.SourceLocation | null) => es.Identifier; export declare const importDeclaration: (source: string, specifiers: es.ImportDeclaration['specifiers'], loc?: es.SourceLocation | null) => es.ImportDeclaration; export declare const importSpecifier: (importedName: string, localName: string, loc?: es.SourceLocation | null) => es.ImportSpecifier; export declare const importDefaultSpecifier: (localName: string, loc?: es.SourceLocation | null) => es.ImportDefaultSpecifier; export declare const importNamespaceSpecifier: (localName: string, loc?: es.SourceLocation | null) => es.ImportNamespaceSpecifier; export declare const literal: (value: string | number | boolean | null, loc?: es.SourceLocation | null) => es.Literal; export declare const memberExpression: (object: es.Expression, property: string | number) => es.MemberExpression; export declare const declaration: (name: string, kind: AllowedDeclarations, init: es.Expression, loc?: es.SourceLocation | null) => es.VariableDeclaration; export declare const constantDeclaration: (name: string, init: es.Expression, loc?: es.SourceLocation | null) => es.VariableDeclaration; export declare const callExpression: (callee: es.Expression, args: (es.Expression | es.SpreadElement)[], loc?: es.SourceLocation | null) => es.CallExpression; export declare const expressionStatement: (expression: es.Expression) => es.ExpressionStatement; export declare const blockArrowFunction: (params: es.Identifier[], body: es.Statement[] | es.BlockStatement | es.Expression, loc?: es.SourceLocation | null) => es.ArrowFunctionExpression; export declare const functionExpression: (params: es.Pattern[], body: es.Statement[] | es.BlockStatement, loc?: es.SourceLocation | null, id?: es.Identifier) => es.FunctionExpression; export declare const blockStatement: (body: es.Statement[], loc?: es.SourceLocation | null) => es.BlockStatement; export declare const statementSequence: (body: es.Statement[], loc?: es.SourceLocation | null) => StatementSequence; export declare const program: (body: es.Statement[]) => es.Program; export declare const returnStatement: (argument: es.Expression, loc?: es.SourceLocation | null) => es.ReturnStatement; export declare const property: (key: string, value: es.Expression) => es.Property; export declare const objectExpression: (properties: es.Property[]) => es.ObjectExpression; export declare const mutateToCallExpression: (node: Node, callee: es.Expression, args: es.Expression[]) => void; export declare const mutateToAssignmentExpression: (node: Node, left: es.Pattern, right: es.Expression) => void; export declare const mutateToExpressionStatement: (node: Node, expr: es.Expression) => void; export declare const mutateToReturnStatement: (node: Node, expr: es.Expression) => void; export declare const mutateToMemberExpression: (node: Node, obj: es.Expression, prop: es.Expression) => void; export declare const logicalExpression: (operator: es.LogicalOperator, left: es.Expression, right: es.Expression, loc?: es.SourceLocation | null) => es.LogicalExpression; export declare const mutateToConditionalExpression: (node: Node, test: es.Expression, consequent: es.Expression, alternate: es.Expression) => void; export declare const conditionalExpression: (test: es.Expression, consequent: es.Expression, alternate: es.Expression, loc?: es.SourceLocation | null) => es.ConditionalExpression; export declare const arrayExpression: (elements: es.Expression[]) => es.ArrayExpression; export declare const assignmentExpression: (left: es.Identifier | es.MemberExpression, right: es.Expression, loc?: es.SourceLocation | null) => es.AssignmentExpression; export declare const binaryExpression: (operator: es.BinaryOperator, left: es.Expression, right: es.Expression, loc?: es.SourceLocation | null) => es.BinaryExpression; export declare const unaryExpression: (operator: es.UnaryOperator, argument: es.Expression, loc?: es.SourceLocation | null) => es.UnaryExpression; export declare const primitive: (value: any) => es.Expression; export declare const functionDeclarationExpression: (id: es.Identifier, params: es.Pattern[], body: es.BlockStatement, loc?: es.SourceLocation | null) => FunctionDeclarationExpression; export declare const functionDeclaration: (id: es.Identifier, params: es.Pattern[], body: es.BlockStatement, loc?: es.SourceLocation | null) => es.FunctionDeclaration; export declare const blockExpression: (body: es.Statement[], loc?: es.SourceLocation | null) => BlockExpression; export declare const arrowFunctionExpression: (params: es.Pattern[], body: es.Expression | es.BlockStatement, loc?: es.SourceLocation | null) => es.ArrowFunctionExpression; export declare const variableDeclaration: (declarations: es.VariableDeclarator[], kind?: es.VariableDeclaration['kind'], loc?: es.SourceLocation | null) => es.VariableDeclaration; export declare const variableDeclarator: (id: es.Pattern, init: es.Expression, loc?: es.SourceLocation | null) => es.VariableDeclarator; export declare const ifStatement: (test: es.Expression, consequent: es.BlockStatement, alternate: es.Statement, loc?: es.SourceLocation | null) => es.IfStatement; export declare const whileStatement: (body: es.BlockStatement, test: es.Expression, loc?: es.SourceLocation | null) => es.WhileStatement; export declare const forStatement: (init: es.VariableDeclaration | es.Expression, test: es.Expression, update: es.Expression, body: es.Statement, loc?: es.SourceLocation | null) => es.ForStatement;