WIP: Target#437
Conversation
Indexes allow associating extra data with nodes in the AST using an array and then quickly looking up the array to fetch the extra data. - Index eidx for expressions - Index sidx for statements - Index qidx for queries. AST nodes are not cloneable. Therefore once a module is created, it is not possible to accidentally create two nodes with the same index inadvertently via clone. Also added IndexChecker in debug builds. When a module is parsed, it will assert that indexes have been constructed correctly. AST Cleanup - Make literal expressions (null, val, number, string etc) also structs to match all other expressions - Merge True and False nodes into a single Bool node. Also update dependencies. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
| } | ||
|
|
||
| pub fn validate(&mut self) -> Result<()> { | ||
| let mut target = None; |
Check warning
Code scanning / clippy
variable target is assigned to, but never used Warning
| let mut target = None; | ||
| for m in self.modules.iter() { | ||
| if m.target.is_some() { | ||
| target = m.target.clone(); |
Check warning
Code scanning / clippy
value assigned to target is never read Warning
| } | ||
| } | ||
|
|
||
| impl Schema { |
Check warning
Code scanning / clippy
method get_property is never used Warning
| } | ||
|
|
||
| impl Schema { | ||
| pub fn get_property(&self, name: &str) -> Result<Schema> { |
Check warning
Code scanning / clippy
method get_property is never used Warning
| use crate::*; | ||
| use crate::{schema::*, target::Target}; | ||
|
|
||
| use alloc::collections::BTreeMap; |
Check warning
Code scanning / clippy
unused import: alloc::collections::BTreeMap Warning
| Ok(()) | ||
| } | ||
|
|
||
| fn check_query(&mut self, query: &Query) -> Result<()> { |
Check warning
Code scanning / clippy
multiple associated items are never used Warning
| Ok(()) | ||
| } | ||
|
|
||
| fn check_rule_body(&mut self, name: &String, body: &RuleBody) -> Result<()> { |
Check warning
Code scanning / clippy
multiple associated items are never used Warning
| Ok(()) | ||
| } | ||
|
|
||
| fn check_rule(&mut self, name: &String, rule: &Ref<Rule>) -> Result<Schema> { |
Check warning
Code scanning / clippy
multiple associated items are never used Warning
| Ok(Schema::default()) | ||
| } | ||
|
|
||
| fn check_rules(&mut self, name: &String, rules: &[Ref<Rule>]) -> Result<()> { |
Check warning
Code scanning / clippy
multiple associated items are never used Warning
| Ok(()) | ||
| } | ||
|
|
||
| pub fn check(&mut self) -> Result<()> { |
Check warning
Code scanning / clippy
multiple associated items are never used Warning
In progress implementation of "targets".
Typechecking is in the process of being rewritten to using JSON schema.