Skip to content
Prev Previous commit
Next Next commit
Fix type errors
  • Loading branch information
RichDom2185 committed Apr 30, 2024
commit 6cabd3fcc161c187d4c877e6744ecd6722f5df9a
6 changes: 3 additions & 3 deletions src/interpreter/interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import * as errors from '../errors/errors'
import { RuntimeSourceError } from '../errors/runtimeSourceError'
import { checkEditorBreakpoints } from '../stdlib/inspector'
import {
Variant,
type Context,
type ContiguousArrayElements,
type Environment,
type Node,
type Value,
Variant
type Value
} from '../types'
import * as create from '../utils/ast/astCreator'
import { conditionalExpression, literal, primitive } from '../utils/ast/astCreator'
Expand Down Expand Up @@ -637,7 +637,7 @@ export const evaluators: { [nodeType: string]: Evaluator<Node> } = {
},

ObjectExpression: function*(node: es.ObjectExpression, context: Context) {
const obj = {}
const obj: Record<any, any> = {}
for (const propUntyped of node.properties) {
// node.properties: es.Property | es.SpreadExpression, but
// our Acorn is set to ES6 which cannot have a es.SpreadExpression
Expand Down
2 changes: 1 addition & 1 deletion src/utils/uniqueIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const globalIdNames = [
export type NativeIds = Record<(typeof globalIdNames)[number], es.Identifier>

export function getNativeIds(program: es.Program, usedIdentifiers: Set<string>): NativeIds {
const globalIds = {}
const globalIds: Partial<NativeIds> = {}
for (const identifier of globalIdNames) {
globalIds[identifier] = create.identifier(getUniqueId(usedIdentifiers, identifier))
}
Expand Down
14 changes: 12 additions & 2 deletions src/vm/svml-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { ConstAssignment, UndefinedVariable } from '../errors/errors'
import { parse } from '../parser/parser'
import {
CONSTANT_PRIMITIVES,
generatePrimitiveFunctionCode,
INTERNAL_FUNCTIONS,
PRIMITIVE_FUNCTION_NAMES,
generatePrimitiveFunctionCode,
vmPrelude
} from '../stdlib/vm.prelude'
import type { Context, ContiguousArrayElements, Node } from '../types'
Expand Down Expand Up @@ -485,7 +485,17 @@ function compileStatements(
}

// each compiler should return a maxStackSize
const compilers = {
const compilers: Partial<
Record<
Node['type'],
(
node: Node,
indexTable: Map<string, EnvEntry>[],
insertFlag: boolean,
isTailCallPosition?: boolean
) => ReturnType<typeof compileStatements>
>
> = {
// wrapper
Program(node: Node, indexTable: Map<string, EnvEntry>[], insertFlag: boolean) {
node = node as es.Program
Expand Down