diff --git a/src/CallBlock.tsx b/src/CallBlock.tsx index db165d3..bda374a 100644 --- a/src/CallBlock.tsx +++ b/src/CallBlock.tsx @@ -51,22 +51,16 @@ function nestedInputProperties({state, setState, suggestionPriority}: CallBlockP return {state: state.input, setState: setInput, onCancel: onInputCancel, suggestionPriority: inputSuggestionPriorirty}; } -export function CallBlock({ state, setState, suggestionPriority }: CallBlockProps) { +export function CallBlock(props: CallBlockProps) { const env = useContext(EnvContext); - const resolved = evalEditorBlock(state, env); + const resolved = evalEditorBlock(props.state, env); return - +
{/* Sequence of input parameters */} @@ -84,11 +78,11 @@ function computePriority(fn: ResolvedType, input: ResolvedType, outPriority: (s: return score; } -function FunctionHeader({ state, setState, suggestionPriority }) { +function FunctionHeader(props) { const env = useContext(EnvContext); const globalContext = useContext(GlobalContext); - const nestedProperties = nestedFnProperties({state, setState, suggestionPriority}, env); - if (state.fn.kind === "call" && globalContext?.syntacticSugar) { + const nestedProperties = nestedFnProperties(props, env); + if (props.state.fn.kind === "call" && globalContext?.syntacticSugar) { // if the function we're calling is itself the result of a function call, // then we are anonymous, and so we don't draw a function name return ; @@ -102,21 +96,21 @@ function FunctionHeader({ state, setState, suggestionPriority }) { } } -function InputParams({ state, setState, suggestionPriority, depth, errorDepth }) { +function InputParams({ depth, errorDepth, ...rest }) { const env = useContext(EnvContext); const globalContext = useContext(GlobalContext); const isOffending = depth === errorDepth; return
- {state.fn.kind === "call" + {rest.state.fn.kind === "call" && globalContext?.syntacticSugar && } {/* Our own input param */}
; }