1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

ast: fix const values defined in the wrong order (#17002)

This commit is contained in:
yuyi 2023-01-17 18:12:54 +08:00 committed by GitHub
parent 930e629d2e
commit 2034dcb4ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 0 deletions

View File

@ -2284,6 +2284,9 @@ pub fn (t &Table) dependent_names_in_expr(expr Expr) []string {
for elem_expr in expr.exprs {
names << t.dependent_names_in_expr(elem_expr)
}
names << t.dependent_names_in_expr(expr.len_expr)
names << t.dependent_names_in_expr(expr.cap_expr)
names << t.dependent_names_in_expr(expr.default_expr)
}
CallExpr {
for arg in expr.args {

View File

@ -0,0 +1,9 @@
[Info{
val: 'No data'
}, Info{
val: 'Data tag 1'
}, Info{
val: 'Data tag 2'
}, Info{
val: 'No data'
}]

View File

@ -0,0 +1,13 @@
const (
dat = 'Data tag ,No data'.split(',')
dd = []Info{len: 4, init: Info{if it in tag { dat[0] + it.str() } else { dat[1] }}}
tag = [1, 2]
)
struct Info {
val string
}
fn main() {
println(dd)
}