Skip to content

Commit

Permalink
small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Hidanio committed Apr 17, 2024
1 parent 0d55c45 commit e2120c3
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/linter/block_linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,19 +235,21 @@ func (b *blockLinter) checkClass(class *ir.ClassStmt) {
const classMethod = 0
const classOtherMember = 1

doc, found := irutil.FindPHPDoc(class, true)
if found {
for _, use := range b.useList {
useName := use.pointer.Use.Value
var index = strings.LastIndex(useName, "\\")
var alias = ""
if use.pointer.Alias != nil {
alias = use.pointer.Alias.Value
}
if b.useList != nil {
doc, found := irutil.FindPHPDoc(class, true)
if found {
for _, use := range b.useList {
useName := use.pointer.Use.Value
var index = strings.LastIndex(useName, "\\")
var alias = ""
if use.pointer.Alias != nil {
alias = use.pointer.Alias.Value
}

var phpDocFindUse = "@mixin " + useName[index+1:]
if strings.Contains(doc, phpDocFindUse) || (alias != "" && strings.Contains(doc, "@mixin "+alias)) {
b.useList["\\"+useName] = UsePair{true, b.useList["\\"+useName].pointer}
var phpDocFindUse = "@mixin " + useName[index+1:]
if strings.Contains(doc, phpDocFindUse) || (alias != "" && strings.Contains(doc, "@mixin "+alias)) {
b.useList["\\"+useName] = UsePair{true, b.useList["\\"+useName].pointer}
}
}
}
}
Expand Down

0 comments on commit e2120c3

Please sign in to comment.