mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
This commit is contained in:
parent
3b8f2fe5f5
commit
00ef1a6c52
2 changed files with 20 additions and 0 deletions
|
@ -2601,6 +2601,9 @@ pub fn (t &Table) dependent_names_in_expr(expr Expr) []string {
|
|||
names << t.dependent_names_in_expr(expr.expr)
|
||||
}
|
||||
StructInit {
|
||||
if expr.has_update_expr {
|
||||
names << t.dependent_names_in_expr(expr.update_expr)
|
||||
}
|
||||
for field in expr.init_fields {
|
||||
names << t.dependent_names_in_expr(field.expr)
|
||||
}
|
||||
|
|
17
vlib/v/tests/consts/const_depend_update_expr_test.v
Normal file
17
vlib/v/tests/consts/const_depend_update_expr_test.v
Normal file
|
@ -0,0 +1,17 @@
|
|||
struct Cfg {
|
||||
id string
|
||||
name string
|
||||
}
|
||||
|
||||
pub const cfg1 = Cfg{
|
||||
...cfg0
|
||||
name: 'name1'
|
||||
}
|
||||
pub const cfg0 = Cfg{
|
||||
id: 'cfg0'
|
||||
name: 'name'
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
assert cfg1.id == 'cfg0'
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue