Skip to content

Commit

Permalink
gen: change gen.ret_typ() to gen.ret_styp()
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 committed Oct 21, 2024
1 parent 6c59843 commit 49640c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions vlib/v/gen/c/cgen.v
Original file line number Diff line number Diff line change
Expand Up @@ -5525,7 +5525,7 @@ fn (mut g Gen) return_stmt(node ast.Return) {
}
tmpvar := g.new_tmp_var()
g.defer_return_tmp_var = tmpvar
ret_typ := g.ret_typ(g.unwrap_generic(fn_ret_type))
ret_typ := g.ret_styp(g.unwrap_generic(fn_ret_type))
if node.exprs.len == 1 {
// `return fn_call_opt()`
if (fn_return_is_option || fn_return_is_result) && node.exprs[0] is ast.CallExpr
Expand Down Expand Up @@ -7779,7 +7779,7 @@ fn (mut g Gen) interface_table() string {
for k, method_name in inter_methods {
method := isym.find_method_with_generic_parent(method_name) or { continue }
methodidx[method.name] = k
ret_styp := g.ret_typ(method.return_type)
ret_styp := g.ret_styp(method.return_type)
methods_struct_def.write_string('\t${ret_styp} (*_method_${c_fn_name(method.name)})(void* _')
// the first param is the receiver, it's handled by `void*` above
for i in 1 .. method.params.len {
Expand Down Expand Up @@ -7965,7 +7965,7 @@ static inline __shared__${interface_name} ${shared_fn_name}(__shared__${cctype}*
method_call = '${cctype}_${name}'
// inline void Cat_speak_Interface_Animal_method_wrapper(Cat c) { return Cat_speak(*c); }
iwpostfix := '_Interface_${interface_name}_method_wrapper'
methods_wrapper.write_string('static inline ${g.ret_typ(method.return_type)} ${cctype}_${name}${iwpostfix}(')
methods_wrapper.write_string('static inline ${g.ret_styp(method.return_type)} ${cctype}_${name}${iwpostfix}(')
params_start_pos := g.out.len
mut params := method.params.clone()
// hack to mutate typ
Expand Down Expand Up @@ -8155,7 +8155,7 @@ fn (mut g Gen) trace_last_lines(fbase string, params TraceLastLinesParams) {
}

// ret_type generates proper type name for return type context
pub fn (mut g Gen) ret_typ(typ ast.Type) string {
pub fn (mut g Gen) ret_styp(typ ast.Type) string {
mut ret_styp := g.styp(typ)
if !typ.has_option_or_result() {
ret_sym := g.table.sym(typ)
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/gen/c/fn.v
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ fn (mut g Gen) gen_fn_decl(node &ast.FnDecl, skip bool) {
}

mut name := g.c_fn_name(node)
type_name := g.ret_typ(g.unwrap_generic(node.return_type))
type_name := g.ret_styp(g.unwrap_generic(node.return_type))
if g.pref.obfuscate && g.cur_mod.name == 'main' && name.starts_with('main__') && !node.is_main
&& node.name != 'str' {
mut key := node.name
Expand Down

0 comments on commit 49640c7

Please sign in to comment.