Refine op-assignment.

This commit is contained in:
Stephen Chung
2021-04-24 11:55:40 +08:00
parent e58b57b6e7
commit 61b559a58f
5 changed files with 64 additions and 21 deletions

View File

@@ -11,6 +11,7 @@ use crate::optimize::OptimizationLevel;
use crate::packages::{Package, StandardPackage};
use crate::r#unsafe::unsafe_cast_var_name_to_lifetime;
use crate::syntax::CustomSyntax;
use crate::token::Token;
use crate::utils::get_hasher;
use crate::{
Dynamic, EvalAltResult, Identifier, ImmutableString, Module, Position, RhaiResult, Scope,
@@ -221,14 +222,14 @@ pub const FN_ANONYMOUS: &str = "anon$";
/// Standard equality comparison operator.
pub const OP_EQUALS: &str = "==";
/// Standard concatenation operator.
pub const OP_CONCAT: &str = "+=";
/// Standard method function for containment testing.
///
/// The `in` operator is implemented as a call to this method.
pub const OP_CONTAINS: &str = "contains";
/// Standard concatenation operator token.
pub const TOKEN_OP_CONCAT: Token = Token::PlusAssign;
/// Method of chaining.
#[cfg(any(not(feature = "no_index"), not(feature = "no_object")))]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
@@ -1792,7 +1793,7 @@ impl Engine {
mods,
state,
lib,
Some(OpAssignment::new(OP_CONCAT)),
Some(OpAssignment::new(TOKEN_OP_CONCAT)),
pos,
(&mut result).into(),
item,