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

cgen: modify the temporary variable name of the previous pr 15744 (#15745)

This commit is contained in:
shove 2022-09-13 17:11:03 +08:00 committed by GitHub
parent 7cff7fb828
commit f51384c402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1344,14 +1344,14 @@ fn (mut g Gen) fn_call(node ast.CallExpr) {
ast.Var {
// Temp fix generate call fn error when the struct type of sumtype
// has the fn field and is same to the struct name.
mut is_need_cast := true
mut is_cast_needed := true
if node.left_type != 0 {
left_sym := g.table.sym(node.left_type)
if left_sym.kind == .struct_ && node.name == obj.name {
is_need_cast = false
is_cast_needed = false
}
}
if obj.smartcasts.len > 0 && is_need_cast {
if obj.smartcasts.len > 0 && is_cast_needed {
for _ in obj.smartcasts {
g.write('(*')
}