forked from M-Labs/nac3
1
0
Fork 0

add Sync bound to Symbol resolver in top level

This commit is contained in:
ychenfo 2021-08-13 14:22:49 +08:00
parent 3f65e1b133
commit 33391c55c2
1 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ pub enum TopLevelDef {
// ancestor classes, including itself. // ancestor classes, including itself.
ancestors: Vec<DefinitionId>, ancestors: Vec<DefinitionId>,
// symbol resolver of the module defined the class, none if it is built-in type // symbol resolver of the module defined the class, none if it is built-in type
resolver: Option<Arc<Mutex<dyn SymbolResolver + Send>>>, resolver: Option<Arc<Mutex<dyn SymbolResolver + Send + Sync>>>,
}, },
Function { Function {
// prefix for symbol, should be unique globally, and not ending with numbers // prefix for symbol, should be unique globally, and not ending with numbers
@ -46,7 +46,7 @@ pub enum TopLevelDef {
/// rigid type variables that would be substituted when the function is instantiated. /// rigid type variables that would be substituted when the function is instantiated.
instance_to_stmt: HashMap<String, (Stmt<Option<Type>>, usize)>, instance_to_stmt: HashMap<String, (Stmt<Option<Type>>, usize)>,
// symbol resolver of the module defined the class // symbol resolver of the module defined the class
resolver: Option<Arc<Mutex<dyn SymbolResolver + Send>>>, resolver: Option<Arc<Mutex<dyn SymbolResolver + Send + Sync>>>,
}, },
Initializer { Initializer {
class_id: DefinitionId, class_id: DefinitionId,
@ -167,7 +167,7 @@ impl TopLevelComposer {
/// already include the definition_id of itself inside the ancestors vector /// already include the definition_id of itself inside the ancestors vector
pub fn make_top_level_class_def( pub fn make_top_level_class_def(
index: usize, index: usize,
resolver: Option<Arc<Mutex<dyn SymbolResolver + Send>>>, resolver: Option<Arc<Mutex<dyn SymbolResolver + Send + Sync>>>,
) -> TopLevelDef { ) -> TopLevelDef {
TopLevelDef::Class { TopLevelDef::Class {
object_id: DefinitionId(index), object_id: DefinitionId(index),
@ -182,7 +182,7 @@ impl TopLevelComposer {
pub fn make_top_level_function_def( pub fn make_top_level_function_def(
name: String, name: String,
ty: Type, ty: Type,
resolver: Option<Arc<Mutex<dyn SymbolResolver + Send>>>, resolver: Option<Arc<Mutex<dyn SymbolResolver + Send + Sync>>>,
) -> TopLevelDef { ) -> TopLevelDef {
TopLevelDef::Function { TopLevelDef::Function {
name, name,
@ -196,7 +196,7 @@ impl TopLevelComposer {
pub fn register_top_level( pub fn register_top_level(
&mut self, &mut self,
ast: ast::Stmt<()>, ast: ast::Stmt<()>,
resolver: Option<Arc<Mutex<dyn SymbolResolver + Send>>>, resolver: Option<Arc<Mutex<dyn SymbolResolver + Send + Sync>>>,
) -> Result<(String, DefinitionId, Type), String> { ) -> Result<(String, DefinitionId, Type), String> {
// get write access to the lists // get write access to the lists
let ( let (