Skip to content

Commit

Permalink
Handle delete test (#117)
Browse files Browse the repository at this point in the history
* delete

* fmt
  • Loading branch information
JalonSolov authored Aug 11, 2024
1 parent 8ec2890 commit 778b67e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion array_map.v
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ fn (mut app App) map_init(node CompositeLit) {
kv := elt as KeyValueExpr
app.key_value_expr(kv)
}
app.genln('}')
app.gen('}')
}
14 changes: 13 additions & 1 deletion fn_call.v
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ fn (mut app App) call_expr(call CallExpr) {
}
}
}

if fun is Ident && fun.name == 'delete' {
arg0 := call.args[0]
arg1 := call.args[1]
if arg0 is Ident && arg1 is BasicLit {
app.gen('${arg0.name}.${fun.name}(${arg1.value})')
}
return
}

if !is_println {
// app.is_fn_call = true
// app.expr(fun)
Expand All @@ -41,8 +51,10 @@ fn (mut app App) call_expr(call CallExpr) {
app.expr(fun)
}
}

app.gen('${fn_name}(') // fn_name is empty unless print
// In V println can only accept one argument, so convert multiple argumnents into a single string

// In V println can only accept one argument, so convert multiple arguments into a single string
// with concatenation:
// `println(a, b)` => `println('${a} ${b}')`
if is_println && call.args.len > 1 {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 778b67e

Please sign in to comment.