mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
gen: fix type_name for sumtype/interface pointers (#8769)
This commit is contained in:
parent
4213851e22
commit
fe007f9b16
@ -534,13 +534,15 @@ fn (mut g Gen) method_call(node ast.CallExpr) {
|
||||
if left_sym.kind == .sum_type && node.name == 'type_name' {
|
||||
g.write('tos3( /* $left_sym.name */ v_typeof_sumtype_${typ_sym.cname}( (')
|
||||
g.expr(node.left)
|
||||
g.write(').typ ))')
|
||||
dot := if node.left_type.is_ptr() { '->' } else { '.' }
|
||||
g.write(')${dot}typ ))')
|
||||
return
|
||||
}
|
||||
if left_sym.kind == .interface_ && node.name == 'type_name' {
|
||||
g.write('tos3( /* $left_sym.name */ v_typeof_interface_${typ_sym.cname}( (')
|
||||
g.expr(node.left)
|
||||
g.write(')._interface_idx ))')
|
||||
dot := if node.left_type.is_ptr() { '->' } else { '.' }
|
||||
g.write(')${dot}_interface_idx ))')
|
||||
return
|
||||
}
|
||||
if node.name == 'str' {
|
||||
|
Loading…
Reference in New Issue
Block a user