@@ -1572,22 +1572,20 @@ fn (mut g Gen) method_call(node ast.CallExpr) {
1572
1572
}
1573
1573
left_sym := g.table.sym (left_type)
1574
1574
final_left_sym := g.table.final_sym (left_type)
1575
- if left_sym.kind == .array || (final_left_sym.kind == .array
1576
- && node.name in ['filter' , 'map' , 'sort' , 'sorted' , 'contains' , 'any' , 'all' , 'insert' , 'prepend' ]) {
1575
+ if final_left_sym.kind == .array && ! (left_sym.kind == .alias && left_sym.has_method (node.name)) {
1577
1576
if g.gen_array_method_call (node, left_type) {
1578
1577
return
1579
1578
}
1580
- } else if left_sym.kind == .array_fixed && node.name == 'wait' {
1581
- g.gen_fixed_array_wait (node)
1582
- return
1583
1579
}
1584
-
1585
- if final_left_sym.kind == .map {
1580
+ if final_left_sym.kind == .map && ! (left_sym.kind == .alias && left_sym.has_method (node.name)) {
1586
1581
if g.gen_map_method_call (node, left_type, final_left_sym) {
1587
1582
return
1588
1583
}
1589
1584
}
1590
-
1585
+ if left_sym.kind == .array_fixed && node.name == 'wait' {
1586
+ g.gen_fixed_array_wait (node)
1587
+ return
1588
+ }
1591
1589
if left_sym.kind in [.sum_type, .interface_] {
1592
1590
prefix_name := if left_sym.kind == .sum_type { 'sumtype' } else { 'interface' }
1593
1591
match node.name {
@@ -1627,12 +1625,10 @@ fn (mut g Gen) method_call(node ast.CallExpr) {
1627
1625
receiver_type_name = g.resolve_receiver_name (node, unwrapped_rec_type, final_left_sym,
1628
1626
left_sym, typ_sym)
1629
1627
if final_left_sym.kind == .array && ! (left_sym.kind == .alias && left_sym.has_method (node.name))
1630
- && node.name in ['clear' , 'repeat' , 'sort_with_compare' , 'sorted_with_compare' , 'free' , 'push_many' , 'trim' , 'first' , 'last' , 'pop' , 'clone' , 'reverse' , 'slice' , 'pointers' ] {
1631
- if node.name in ['last' , 'first' , 'pop' ] {
1632
- return_type_str := g.typ (node.return_type)
1633
- cast_n++
1634
- g.write ('(*(${return_type_str} *)' )
1635
- }
1628
+ && node.name in ['last' , 'first' , 'pop' ] {
1629
+ return_type_str := g.typ (node.return_type)
1630
+ cast_n++
1631
+ g.write ('(*(${return_type_str} *)' )
1636
1632
}
1637
1633
mut name := util.no_dots ('${receiver_type_name} _${node.name} ' )
1638
1634
mut array_depth := - 1
0 commit comments