Skip to content

Commit

Permalink
v.util, v.parser: inline some commonly used fns (#23535)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp authored Jan 20, 2025
1 parent 4800a60 commit facee32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions vlib/v/parser/parser.v
Original file line number Diff line number Diff line change
Expand Up @@ -3536,6 +3536,7 @@ fn (mut p Parser) parse_concrete_types() []ast.Type {
}

// is_generic_name returns true if the current token is a generic name.
@[inline]
fn (p &Parser) is_generic_name() bool {
return p.tok.kind == .name && util.is_generic_type_name(p.tok.lit)
}
Expand Down
3 changes: 3 additions & 0 deletions vlib/v/util/util.v
Original file line number Diff line number Diff line change
Expand Up @@ -572,14 +572,17 @@ pub fn ensure_modules_for_all_tools_are_installed(is_verbose bool) {
}
}

@[inline]
pub fn strip_mod_name(name string) string {
return name.all_after_last('.')
}

@[inline]
pub fn strip_main_name(name string) string {
return name.replace('main.', '')
}

@[inline]
pub fn no_dots(s string) string {
return s.replace('.', '__')
}
Expand Down

0 comments on commit facee32

Please sign in to comment.