1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

ast: fix IfExpr.str() (#14595)

This commit is contained in:
yuyi 2022-06-02 15:28:31 +08:00 committed by GitHub
parent 8b0e843cb8
commit 545eaae77b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -363,6 +363,8 @@ pub fn (x Expr) str() string {
}
if i < x.branches.len - 1 || !x.has_else {
parts << ' ${dollar}if ' + branch.cond.str() + ' { '
} else if x.has_else && i == x.branches.len - 1 {
parts << '{ '
}
for stmt in branch.stmts {
parts << stmt.str()