From 42f8c401dc9519bc8b2d386ce9eda072144a46d0 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 13 Jan 2023 19:40:15 +0530 Subject: feat: refactors test runner --- src/eval.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/eval.ts') diff --git a/src/eval.ts b/src/eval.ts index fdffed7..2b93e49 100644 --- a/src/eval.ts +++ b/src/eval.ts @@ -6,7 +6,7 @@ import * as builtins from './eval-env/builtins' type EffDefn = { default: (ctx: Ctx, args: Type[]) => Record Promise>, - cleanup: () => void, + cleanup?: () => void, } const mergeEffDefns = (a: EffDefn, b: EffDefn): EffDefn => ({ default: (ctx: Ctx, args: Type[]) => ({ @@ -14,13 +14,13 @@ const mergeEffDefns = (a: EffDefn, b: EffDefn): EffDefn => ({ ...b.default(ctx, args), }), cleanup: () => { - a.cleanup() - b.cleanup() + a.cleanup?.() + b.cleanup?.() }, }) -const cleanupActions = new Set<() => void>() -export const cleanup = () => cleanupActions.forEach(f => f()) +const cleanupActions = new Set void)>() +export const cleanup = () => cleanupActions.forEach(f => f?.()) let prevEnv: string @@ -28,6 +28,7 @@ export const evaluateType = async ( ctx: Ctx, effTyp: Type ): Promise => { + // TODO: base type check const name = effTyp.getSymbol()?.getName() const args = effTyp.getTypeArguments() @@ -67,11 +68,3 @@ export const evaluateType = async ( }, }) } - -export const evalList = async (ctx: Ctx, effectTyps: Type[]) => { - const effectResults: string[] = [] - for (const item of effectTyps ?? []) { - effectResults.push(...(await evaluateType(ctx, item))) - } - return effectResults -} -- cgit v1.3.1