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

v: tag more low level functions with [direct_array_access]

This commit is contained in:
Delyan Angelov
2021-05-06 00:31:25 +03:00
parent 3405f517a4
commit 84f9789e72
4 changed files with 25 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ const (
invalid_escapes = ['(', '{', '$', '`', '.']
)
[direct_array_access]
pub fn smart_quote(str string, raw bool) string {
len := str.len
if len == 0 {
@@ -27,16 +28,12 @@ pub fn smart_quote(str string, raw bool) string {
break
}
if pos + 1 < len {
unsafe {
next = str.str[pos + 1].ascii_str()
}
next = str[pos + 1].ascii_str()
}
mut current := str
mut toadd := str
if len > 1 {
unsafe {
current = str.str[pos].ascii_str()
}
current = str[pos].ascii_str()
toadd = current
}
// double quote