From 838924d3f5b274046837f98319f37e7a70e2ed2a Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Fri, 24 May 2024 17:10:53 +0100 Subject: [PATCH] fix: in the circuit when internal functions are not imported the import statement list is not updated --- .../visitors/circuitInternalFunctionCallVisitor.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/transformers/visitors/circuitInternalFunctionCallVisitor.ts b/src/transformers/visitors/circuitInternalFunctionCallVisitor.ts index 4f828189b..1e1ea55ed 100644 --- a/src/transformers/visitors/circuitInternalFunctionCallVisitor.ts +++ b/src/transformers/visitors/circuitInternalFunctionCallVisitor.ts @@ -125,6 +125,8 @@ const internalCallVisitor = { state.state.newReturnParameterList.splice(nodeIndex,1); } }) + } else if (childNode.nodeType === 'ImportStatementList'){ + state.newImportStatementList = cloneDeep(childNode.imports); } }) if(state.circuitImport[index].isImported ==='true') { @@ -458,6 +460,8 @@ const internalCallVisitor = { childNode.body.postStatements.splice(!dupNode.index ? 0 : dupNode.index +1, 0, dupNode.node); }); reorderBoilerPlate(childNode.body.postStatements); + } else if (childNode.nodeType === 'ImportStatementList'){ + childNode.imports = [...new Set([...childNode.imports, ...state.newImportStatementList])]; } })