vfmt: fix segfault in update where the struct is not yet known
parent
0661273aad
commit
fa867578bc
|
@ -150,8 +150,11 @@ fn (mut p Parser) sql_stmt() ast.SqlStmt {
|
||||||
// fields := info.fields.filter(it.typ in [table.string_type, table.int_type, table.bool_type])
|
// fields := info.fields.filter(it.typ in [table.string_type, table.int_type, table.bool_type])
|
||||||
table_name = sym.name
|
table_name = sym.name
|
||||||
} else if kind == .update {
|
} else if kind == .update {
|
||||||
idx := p.table.find_type_idx(table_name)
|
if !p.pref.is_fmt {
|
||||||
table_type = table.new_type(idx)
|
// NB: in vfmt mode, v parses just a single file and table_name may not have been registered
|
||||||
|
idx := p.table.find_type_idx(table_name)
|
||||||
|
table_type = table.new_type(idx)
|
||||||
|
}
|
||||||
p.check_sql_keyword('where')
|
p.check_sql_keyword('where')
|
||||||
where_expr = p.expr(0)
|
where_expr = p.expr(0)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue