mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: if-is smartcast part 1 (#5730)
This commit is contained in:
@ -425,10 +425,10 @@ pub mut:
|
||||
pub struct IfExpr {
|
||||
pub:
|
||||
tok_kind token.Kind
|
||||
branches []IfBranch
|
||||
left Expr // `a` in `a := if ...`
|
||||
pos token.Position
|
||||
pub mut:
|
||||
branches []IfBranch
|
||||
is_expr bool
|
||||
typ table.Type
|
||||
has_else bool
|
||||
@ -439,7 +439,10 @@ pub:
|
||||
cond Expr
|
||||
stmts []Stmt
|
||||
pos token.Position
|
||||
body_pos token.Position
|
||||
comments []Comment
|
||||
pub mut:
|
||||
smartcast bool // should only be true if cond is `x is sumtype`, it will be set in checker - if_expr
|
||||
}
|
||||
|
||||
pub struct LockExpr {
|
||||
|
@ -286,7 +286,7 @@ pub fn (node Stmt) str() string {
|
||||
}
|
||||
}
|
||||
out += left.str()
|
||||
if i < it.left.len - 1 {
|
||||
if i < node.left.len - 1 {
|
||||
out += ','
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user