Skip to content

Commit 778fe2c

Browse files
committed
ast: use [direct_array_access] for attrs []Attr lookup methods
1 parent 6398043 commit 778fe2c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

vlib/v/ast/attr.v

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub fn (attrs []Attr) contains(str string) bool {
5454
return attrs.any(it.name == str)
5555
}
5656

57+
[direct_array_access]
5758
pub fn (attrs []Attr) find_first(aname string) ?Attr {
5859
for a in attrs {
5960
if a.name == aname {
@@ -63,6 +64,7 @@ pub fn (attrs []Attr) find_first(aname string) ?Attr {
6364
return none
6465
}
6566

67+
[direct_array_access]
6668
pub fn (attrs []Attr) find_last(aname string) ?Attr {
6769
for idx := attrs.len - 1; idx > -1; idx-- {
6870
a := attrs[idx]
@@ -73,6 +75,7 @@ pub fn (attrs []Attr) find_last(aname string) ?Attr {
7375
return none
7476
}
7577

78+
[direct_array_access]
7679
pub fn (attrs []Attr) find_comptime_define() ?int {
7780
for idx in 0 .. attrs.len {
7881
if attrs[idx].kind == .comptime_define {

0 commit comments

Comments
 (0)