mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: allow all binary operations when translating code produced by c2v (#13964)
This commit is contained in:
parent
4666a27e5f
commit
6a820c2845
@ -576,8 +576,8 @@ pub fn (mut c Checker) infix_expr(mut node ast.InfixExpr) ast.Type {
|
|||||||
left_right_pos := left_pos.extend(right_pos)
|
left_right_pos := left_pos.extend(right_pos)
|
||||||
if left_type.is_any_kind_of_pointer()
|
if left_type.is_any_kind_of_pointer()
|
||||||
&& node.op in [.plus, .minus, .mul, .div, .mod, .xor, .amp, .pipe] {
|
&& node.op in [.plus, .minus, .mul, .div, .mod, .xor, .amp, .pipe] {
|
||||||
if (right_type.is_any_kind_of_pointer() && node.op != .minus)
|
if !c.pref.translated && ((right_type.is_any_kind_of_pointer() && node.op != .minus)
|
||||||
|| (!right_type.is_any_kind_of_pointer() && node.op !in [.plus, .minus]) {
|
|| (!right_type.is_any_kind_of_pointer() && node.op !in [.plus, .minus])) {
|
||||||
left_name := c.table.type_to_str(left_type)
|
left_name := c.table.type_to_str(left_type)
|
||||||
right_name := c.table.type_to_str(right_type)
|
right_name := c.table.type_to_str(right_type)
|
||||||
c.error('invalid operator `$node.op` to `$left_name` and `$right_name`', left_right_pos)
|
c.error('invalid operator `$node.op` to `$left_name` and `$right_name`', left_right_pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user