Skip to content
This repository was archived by the owner on Apr 27, 2023. It is now read-only.

Commit 47b292c

Browse files
committed
Undestroy the local function when call it
1 parent f6180c3 commit 47b292c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/runtime/environment.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,9 @@ impl Environment {
186186
.local_functions
187187
.iter()
188188
// Local functions must have an identifier.
189-
.position(|f| f.ident.as_ref().unwrap().ident == ident)
189+
.find(|f| f.ident.as_ref().unwrap().ident == ident)
190190
{
191-
Ok(Statement::Function(
192-
self.frame().local_functions.remove(local_func),
193-
))
191+
Ok(Statement::Function(local_func.clone()))
194192
} else if let Some(func) = self.get_global_function(ident) {
195193
// Not removing the global function from the environment.
196194
Ok(Statement::Function(func))

0 commit comments

Comments
 (0)