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

optimize table.all_test_function_names

This commit is contained in:
yuyi 2020-02-21 23:29:41 +08:00 committed by GitHub
parent e9931e6f84
commit 15a2927f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -834,16 +834,22 @@ fn (t &Table) all_test_function_names() []string {
fn_end_test_name = f.name
}
}
mut res := []string
if fn_begin_test_name.len > 0 {
res << fn_begin_test_name
if fn_begin_test_name.len == 0 {
if fn_end_test_name.len > 0 {
fn_test_names << fn_end_test_name
}
return fn_test_names
}
else {
mut res := []string
res << fn_begin_test_name
res << fn_test_names
if fn_end_test_name.len > 0 {
res << fn_end_test_name
}
return res
}
}
fn (t &Table) find_const(name string) ?Var {
// println('find const l=$t.consts.len')