@@ -1617,7 +1617,11 @@ fn (mut g Gen) expr(node ast.Expr) {
16171617 // @STRUCT returns the name of the enclosing struct for methods
16181618 struct_name := if g.cur_fn_name.contains ('__' ) {
16191619 parts := g.cur_fn_name.split ('__' )
1620- if parts.len > = 2 { parts[parts.len - 2 ] } else { '' }
1620+ if parts.len > = 2 {
1621+ parts[parts.len - 2 ]
1622+ } else {
1623+ ''
1624+ }
16211625 } else {
16221626 ''
16231627 }
@@ -2038,16 +2042,16 @@ fn (mut g Gen) expr(node ast.Expr) {
20382042 // we need to emit the correct comparison for the actual type.
20392043 if g.active_generic_types.len > 0 && node.lhs is ast.Ident
20402044 && node.lhs.name in ['string__eq' , 'string__ne' , 'string__lt' , 'string__compare' ]
2041- && node.args.len == 2
2042- && (! g.generic_operand_is_string (node.args[0 ])
2045+ && node.args.len == 2 && (! g.generic_operand_is_string (node.args[0 ])
20432046 || ! g.generic_operand_is_string (node.args[1 ])) {
20442047 cmp_type := g.get_expr_type (node.args[0 ])
20452048 if cmp_type != '' && cmp_type != 'string' {
20462049 is_eq := node.lhs.name == 'string__eq'
20472050 is_ne := node.lhs.name == 'string__ne'
20482051 is_lt := node.lhs.name == 'string__lt'
20492052 // Primitive types: use == / != / < directly
2050- if cmp_type in ['int' , 'i8' , 'i16' , 'i32' , 'i64' , 'u8' , 'u16' , 'u32' , 'u64' , 'f32' , 'f64' , 'byte' , 'rune' , 'bool' , 'usize' , 'isize' ] {
2053+ if cmp_type in ['int' , 'i8' , 'i16' , 'i32' , 'i64' , 'u8' , 'u16' , 'u32' , 'u64' ,
2054+ 'f32' , 'f64' , 'byte' , 'rune' , 'bool' , 'usize' , 'isize' ] {
20512055 g.sb.write_string ('(' )
20522056 g.expr (node.args[0 ])
20532057 if is_eq {
0 commit comments