Avoid unnecessarily creating Scope.

This commit is contained in:
Stephen Chung
2023-01-11 11:42:46 +08:00
parent 6d64a75bd2
commit ea3efe654c
10 changed files with 40 additions and 32 deletions

View File

@@ -4,7 +4,7 @@
use crate::func::native::locked_write;
use crate::parser::{ParseSettingFlags, ParseState};
use crate::tokenizer::Token;
use crate::{Engine, LexError, Map, OptimizationLevel, RhaiResultOf, Scope};
use crate::{Engine, LexError, Map, OptimizationLevel, RhaiResultOf};
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
@@ -115,9 +115,8 @@ impl Engine {
);
let ast = {
let scope = Scope::new();
let interned_strings = &mut *locked_write(&self.interned_strings);
let state = &mut ParseState::new(&scope, interned_strings, tokenizer_control);
let state = &mut ParseState::new(None, interned_strings, tokenizer_control);
self.parse_global_expr(
stream.peekable(),