Fix sync build.

This commit is contained in:
Stephen Chung
2022-11-24 16:05:23 +08:00
parent d1913edf3c
commit b4ef89b596
6 changed files with 25 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
//! Module that defines the public compilation API of [`Engine`].
use crate::func::native::locked_write;
use crate::parser::{ParseResult, ParseState};
use crate::{Engine, OptimizationLevel, Scope, AST};
#[cfg(feature = "no_std")]
@@ -221,7 +222,7 @@ impl Engine {
scripts.as_ref(),
self.token_mapper.as_ref().map(<_>::as_ref),
);
let interned_strings = &mut *self.interned_strings.borrow_mut();
let interned_strings = &mut *locked_write(&self.interned_strings);
let mut state = ParseState::new(self, scope, interned_strings, tokenizer_control);
let mut _ast = self.parse(&mut stream.peekable(), &mut state, optimization_level)?;
#[cfg(feature = "metadata")]
@@ -295,7 +296,7 @@ impl Engine {
self.lex_raw(&scripts, self.token_mapper.as_ref().map(<_>::as_ref));
let mut peekable = stream.peekable();
let interned_strings = &mut *self.interned_strings.borrow_mut();
let interned_strings = &mut *locked_write(&self.interned_strings);
let mut state = ParseState::new(self, scope, interned_strings, tokenizer_control);
self.parse_global_expr(&mut peekable, &mut state, |_| {}, self.optimization_level)
}

View File

@@ -1,6 +1,7 @@
//! Module that defines the public evaluation API of [`Engine`].
use crate::eval::{Caches, GlobalRuntimeState};
use crate::func::native::locked_write;
use crate::parser::ParseState;
use crate::types::dynamic::Variant;
use crate::{
@@ -118,7 +119,7 @@ impl Engine {
) -> RhaiResultOf<T> {
let scripts = [script];
let ast = {
let interned_strings = &mut *self.interned_strings.borrow_mut();
let interned_strings = &mut *locked_write(&self.interned_strings);
let (stream, tokenizer_control) =
self.lex_raw(&scripts, self.token_mapper.as_ref().map(<_>::as_ref));

View File

@@ -1,6 +1,7 @@
//! Module that defines JSON manipulation functions for [`Engine`].
#![cfg(not(feature = "no_object"))]
use crate::func::native::locked_write;
use crate::parser::{ParseSettingFlags, ParseState};
use crate::tokenizer::Token;
use crate::{Engine, LexError, Map, OptimizationLevel, RhaiResultOf, Scope};
@@ -118,7 +119,7 @@ impl Engine {
let ast = {
let scope = Scope::new();
let interned_strings = &mut *self.interned_strings.borrow_mut();
let interned_strings = &mut *locked_write(&self.interned_strings);
let mut state = ParseState::new(self, &scope, interned_strings, tokenizer_control);
self.parse_global_expr(

View File

@@ -1,6 +1,7 @@
//! Module that defines the public evaluation API of [`Engine`].
use crate::eval::{Caches, GlobalRuntimeState};
use crate::func::native::locked_write;
use crate::parser::ParseState;
use crate::{Engine, RhaiResultOf, Scope, AST};
#[cfg(feature = "no_std")]
@@ -57,7 +58,7 @@ impl Engine {
pub fn run_with_scope(&self, scope: &mut Scope, script: &str) -> RhaiResultOf<()> {
let scripts = [script];
let ast = {
let interned_strings = &mut *self.interned_strings.borrow_mut();
let interned_strings = &mut *locked_write(&self.interned_strings);
let (stream, tokenizer_control) =
self.lex_raw(&scripts, self.token_mapper.as_ref().map(<_>::as_ref));