mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: prevent multiple same field initialization
This commit is contained in:
parent
db525524ee
commit
fe50aeb130
@ -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 = ')
|
||||
|
Loading…
Reference in New Issue
Block a user