Fix no_module build.

This commit is contained in:
Stephen Chung 2020-11-09 12:50:18 +08:00
parent 4b622a8830
commit 173f8474d6
2 changed files with 7 additions and 4 deletions

View File

@ -23,6 +23,7 @@ Enhancements
------------
* Modules imported via `import` statements at global level can now be used in functions. There is no longer any need to re-`import` the modules at the beginning of each function block.
* `export` keyword can now be tagged onto `let` and `const` statements as a short-hand.
* `index_of`, `==` and `!=` are defined for arrays.
* `==` and `!=` are defined for object maps.

View File

@ -3,7 +3,7 @@
use crate::ast::{BinaryExpr, Expr, FnCallInfo, Ident, IdentX, ReturnType, Stmt};
use crate::dynamic::{map_std_type_name, Dynamic, Union, Variant};
use crate::fn_call::run_builtin_op_assignment;
use crate::fn_native::{shared_try_take, Callback, FnPtr, OnVarCallback, Shared};
use crate::fn_native::{Callback, FnPtr, OnVarCallback, Shared};
use crate::module::{Module, ModuleRef};
use crate::optimize::OptimizationLevel;
use crate::packages::{Package, PackagesCollection, StandardPackage};
@ -18,10 +18,11 @@ use crate::{calc_native_fn_hash, StaticVec};
use crate::INT;
#[cfg(not(feature = "no_module"))]
use crate::module::ModuleResolver;
use crate::{fn_native::shared_try_take, module::ModuleResolver};
#[cfg(not(feature = "no_std"))]
#[cfg(not(feature = "no_module"))]
#[cfg(not(target_arch = "wasm32"))]
use crate::module::resolvers;
#[cfg(any(not(feature = "no_object"), not(feature = "no_module")))]
@ -2105,7 +2106,7 @@ impl Engine {
} else {
().into()
};
let (var_name, alias): (Cow<'_, str>, _) = if state.is_global() {
let (var_name, _alias): (Cow<'_, str>, _) = if state.is_global() {
(
var_def.name.clone().into(),
if *export {
@ -2121,7 +2122,8 @@ impl Engine {
};
scope.push_dynamic_value(var_name, entry_type, val);
if let Some(alias) = alias {
#[cfg(not(feature = "no_module"))]
if let Some(alias) = _alias {
scope.set_entry_alias(scope.len() - 1, alias);
}
Ok(Default::default())