From e37df8aad861bee6f0be10d271837223a0b3bccd Mon Sep 17 00:00:00 2001 From: Xie Yuheng Date: Fri, 17 Nov 2023 17:32:07 +0800 Subject: [PATCH] up --- TODO.md | 2 ++ src/lang/evaluate/evaluate.ts | 4 ++++ src/lang/evaluate/evaluateBlockStmt.ts | 3 +++ src/lang/execute/execute.ts | 2 ++ 4 files changed, 11 insertions(+) diff --git a/TODO.md b/TODO.md index c1f4554..e166132 100644 --- a/TODO.md +++ b/TODO.md @@ -3,6 +3,8 @@ DefineDatatype & DatatypeDefinition - `datatype ` -- to define trivial type for now - pass parser `tests/` +`Begin` -- should call react + # net [net] react.test.ts diff --git a/src/lang/evaluate/evaluate.ts b/src/lang/evaluate/evaluate.ts index e541f00..34f9a01 100644 --- a/src/lang/evaluate/evaluate.ts +++ b/src/lang/evaluate/evaluate.ts @@ -6,10 +6,14 @@ import { Value } from "../value" import { evaluateBlock } from "./evaluateBlock" import { evaluateDefinition } from "./evaluateDefinition" +// `EvaluateOptions` can be used to denote different modes of evaluation. + export interface EvaluateOptions { // } +// We return `Array` to handle possible multiple return values. + export function evaluate( mod: Mod, env: Env, diff --git a/src/lang/evaluate/evaluateBlockStmt.ts b/src/lang/evaluate/evaluateBlockStmt.ts index b1a6e80..411afbb 100644 --- a/src/lang/evaluate/evaluateBlockStmt.ts +++ b/src/lang/evaluate/evaluateBlockStmt.ts @@ -12,6 +12,9 @@ import { Value, assertValueKind } from "../value" import { EvaluateOptions } from "./evaluate" import { evaluateOne } from "./evaluateOne" +// We use `null` to denote that this `BlockStmt` +// should not be viewed as returned results of this block. + export function evaluateBlockStmt( mod: Mod, env: Env, diff --git a/src/lang/execute/execute.ts b/src/lang/execute/execute.ts index 786f975..5ea7643 100644 --- a/src/lang/execute/execute.ts +++ b/src/lang/execute/execute.ts @@ -3,6 +3,8 @@ import { EvaluateOptions, evaluateBlock, evaluateParameters } from "../evaluate" import { Mod, define } from "../mod" import { Stmt } from "../stmt" +// We return `null` to late the type checker catch the uncovered switch cases. + export async function execute(mod: Mod, stmt: Stmt): Promise { try { const options: EvaluateOptions = {}