Fix features.

This commit is contained in:
Stephen Chung
2020-07-01 22:21:43 +08:00
parent 7957c58def
commit 760c13d36e
9 changed files with 36 additions and 6 deletions

View File

@@ -2407,7 +2407,13 @@ impl Engine {
let mut maps = 0;
arr.iter().for_each(|value| match value {
Dynamic(Union::Array(_)) | Dynamic(Union::Map(_)) => {
Dynamic(Union::Array(_)) => {
let (a, m, _) = calc_size(value);
arrays += a;
maps += m;
}
#[cfg(not(feature = "no_object"))]
Dynamic(Union::Map(_)) => {
let (a, m, _) = calc_size(value);
arrays += a;
maps += m;
@@ -2423,7 +2429,13 @@ impl Engine {
let mut maps = 0;
map.values().for_each(|value| match value {
Dynamic(Union::Array(_)) | Dynamic(Union::Map(_)) => {
#[cfg(not(feature = "no_index"))]
Dynamic(Union::Array(_)) => {
let (a, m, _) = calc_size(value);
arrays += a;
maps += m;
}
Dynamic(Union::Map(_)) => {
let (a, m, _) = calc_size(value);
arrays += a;
maps += m;

View File

@@ -3,6 +3,7 @@ use crate::fn_native::FnPtr;
def_package!(crate:BasicFnPackage:"Basic Fn functions.", lib, {
lib.set_fn_1_mut("name", |f: &mut FnPtr| Ok(f.get_fn_name().clone()));
lib.set_getter_fn("name", |f: &mut FnPtr| Ok(f.get_fn_name().clone()));
#[cfg(not(feature = "no_object"))]
lib.set_getter_fn("name", |f: &mut FnPtr| Ok(f.get_fn_name().clone()));
});

View File

@@ -2194,6 +2194,7 @@ fn parse_let(
}
/// Parse an import statement.
#[cfg(not(feature = "no_module"))]
fn parse_import(
input: &mut TokenStream,
state: &mut ParseState,
@@ -2444,6 +2445,8 @@ fn parse_stmt(
Token::Let => parse_let(input, state, Normal, settings.level_up()),
Token::Const => parse_let(input, state, Constant, settings.level_up()),
#[cfg(not(feature = "no_module"))]
Token::Import => parse_import(input, state, settings.level_up()),
#[cfg(not(feature = "no_module"))]