Skip to content

Commit

Permalink
fix underscore as var placeholder (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
JalonSolov authored Aug 26, 2024
1 parent 4ad9882 commit 092c34d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions assign_stmt.v
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
fn (mut app App) assign_stmt(assign AssignStmt, no_mut bool) {
// app.genln('//assign_stmt')
if !no_mut {
if assign.tok == ':=' {
app.gen('mut ')
for i, lhs_expr in assign.lhs {
if i == 0 {
match lhs_expr {
Ident {
if lhs_expr.name != '_' {
if !no_mut {
if assign.tok == ':=' {
app.gen('mut ')
}
}
}
}
else {}
}
}
}
for i, expr in assign.lhs {
app.expr(expr)
app.expr(lhs_expr)
if i < assign.lhs.len - 1 {
app.gen(', ')
}
Expand All @@ -17,8 +26,8 @@ fn (mut app App) assign_stmt(assign AssignStmt, no_mut bool) {
}
//
app.gen(assign.tok)
for expr in assign.rhs {
app.expr(expr)
for rhs_expr in assign.rhs {
app.expr(rhs_expr)
}
app.genln('')
}
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 092c34d

Please sign in to comment.