WORKING STEEL PROPER IMPLEMENTATION finally fixed
This commit is contained in:
@@ -18,18 +18,13 @@ pub enum Value {
|
||||
String(String),
|
||||
}
|
||||
|
||||
// TODO LEAKING MEMORY NEEDS IMIDATE FIX BEFORE PROD
|
||||
pub fn execute_script(
|
||||
script: &str,
|
||||
script: String,
|
||||
target_type: &str,
|
||||
) -> Result<Value, ExecutionError> {
|
||||
let mut vm = Engine::new();
|
||||
|
||||
// SAFETY: THIS IS NEEDS TO BE REDONE
|
||||
// Convert to Box<str> then leak to get 'static lifetime
|
||||
let static_script: &'static str = Box::leak(script.to_string().into_boxed_str());
|
||||
|
||||
let results = vm.compile_and_run_raw_program(static_script)
|
||||
let results = vm.compile_and_run_raw_program(script)
|
||||
.map_err(|e| ExecutionError::RuntimeError(e.to_string()))?;
|
||||
|
||||
let last_result = results.last()
|
||||
|
||||
Reference in New Issue
Block a user