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

cgen: fix map clone (#7366)

This commit is contained in:
Ned Palacios
2020-12-17 15:44:50 +08:00
committed by GitHub
parent 8addb31440
commit c164586fd5
3 changed files with 18 additions and 1 deletions

View File

@@ -382,6 +382,9 @@ fn (mut g Gen) method_call(node ast.CallExpr) {
g.gen_str_for_type(node.receiver_type)
}
mut has_cast := false
if left_sym.kind == .map && node.name == 'clone' {
receiver_type_name = 'map'
}
// TODO performance, detect `array` method differently
if left_sym.kind == .array && node.name in
['repeat', 'sort_with_compare', 'free', 'push_many', 'trim', 'first', 'last', 'pop', 'clone', 'reverse', 'slice'] {