v.util, v.parser: inline some commonly used fns (#23535)

This commit is contained in:
Felipe Pena 2025-01-20 12:09:08 -03:00 committed by GitHub
parent 4800a609f6
commit facee322fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View File

@ -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)
}

View File

@ -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('.', '__')
}