Unify execution state into a single struct (#3877)

* Add ExecState that combines ProgramMemory and DynamicState

* Remove unneeded clones

* Add exec_state parameter to all KCL stdlib functions

* Move pipe value into ExecState

* Add test for pipe substitution not leaking into function calls

* KCL: Better message on assertEqual function

Also add a new no-visual test for performance testing.

* Fix new array module to use ExecState

---------

Co-authored-by: Adam Chalmers <adam.chalmers@zoo.dev>
This commit is contained in:
Jonathan Tran
2024-09-16 15:10:33 -04:00
committed by GitHub
parent c4ff1c2ef1
commit 0ff820d4da
44 changed files with 765 additions and 709 deletions

View File

@ -78,15 +78,17 @@ pub(crate) struct MyFunc {}
#[doc = "Std lib function: myFunc\nThis is some function.\nIt does shit."]
pub(crate) const MyFunc: MyFunc = MyFunc {};
fn boxed_my_func(
exec_state: &mut crate::executor::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
> + Send,
> + Send
+ '_,
>,
> {
Box::pin(my_func(args))
Box::pin(my_func(exec_state, args))
}
impl crate::docs::StdLibFn for MyFunc {