Fix builds.

This commit is contained in:
Stephen Chung 2022-12-03 12:08:35 +08:00
parent 4e33bcfa0a
commit ffc8a7f85c
5 changed files with 9 additions and 11 deletions

View File

@ -52,9 +52,6 @@ pub const FN_ANONYMOUS: &str = "anon$";
/// function to compare two [`Dynamic`] values. /// function to compare two [`Dynamic`] values.
pub const OP_EQUALS: &str = Token::EqualsTo.literal_syntax(); pub const OP_EQUALS: &str = Token::EqualsTo.literal_syntax();
/// Standard not operator.
pub const OP_NOT: &str = Token::Bang.literal_syntax();
/// Standard concatenation operator. /// Standard concatenation operator.
/// ///
/// Used primarily to build up interpolated strings. /// Used primarily to build up interpolated strings.

View File

@ -187,6 +187,7 @@ impl Engine {
Target::RefMut(_) | Target::TempValue(_) => { Target::RefMut(_) | Target::TempValue(_) => {
*target.write_lock::<Dynamic>().unwrap() = new_val *target.write_lock::<Dynamic>().unwrap() = new_val
} }
#[allow(unreachable_patterns)]
_ => **target = new_val, _ => **target = new_val,
} }
} }

View File

@ -8,7 +8,6 @@
use super::call::FnCallArgs; use super::call::FnCallArgs;
use super::callable_function::CallableFunction; use super::callable_function::CallableFunction;
use super::native::{SendSync, Shared}; use super::native::{SendSync, Shared};
use crate::engine::{FN_IDX_SET, FN_SET};
use crate::types::dynamic::{DynamicWriteLock, Variant}; use crate::types::dynamic::{DynamicWriteLock, Variant};
use crate::{reify, Dynamic, NativeCallContext, RhaiResultOf}; use crate::{reify, Dynamic, NativeCallContext, RhaiResultOf};
#[cfg(feature = "no_std")] #[cfg(feature = "no_std")]
@ -114,11 +113,11 @@ macro_rules! check_constant {
#[cfg(not(feature = "no_index"))] #[cfg(not(feature = "no_index"))]
if $n == 3 && !deny { if $n == 3 && !deny {
deny = $ctx.fn_name() == FN_IDX_SET && $args[0].is_read_only(); deny = $ctx.fn_name() == crate::engine::FN_IDX_SET && $args[0].is_read_only();
} }
#[cfg(not(feature = "no_object"))] #[cfg(not(feature = "no_object"))]
if $n == 2 && !deny { if $n == 2 && !deny {
deny = $ctx.fn_name().starts_with(FN_SET) && $args[0].is_read_only(); deny = $ctx.fn_name().starts_with(crate::engine::FN_SET) && $args[0].is_read_only();
} }
if deny { if deny {

View File

@ -10,7 +10,7 @@ use crate::func::{
use crate::types::{dynamic::Variant, BloomFilterU64, CustomTypesCollection}; use crate::types::{dynamic::Variant, BloomFilterU64, CustomTypesCollection};
use crate::{ use crate::{
calc_fn_hash, calc_fn_hash_full, Dynamic, FnArgsVec, Identifier, ImmutableString, calc_fn_hash, calc_fn_hash_full, Dynamic, FnArgsVec, Identifier, ImmutableString,
NativeCallContext, RhaiResultOf, Shared, SharedModule, SmartString, StaticVec, NativeCallContext, RhaiResultOf, Shared, SharedModule, SmartString,
}; };
use bitflags::bitflags; use bitflags::bitflags;
#[cfg(feature = "no_std")] #[cfg(feature = "no_std")]
@ -2084,7 +2084,7 @@ impl Module {
let mut module = Module::new(); let mut module = Module::new();
// Extra modules left become sub-modules // Extra modules left become sub-modules
let mut imports = StaticVec::new_const(); let mut imports = crate::StaticVec::new_const();
if result.is_ok() { if result.is_ok() {
global global

View File

@ -4,9 +4,7 @@
use crate::ast::{ use crate::ast::{
ASTFlags, Expr, OpAssignment, Stmt, StmtBlock, StmtBlockContainer, SwitchCasesCollection, ASTFlags, Expr, OpAssignment, Stmt, StmtBlock, StmtBlockContainer, SwitchCasesCollection,
}; };
use crate::engine::{ use crate::engine::{KEYWORD_DEBUG, KEYWORD_EVAL, KEYWORD_FN_PTR, KEYWORD_PRINT, KEYWORD_TYPE_OF};
KEYWORD_DEBUG, KEYWORD_EVAL, KEYWORD_FN_PTR, KEYWORD_PRINT, KEYWORD_TYPE_OF, OP_NOT,
};
use crate::eval::{Caches, GlobalRuntimeState}; use crate::eval::{Caches, GlobalRuntimeState};
use crate::func::builtin::get_builtin_binary_op_fn; use crate::func::builtin::get_builtin_binary_op_fn;
use crate::func::hashing::get_hasher; use crate::func::hashing::get_hasher;
@ -26,6 +24,9 @@ use std::{
mem, mem,
}; };
/// Standard not operator.
const OP_NOT: &str = Token::Bang.literal_syntax();
/// Level of optimization performed. /// Level of optimization performed.
#[derive(Debug, Eq, PartialEq, Hash, Clone, Copy)] #[derive(Debug, Eq, PartialEq, Hash, Clone, Copy)]
#[non_exhaustive] #[non_exhaustive]