-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started refactoring semantic resolution code
- Loading branch information
1 parent
2f3e57a
commit 605be09
Showing
9 changed files
with
369 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use super::{function_search_ctx::FunctionSearchCtx, job::FuncJob}; | ||
use crate::{resolved, workspace::fs::FsNodeId}; | ||
use indexmap::IndexMap; | ||
use std::collections::{HashMap, VecDeque}; | ||
|
||
pub struct ResolveCtx { | ||
pub jobs: VecDeque<FuncJob>, | ||
pub function_search_ctxs: IndexMap<FsNodeId, FunctionSearchCtx>, | ||
pub public_functions: HashMap<FsNodeId, HashMap<String, Vec<resolved::FunctionRef>>>, | ||
pub types_in_modules: HashMap<FsNodeId, HashMap<String, resolved::TypeDecl>>, | ||
pub globals_in_modules: HashMap<FsNodeId, HashMap<String, resolved::GlobalVarDecl>>, | ||
pub helper_exprs_in_modules: HashMap<FsNodeId, HashMap<String, resolved::HelperExprDecl>>, | ||
} | ||
|
||
impl ResolveCtx { | ||
pub fn new() -> Self { | ||
Self { | ||
jobs: Default::default(), | ||
function_search_ctxs: Default::default(), | ||
public_functions: HashMap::new(), | ||
types_in_modules: HashMap::new(), | ||
globals_in_modules: HashMap::new(), | ||
helper_exprs_in_modules: HashMap::new(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#[derive(Copy, Clone, Debug)] | ||
pub enum Initialized { | ||
Require, | ||
AllowUninitialized, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crate::{ | ||
resolved::{self, EnumRef, StructureRef, TypeAliasRef}, | ||
workspace::fs::FsNodeId, | ||
}; | ||
|
||
pub enum FuncJob { | ||
Regular(FsNodeId, usize, resolved::FunctionRef), | ||
} | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct TypeJob { | ||
pub physical_file_id: FsNodeId, | ||
pub type_aliases: Vec<TypeAliasRef>, | ||
pub structures: Vec<StructureRef>, | ||
pub enums: Vec<EnumRef>, | ||
} |
Oops, something went wrong.