compiler: prevent multiple same field initialization

pull/1752/head
Henrixounez 2019-08-25 19:51:59 +02:00 committed by Alexander Medvednikov
parent db525524ee
commit fe50aeb130
1 changed files with 3 additions and 0 deletions

View File

@ -2856,6 +2856,9 @@ p.gen('($no_star*)memdup(&($no_star) {') //sizeof(Node));
if !t.has_field(field) {
p.error('`$t.name` has no field `$field`')
}
if inited_fields.contains(field) {
p.error('already initialized field `$field` in `$t.name`')
}
f := t.find_field(field)
inited_fields << field
p.gen('.$field = ')