-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* semantic: model r/w access * chore: tests and review 🔧 * dev: handle module name error
- Loading branch information
Showing
10 changed files
with
383 additions
and
15 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
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
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,33 @@ | ||
use std::collections::HashMap; | ||
use std::sync::Mutex; | ||
|
||
use cairo_lang_syntax::node::ast::{ExprPath, ExprStructCtorCall}; | ||
use cairo_lang_syntax::node::kind::SyntaxKind; | ||
use cairo_lang_syntax::node::SyntaxNode; | ||
|
||
type ModuleName = String; | ||
type FunctionName = String; | ||
lazy_static::lazy_static! { | ||
pub static ref SYSTEM_WRITES: Mutex<HashMap<ModuleName, HashMap<FunctionName, Vec<SystemRWOpRecord>>>> = Default::default(); | ||
pub static ref SYSTEM_READS: Mutex<HashMap<ModuleName, Vec<String>>> = Default::default(); | ||
} | ||
|
||
pub enum SystemRWOpRecord { | ||
StructCtor(ExprStructCtorCall), | ||
Path(ExprPath), | ||
} | ||
|
||
pub fn parent_of_kind( | ||
db: &dyn cairo_lang_syntax::node::db::SyntaxGroup, | ||
target: &SyntaxNode, | ||
kind: SyntaxKind, | ||
) -> Option<SyntaxNode> { | ||
let mut new_target = target.clone(); | ||
while let Some(parent) = new_target.parent() { | ||
if kind == parent.kind(db) { | ||
return Some(parent); | ||
} | ||
new_target = parent; | ||
} | ||
None | ||
} |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
pub mod utils; | ||
|
||
#[cfg(test)] | ||
pub mod test_utils; | ||
|
||
|
Oops, something went wrong.