mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ast: use [direct_array_access]
for attrs []Attr
lookup methods
This commit is contained in:
parent
6398043094
commit
778fe2cde0
@ -54,6 +54,7 @@ pub fn (attrs []Attr) contains(str string) bool {
|
|||||||
return attrs.any(it.name == str)
|
return attrs.any(it.name == str)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[direct_array_access]
|
||||||
pub fn (attrs []Attr) find_first(aname string) ?Attr {
|
pub fn (attrs []Attr) find_first(aname string) ?Attr {
|
||||||
for a in attrs {
|
for a in attrs {
|
||||||
if a.name == aname {
|
if a.name == aname {
|
||||||
@ -63,6 +64,7 @@ pub fn (attrs []Attr) find_first(aname string) ?Attr {
|
|||||||
return none
|
return none
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[direct_array_access]
|
||||||
pub fn (attrs []Attr) find_last(aname string) ?Attr {
|
pub fn (attrs []Attr) find_last(aname string) ?Attr {
|
||||||
for idx := attrs.len - 1; idx > -1; idx-- {
|
for idx := attrs.len - 1; idx > -1; idx-- {
|
||||||
a := attrs[idx]
|
a := attrs[idx]
|
||||||
@ -73,6 +75,7 @@ pub fn (attrs []Attr) find_last(aname string) ?Attr {
|
|||||||
return none
|
return none
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[direct_array_access]
|
||||||
pub fn (attrs []Attr) find_comptime_define() ?int {
|
pub fn (attrs []Attr) find_comptime_define() ?int {
|
||||||
for idx in 0 .. attrs.len {
|
for idx in 0 .. attrs.len {
|
||||||
if attrs[idx].kind == .comptime_define {
|
if attrs[idx].kind == .comptime_define {
|
||||||
|
Loading…
Reference in New Issue
Block a user