mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Fix scheduling statements that don't create bindings (#40)
Ensure that definitions are added even if no var is being defined. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
0af8b6ea12
commit
02c6c6b827
@@ -776,12 +776,21 @@ impl<'a> Analyzer<'a> {
|
||||
)?;
|
||||
self.process_comprs(&comprs[..], scope, first_use, &mut used_vars)?;
|
||||
let check_first_use = *op == AssignOp::ColEq;
|
||||
for var in self.gather_assigned_vars(lhs, scope, check_first_use, first_use)? {
|
||||
let assigned_vars =
|
||||
self.gather_assigned_vars(lhs, scope, check_first_use, first_use)?;
|
||||
|
||||
for var in &assigned_vars {
|
||||
definitions.push(Definition {
|
||||
var,
|
||||
used_vars: used_vars.clone(),
|
||||
});
|
||||
}
|
||||
if assigned_vars.is_empty() {
|
||||
definitions.push(Definition {
|
||||
var: "",
|
||||
used_vars: used_vars.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
{
|
||||
let (mut used_vars, comprs) = Self::gather_used_vars_comprs_index_vars(
|
||||
@@ -792,12 +801,20 @@ impl<'a> Analyzer<'a> {
|
||||
)?;
|
||||
let check_first_use = false;
|
||||
self.process_comprs(&comprs[..], scope, first_use, &mut used_vars)?;
|
||||
for var in self.gather_assigned_vars(rhs, scope, check_first_use, first_use)? {
|
||||
let assigned_vars =
|
||||
self.gather_assigned_vars(rhs, scope, check_first_use, first_use)?;
|
||||
for var in &assigned_vars {
|
||||
definitions.push(Definition {
|
||||
var,
|
||||
used_vars: used_vars.clone(),
|
||||
});
|
||||
}
|
||||
if assigned_vars.is_empty() {
|
||||
definitions.push(Definition {
|
||||
var: "",
|
||||
used_vars: used_vars.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +140,8 @@ fn run_opa_tests() -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
std::fs::write(path.join(format!("query{n}.text")), case.query.as_bytes())?;
|
||||
|
||||
println!("failed");
|
||||
entry.1 += 1;
|
||||
n += 1;
|
||||
|
||||
Reference in New Issue
Block a user