Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Oct 15, 2024
1 parent 2168c7f commit 427bcc1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
16 changes: 0 additions & 16 deletions vlib/v/ast/table.v
Original file line number Diff line number Diff line change
Expand Up @@ -683,22 +683,6 @@ pub fn (t &Table) find_sym_and_type_idx(name string) (&TypeSymbol, int) {
return invalid_type_symbol, idx
}

@[inline]
pub fn (t &Table) find_sym_and_type_idx_fn_scoped(name string) (&TypeSymbol, int) {
if t.cur_fn != unsafe { nil } && t.cur_fn.scope != unsafe { nil } {
sym_name := '_${name}_${t.cur_fn.scope.start_pos}'
idx := t.type_idxs[sym_name]
if idx > 0 {
return t.type_symbols[idx], idx
}
}
idx := t.type_idxs[name]
if idx > 0 {
return t.type_symbols[idx], idx
}
return invalid_type_symbol, idx
}

pub const invalid_type_symbol = &TypeSymbol{
idx: invalid_type_idx
parent_idx: invalid_type_idx
Expand Down
3 changes: 2 additions & 1 deletion vlib/v/checker/struct.v
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ fn (mut c Checker) struct_decl(mut node ast.StructDecl) {
defer {
util.timing_measure_cumulative(@METHOD)
}
mut struct_sym, struct_typ_idx := c.table.find_sym_and_type_idx_fn_scoped(node.name)
node_name := if node.scoped_name != '' { node.scoped_name } else { node.name }
mut struct_sym, struct_typ_idx := c.table.find_sym_and_type_idx(node_name)
mut has_generic_types := false
if mut struct_sym.info is ast.Struct {
for mut symfield in struct_sym.info.fields {
Expand Down

0 comments on commit 427bcc1

Please sign in to comment.