CPP: fix struct which have a field with the same name as the struct

The operator== reference the struct name, so if there is a
field with the same name, we should disambiguate

Fix  tests/cases/issues/name_conflicts.slint that was added in last
commit
This commit is contained in:
Olivier Goffart 2023-02-08 15:34:59 +01:00 committed by Olivier Goffart
parent 11d404a216
commit acb41d8244

View file

@ -659,7 +659,7 @@ fn generate_struct(file: &mut File, name: &str, fields: &BTreeMap<String, Type>)
Access::Public,
Declaration::Function(Function {
name: "operator==".to_owned(),
signature: format!("(const {0} &a, const {0} &b) -> bool = default", name),
signature: format!("(const class {0} &a, const class {0} &b) -> bool = default", name),
is_friend: true,
statements: None,
..Function::default()