Skip to content

Commit

Permalink
bug fix: not all alias are included, give the corect order- first ali…
Browse files Browse the repository at this point in the history
…as is most recent.
  • Loading branch information
twoentartian committed Jun 14, 2024
1 parent 86f40de commit 8500b4b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
5 changes: 3 additions & 2 deletions tydi-lang-json-generator/src/test_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ fn duplicator_and_voider2() {
}

#[test]
fn generated_names_in_tydi_lang() {
fn rafflaele_generated_names_in_tydi_lang() {
let project = Project::new(format!("sample_project"));
{
let mut project_write = project.write().unwrap();
Expand All @@ -685,7 +685,7 @@ fn generated_names_in_tydi_lang() {
sum: UInt_64_tttt;
max: UInt_64_tttt;
min: UInt_64_tttt;
aaa: type3;
aaa: type4;
}
// Define the stream types
Expand All @@ -695,6 +695,7 @@ fn generated_names_in_tydi_lang() {
type1 = Bit(2);
type2 = type1;
type3 = type2;
type4 = type3;
"#);
let src_pack1 = String::from(r#"
package std;
Expand Down
19 changes: 12 additions & 7 deletions tydi-lang-parser/src/evaluation/evaluate_var.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,20 @@ pub fn evaluate_id_in_typed_value(id_in_typed_value: TypedValue, location: Optio
let (id_var, id_var_scope) = Scope::resolve_identifier(&id_name, &id_template_arg_exps, &CodeLocation::new_unknown(), scope.clone(), scope.clone(), relationships, evaluator.clone())?;
let id_typed_value = evaluate_var(id_var.clone(), id_var_scope.clone(), evaluator.clone())?;
output_value = evaluate_value_with_identifier_type(&id_name, id_typed_value, id_type, scope.clone(), evaluator.clone())?;
match original_var.clone() {
Some(original_var) => {
original_var.write().unwrap().add_alias(id.read().unwrap().get_id());
let alias_of_id_var = id_var.read().unwrap().get_alias();
for a in alias_of_id_var {
original_var.write().unwrap().add_alias(a);
}
},
None => (),
}
},
}
match original_var.clone() {
Some(original_var) => {
original_var.write().unwrap().add_alias(id.read().unwrap().get_id());
},
None => (),
}
},

_ => (),
}

Expand Down Expand Up @@ -201,10 +206,10 @@ pub fn evaluate_var(var: Arc<RwLock<Variable>>, scope: Arc<RwLock<Scope>>, evalu
{
let mut var_write = var.write().unwrap();
let parent_var_alias = logic_type.read().unwrap().get_alias();
var_write.add_alias(id);
for a in parent_var_alias {
var_write.add_alias(a);
}
var_write.add_alias(id);
var_write.set_value(real_logic_type.clone());
var_write.set_evaluated(EvaluationStatus::Evaluated);
}
Expand Down

0 comments on commit 8500b4b

Please sign in to comment.