1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00

Function call flattening bugfix

This commit is contained in:
Jacob Eberhardt 2017-10-28 14:10:51 +02:00
parent 572250a4ad
commit 884c71c288

View file

@ -471,19 +471,24 @@ impl Flattener {
Statement::Return(x) => {
let result = x.apply_substitution(&temp_substitution)
.apply_substitution(&self.substitution);
println!("substitutions:\n {:?}", &self.substitution);
return result;
}
Statement::Definition(var, rhs) => {
let new_rhs = rhs.apply_substitution(&temp_substitution)
.apply_substitution(&self.substitution);
let subsvar = self.use_variable(&var);
temp_substitution.insert(var.clone(), subsvar.clone());
statements_flattened.push(
Statement::Definition(self.use_variable(&var), new_rhs),
Statement::Definition(subsvar, new_rhs),
);
}
Statement::Compiler(var, rhs) => {
let new_rhs = rhs.apply_substitution(&temp_substitution)
.apply_substitution(&self.substitution);
statements_flattened.push(Statement::Compiler(self.use_variable(&var), new_rhs));
let subsvar = self.use_variable(&var);
temp_substitution.insert(var.clone(), subsvar.clone());
statements_flattened.push(Statement::Compiler(subsvar, new_rhs));
}
Statement::Condition(lhs, rhs) => {
let new_lhs = lhs.apply_substitution(&temp_substitution)