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

cgen: minor cleanup in infix_expr_arithmetic_op() (#18913)

This commit is contained in:
yuyi 2023-07-20 18:51:47 +08:00 committed by GitHub
parent 4daddd3e84
commit 09d743ac81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -723,10 +723,9 @@ fn (mut g Gen) gen_interface_is_op(node ast.InfixExpr) {
fn (mut g Gen) infix_expr_arithmetic_op(node ast.InfixExpr) {
left := g.unwrap(node.left_type)
right := g.unwrap(node.right_type)
if left.sym.kind == .struct_ && (left.sym.info as ast.Struct).generic_types.len > 0 {
concrete_types := (left.sym.info as ast.Struct).concrete_types
if left.sym.info is ast.Struct && left.sym.info.generic_types.len > 0 {
mut method_name := left.sym.cname + '_' + util.replace_op(node.op.str())
method_name = g.generic_fn_name(concrete_types, method_name)
method_name = g.generic_fn_name(left.sym.info.concrete_types, method_name)
g.write(method_name)
g.write('(')
g.expr(node.left)