This commit is contained in:
MetricExpansion 2023-02-10 19:22:33 -08:00
parent c6ca53f9bc
commit 3e682b2bdb

View file

@ -9,9 +9,9 @@ use hash_hasher::HashedMap;
use once_cell::sync::Lazy;
use regex::Regex;
use rhai::plugin::*;
use rhai::{Engine, CallFnOptions, Module, Scope, AST};
use rhai::{CallFnOptions, Engine, Module, Scope, AST};
use std::any::Any;
use std::borrow::{Cow};
use std::borrow::Cow;
use std::collections::HashMap;
use std::error::Error;
use std::path::PathBuf;
@ -112,7 +112,7 @@ impl ScriptStore {
let Some(script) = self.scripts.get(&id) else {
log::error!("Got invalid script id = {}", id);
return None;
};
};
if SETTINGS.script_hot_reloading_enabled() {
let compile_result = self.engine.compile_file(script.path.clone());
match compile_result {
@ -132,11 +132,16 @@ impl ScriptStore {
if let Some(ast) = &script.ast {
Some((script, Cow::Borrowed(ast)))
} else {
log::error!("No compiled AST found for script Name={} ID={} Path={:?}", script.name, script.id, script.path);
log::error!(
"No compiled AST found for script Name={} ID={} Path={:?}",
script.name,
script.id,
script.path
);
return None;
}
}
}
}
}
// TODO: We want to minimize direct accesses of this as much as we can.