Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v: fix -parallel-cc regression (part 1, workaround .filter(fn[c]) used in checker/orm.v) #21238

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions vlib/v/checker/orm.v
Original file line number Diff line number Diff line change
Expand Up @@ -683,16 +683,20 @@ 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
// non-primitive fields such as arrays and structs.
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)
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_with_struct_elements := is_array
&& 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'

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
Expand Down