From facee322fc27c0da6f19e6b9a610282cc2d0e549 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Mon, 20 Jan 2025 12:09:08 -0300 Subject: [PATCH] v.util, v.parser: inline some commonly used fns (#23535) --- vlib/v/parser/parser.v | 1 + vlib/v/util/util.v | 3 +++ 2 files changed, 4 insertions(+) diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 8e4b372a0b6f1e..8484613e95e3b4 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -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) } diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index 39482aac9fc7d6..59ed7bae5d72fd 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -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('.', '__') }