mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
js: fix int division (#5701)
This commit is contained in:
parent
6b2777e681
commit
659aa8db3c
@ -1339,6 +1339,11 @@ fn (mut g JsGen) gen_infix_expr(it ast.InfixExpr) {
|
||||
}
|
||||
|
||||
g.expr(it.right)
|
||||
|
||||
// Int division: 2.5 -> 2 by prepending |0
|
||||
if it.op == .div && it.left_type == table.any_int_type_idx && it.right_type == table.any_int_type_idx {
|
||||
g.write('|0')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user