checker: check if $if left is selector expr (#7897)
parent
7135773975
commit
c137a79666
|
@ -4237,11 +4237,13 @@ pub fn (mut c Checker) if_expr(mut node ast.IfExpr) table.Type {
|
||||||
// smartcast field type on comptime if
|
// smartcast field type on comptime if
|
||||||
if branch.cond is ast.InfixExpr {
|
if branch.cond is ast.InfixExpr {
|
||||||
if branch.cond.op == .key_is {
|
if branch.cond.op == .key_is {
|
||||||
se := branch.cond.left as ast.SelectorExpr
|
se := branch.cond.left
|
||||||
|
if se is ast.SelectorExpr {
|
||||||
got_type := (branch.cond.right as ast.Type).typ
|
got_type := (branch.cond.right as ast.Type).typ
|
||||||
c.comptime_fields_type[se.expr.str()] = got_type
|
c.comptime_fields_type[se.expr.str()] = got_type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
cur_skip_flags := c.skip_flags
|
cur_skip_flags := c.skip_flags
|
||||||
if found_branch {
|
if found_branch {
|
||||||
c.skip_flags = true
|
c.skip_flags = true
|
||||||
|
|
Loading…
Reference in New Issue