Refactor.

This commit is contained in:
Stephen Chung
2022-10-10 16:46:35 +08:00
parent 796206f293
commit d6b0f99781
15 changed files with 161 additions and 166 deletions

View File

@@ -322,10 +322,9 @@ impl FileModuleResolver {
let scope = Scope::new();
let m: Shared<_> = if let Some(global) = global {
Module::eval_ast_as_new_raw(engine, scope, global, &ast)
} else {
Module::eval_ast_as_new(scope, &ast, engine)
let m: Shared<_> = match global {
Some(global) => Module::eval_ast_as_new_raw(engine, scope, global, &ast),
None => Module::eval_ast_as_new(scope, &ast, engine),
}
.map_err(|err| Box::new(ERR::ErrorInModule(path.to_string(), err, pos)))?
.into();