cgen: c2v infix fix
							parent
							
								
									2ab6ef7f0a
								
							
						
					
					
						commit
						0bdc213dc6
					
				| 
						 | 
				
			
			@ -1825,7 +1825,7 @@ fn (mut g Gen) stmt(node ast.Stmt) {
 | 
			
		|||
			g.global_decl(node)
 | 
			
		||||
		}
 | 
			
		||||
		ast.GotoLabel {
 | 
			
		||||
			g.writeln('${c_name(node.name)}: {}')
 | 
			
		||||
			g.writeln('${c_name(node.name)}: ')
 | 
			
		||||
		}
 | 
			
		||||
		ast.GotoStmt {
 | 
			
		||||
			g.write_v_source_line_info(node.pos)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -87,6 +87,10 @@ fn (mut g Gen) infix_expr_eq_op(node ast.InfixExpr) {
 | 
			
		|||
	right := g.unwrap(node.right_type)
 | 
			
		||||
	has_defined_eq_operator := g.table.has_method(left.sym, '==')
 | 
			
		||||
	has_alias_eq_op_overload := left.sym.info is ast.Alias && left.sym.has_method('==')
 | 
			
		||||
	if g.pref.translated && !g.is_builtin_mod {
 | 
			
		||||
		g.gen_plain_infix_expr(node)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if (left.typ.is_ptr() && right.typ.is_int()) || (right.typ.is_ptr() && left.typ.is_int()) {
 | 
			
		||||
		g.gen_plain_infix_expr(node)
 | 
			
		||||
	} else if (left.typ.idx() == ast.string_type_idx || (!has_defined_eq_operator
 | 
			
		||||
| 
						 | 
				
			
			@ -291,6 +295,10 @@ fn (mut g Gen) infix_expr_cmp_op(node ast.InfixExpr) {
 | 
			
		|||
	left := g.unwrap(node.left_type)
 | 
			
		||||
	right := g.unwrap(node.right_type)
 | 
			
		||||
	has_operator_overloading := g.table.has_method(left.sym, '<')
 | 
			
		||||
	if g.pref.translated && !g.is_builtin_mod {
 | 
			
		||||
		g.gen_plain_infix_expr(node)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if left.sym.kind == .struct_ && (left.sym.info as ast.Struct).generic_types.len > 0 {
 | 
			
		||||
		if node.op in [.le, .ge] {
 | 
			
		||||
			g.write('!')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue