Minor style changes and make sure no_shared works on all.

This commit is contained in:
Stephen Chung
2020-07-31 16:03:08 +08:00
parent dc1ed784f5
commit 871fcb38be
7 changed files with 246 additions and 168 deletions

View File

@@ -5,7 +5,7 @@ use crate::calc_fn_hash;
use crate::engine::{
search_imports, search_namespace, search_scope_only, Engine, Imports, State, KEYWORD_DEBUG,
KEYWORD_EVAL, KEYWORD_FN_PTR, KEYWORD_FN_PTR_CALL, KEYWORD_FN_PTR_CURRY, KEYWORD_PRINT,
KEYWORD_TYPE_OF, KEYWORD_SHARED,
KEYWORD_TYPE_OF,
};
use crate::error::ParseErrorType;
use crate::fn_native::{FnCallArgs, FnPtr};
@@ -14,9 +14,9 @@ use crate::optimize::OptimizationLevel;
use crate::parser::{Expr, ImmutableString, AST, INT};
use crate::result::EvalAltResult;
use crate::scope::Scope;
use crate::stdlib::ops::Deref;
use crate::token::Position;
use crate::utils::StaticVec;
use crate::stdlib::ops::Deref;
#[cfg(not(feature = "no_function"))]
use crate::{
@@ -34,6 +34,9 @@ use crate::engine::{FN_IDX_GET, FN_IDX_SET};
#[cfg(not(feature = "no_object"))]
use crate::engine::{Map, Target, FN_GET, FN_SET, KEYWORD_TAKE};
#[cfg(not(feature = "no_shared"))]
use crate::engine::KEYWORD_SHARED;
use crate::stdlib::{
any::{type_name, TypeId},
boxed::Box,
@@ -771,6 +774,7 @@ impl Engine {
}
// Handle shared()
#[cfg(not(feature = "no_shared"))]
if name == KEYWORD_SHARED && args_expr.len() == 1 {
let expr = args_expr.get(0).unwrap();
let value = self.eval_expr(scope, mods, state, lib, this_ptr, expr, level)?;