mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
checker: fix -parallel-cc regression (part 1, workaround .filter(fn[c]) used in checker/orm.v) (#21238)
This commit is contained in:
parent
95426d53f0
commit
d25e349020
1 changed files with 7 additions and 3 deletions
|
@ -683,7 +683,8 @@ fn (c &Checker) get_field_foreign_table_type(table_field &ast.StructField) ast.T
|
||||||
// get_orm_non_primitive_fields filters the table fields by selecting only
|
// get_orm_non_primitive_fields filters the table fields by selecting only
|
||||||
// non-primitive fields such as arrays and structs.
|
// non-primitive fields such as arrays and structs.
|
||||||
fn (c &Checker) get_orm_non_primitive_fields(fields []ast.StructField) []ast.StructField {
|
fn (c &Checker) get_orm_non_primitive_fields(fields []ast.StructField) []ast.StructField {
|
||||||
return fields.filter(fn [c] (field ast.StructField) bool {
|
mut res := []ast.StructField{}
|
||||||
|
for field in fields {
|
||||||
type_with_no_option_flag := field.typ.clear_flag(.option)
|
type_with_no_option_flag := field.typ.clear_flag(.option)
|
||||||
is_struct := c.table.type_symbols[int(type_with_no_option_flag)].kind == .struct_
|
is_struct := c.table.type_symbols[int(type_with_no_option_flag)].kind == .struct_
|
||||||
is_array := c.table.sym(type_with_no_option_flag).kind == .array
|
is_array := c.table.sym(type_with_no_option_flag).kind == .array
|
||||||
|
@ -691,8 +692,11 @@ fn (c &Checker) get_orm_non_primitive_fields(fields []ast.StructField) []ast.Str
|
||||||
&& c.table.sym(c.table.sym(type_with_no_option_flag).array_info().elem_type).kind == .struct_
|
&& c.table.sym(c.table.sym(type_with_no_option_flag).array_info().elem_type).kind == .struct_
|
||||||
is_time := c.table.get_type_name(type_with_no_option_flag) == 'time.Time'
|
is_time := c.table.get_type_name(type_with_no_option_flag) == 'time.Time'
|
||||||
|
|
||||||
return (is_struct || is_array_with_struct_elements) && !is_time
|
if (is_struct || is_array_with_struct_elements) && !is_time {
|
||||||
})
|
res << field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// walkingdevel: Now I don't think it's a good solution
|
// walkingdevel: Now I don't think it's a good solution
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue