Remove Option from source and use empty string as no source.

This commit is contained in:
Stephen Chung
2022-01-01 17:20:00 +08:00
parent 8329baea29
commit 135b1f54c2
10 changed files with 118 additions and 98 deletions

View File

@@ -46,9 +46,8 @@ impl Engine {
pub fn run_ast_with_scope(&self, scope: &mut Scope, ast: &AST) -> RhaiResultOf<()> {
let global = &mut GlobalRuntimeState::new();
let mut state = EvalState::new();
if ast.source_raw().is_some() {
global.source = ast.source_raw().cloned();
}
global.source = ast.source_raw().clone();
#[cfg(not(feature = "no_module"))]
{
global.embedded_module_resolver = ast.resolver().cloned();