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

cgen: last/first fix

This commit is contained in:
Alexander Medvednikov 2020-03-19 19:36:15 +01:00
parent b7a036945d
commit f37b9d99fe

View File

@ -762,6 +762,10 @@ fn (g mut Gen) expr(node ast.Expr) {
// && rec_sym.name == 'array' && receiver_name.starts_with('array') {
// `array_byte_clone` => `array_clone`
receiver_name = 'array'
if it.name in ['last', 'first'] {
return_type_str := g.typ(it.return_type)
g.write('*($return_type_str*)')
}
}
name := '${receiver_name}_$it.name'.replace('.', '__')
// if it.receiver_type != 0 {