mirror of
https://github.com/vlang/v.git
synced 2025-09-13 09:25:45 -04:00
cgen: small cleanup in write_sumtype_casting_fn
This commit is contained in:
parent
2fcad534db
commit
35e0039ff2
@ -2700,7 +2700,6 @@ fn (mut g Gen) write_sumtype_casting_fn(fun SumtypeCastingFn) {
|
|||||||
mut got_cname, exp_cname := g.get_sumtype_variant_type_name(got, got_sym), exp_sym.cname
|
mut got_cname, exp_cname := g.get_sumtype_variant_type_name(got, got_sym), exp_sym.cname
|
||||||
mut type_idx := g.type_sidx(got)
|
mut type_idx := g.type_sidx(got)
|
||||||
mut sb := strings.new_builder(128)
|
mut sb := strings.new_builder(128)
|
||||||
mut is_anon_fn := false
|
|
||||||
mut variant_name := g.get_sumtype_variant_name(got, got_sym)
|
mut variant_name := g.get_sumtype_variant_name(got, got_sym)
|
||||||
if got_sym.info is ast.FnType {
|
if got_sym.info is ast.FnType {
|
||||||
got_name := 'fn ${g.table.fn_type_source_signature(got_sym.info.func)}'
|
got_name := 'fn ${g.table.fn_type_source_signature(got_sym.info.func)}'
|
||||||
@ -2720,9 +2719,7 @@ fn (mut g Gen) write_sumtype_casting_fn(fun SumtypeCastingFn) {
|
|||||||
}
|
}
|
||||||
sb.writeln('static inline ${exp_cname} ${fun.fn_name}(${got_cname} x) {')
|
sb.writeln('static inline ${exp_cname} ${fun.fn_name}(${got_cname} x) {')
|
||||||
sb.writeln('\t${got_cname} ptr = x;')
|
sb.writeln('\t${got_cname} ptr = x;')
|
||||||
is_anon_fn = true
|
} else {
|
||||||
}
|
|
||||||
if !is_anon_fn {
|
|
||||||
// g.definitions.writeln('${g.static_modifier} inline ${exp_cname} ${fun.fn_name}(${got_cname}* x);')
|
// g.definitions.writeln('${g.static_modifier} inline ${exp_cname} ${fun.fn_name}(${got_cname}* x);')
|
||||||
// sb.writeln('${g.static_modifier} inline ${exp_cname} ${fun.fn_name}(${got_cname}* x) {')
|
// sb.writeln('${g.static_modifier} inline ${exp_cname} ${fun.fn_name}(${got_cname}* x) {')
|
||||||
g.definitions.writeln('${exp_cname} ${fun.fn_name}(${got_cname}* x);')
|
g.definitions.writeln('${exp_cname} ${fun.fn_name}(${got_cname}* x);')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user