everything seems to work ... but code is dirty

This commit is contained in:
Joeri Exelmans 2025-05-19 23:59:21 +02:00
parent a19dbe1b34
commit 5b6bcf5ffa
10 changed files with 253 additions and 131 deletions

View file

@ -28,7 +28,7 @@ function nestedFnProperties({state, setState, suggestionPriority}: CallBlockProp
}
const fnSuggestionPriority = (fnSuggestion: ResolvedType) => computePriority(
fnSuggestion,
evalEditorBlock(state.input, env),
evalEditorBlock(state.input, env)[0],
suggestionPriority,
env,
);
@ -43,7 +43,7 @@ function nestedInputProperties({state, setState, suggestionPriority}: CallBlockP
setState(state => state.fn); // we become our function
}
const inputSuggestionPriorirty = (inputSuggestion: ResolvedType) => computePriority(
evalEditorBlock(state.fn, env), // fn *may* be set
evalEditorBlock(state.fn, env)[0], // fn *may* be set
inputSuggestion, // suggestions will be for input
suggestionPriority, // priority function we get from parent block
env,
@ -53,7 +53,7 @@ function nestedInputProperties({state, setState, suggestionPriority}: CallBlockP
export function CallBlock(props: CallBlockProps) {
const env = useContext(EnvContext);
const resolved = evalEditorBlock(props.state, env);
const [resolved] = evalEditorBlock(props.state, env);
return <span className={"functionBlock" + ((resolved.kind === "error") ? " unifyError" : "")}>
<FunctionHeader {...props} />
<div className="functionParams">
@ -73,7 +73,7 @@ export function CallBlock(props: CallBlockProps) {
}
function computePriority(fn: ResolvedType, input: ResolvedType, outPriority: (s: ResolvedType) => number, env) {
const resolved = evalCallBlock2(fn, input, env);
const [resolved] = evalCallBlock2(fn, input, env);
const score = scoreResolved(resolved, outPriority);
return score;
}