typedef: make it send
Rc in calls is not send, so we use Arc instead.
This commit is contained in:
parent
52dc112410
commit
a3acf09bda
|
@ -1,8 +1,7 @@
|
|||
use std::cell::RefCell;
|
||||
use std::{cell::RefCell, sync::Arc};
|
||||
use std::collections::HashMap;
|
||||
use std::convert::{TryInto, From};
|
||||
use std::iter::once;
|
||||
use std::rc::Rc;
|
||||
|
||||
use super::magic_methods::*;
|
||||
use super::symbol_resolver::SymbolResolver;
|
||||
|
@ -53,7 +52,7 @@ pub struct Inferencer<'a> {
|
|||
pub primitives: &'a PrimitiveStore,
|
||||
pub virtual_checks: &'a mut Vec<(Type, Type)>,
|
||||
pub variable_mapping: HashMap<String, Type>,
|
||||
pub calls: &'a mut HashMap<CodeLocation, Rc<Call>>,
|
||||
pub calls: &'a mut HashMap<CodeLocation, Arc<Call>>,
|
||||
}
|
||||
|
||||
struct NaiveFolder();
|
||||
|
@ -192,7 +191,7 @@ impl<'a> Inferencer<'a> {
|
|||
ret: Type,
|
||||
) -> InferenceResult {
|
||||
let call =
|
||||
Rc::new(Call { posargs: params, kwargs: HashMap::new(), ret, fun: RefCell::new(None) });
|
||||
Arc::new(Call { posargs: params, kwargs: HashMap::new(), ret, fun: RefCell::new(None) });
|
||||
let call = self.unifier.add_ty(TypeEnum::TCall(vec![call].into()));
|
||||
let fields = once((method, call)).collect();
|
||||
let record = self.unifier.add_record(fields);
|
||||
|
@ -389,7 +388,7 @@ impl<'a> Inferencer<'a> {
|
|||
.map(|v| fold::fold_keyword(self, v))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
let ret = self.unifier.get_fresh_var().0;
|
||||
let call = Rc::new(Call {
|
||||
let call = Arc::new(Call {
|
||||
posargs: args.iter().map(|v| v.custom.unwrap()).collect(),
|
||||
kwargs: keywords
|
||||
.iter()
|
||||
|
|
|
@ -42,7 +42,7 @@ struct TestEnvironment {
|
|||
pub id_to_name: HashMap<usize, String>,
|
||||
pub identifier_mapping: HashMap<String, Type>,
|
||||
pub virtual_checks: Vec<(Type, Type)>,
|
||||
pub calls: HashMap<CodeLocation, Rc<Call>>,
|
||||
pub calls: HashMap<CodeLocation, Arc<Call>>,
|
||||
}
|
||||
|
||||
impl TestEnvironment {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use itertools::{chain, zip, Itertools};
|
||||
use std::borrow::Cow;
|
||||
use std::{borrow::Cow, sync::Arc};
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::iter::once;
|
||||
|
@ -70,7 +70,7 @@ pub enum TypeEnum {
|
|||
TVirtual {
|
||||
ty: Type,
|
||||
},
|
||||
TCall(RefCell<Vec<Rc<Call>>>),
|
||||
TCall(RefCell<Vec<Arc<Call>>>),
|
||||
TFunc(FunSignature),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue