1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vfmt: keep vproto.Name, when current module is proto

This commit is contained in:
Delyan Angelov
2020-07-11 00:59:19 +03:00
parent 3c3a91697e
commit 7248d8422e
3 changed files with 42 additions and 4 deletions

View File

@ -46,7 +46,7 @@ pub struct string {
pub:
str byteptr // points to a C style 0 terminated string of bytes.
len int // the length of the .str field, excluding the ending 0 byte. It is always equal to strlen(.str).
mut:
mut:
is_lit int
}
// mut:
@ -157,7 +157,7 @@ pub fn cstring_to_vstring(cstr byteptr) string {
pub fn (s string) replace_once(rep, with string) string {
index := s.index(rep) or {
return s
return s.clone()
}
return s.substr(0, index) + with + s.substr(index + rep.len, s.len)
}