Skip to content

Commit

Permalink
created useLists and base architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
Hidanio committed Apr 11, 2024
1 parent ccaafc7 commit f308f21
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/linter/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,9 @@ func (b *blockWalker) EnterNode(n ir.Node) (res bool) {

if b.isIndexingComplete() {
b.linter.enterNode(n)

list := b.linter.useList
println(list)
}
if b.isIndexingComplete() {
// Note: no need to check localRset for nil.
Expand Down
28 changes: 28 additions & 0 deletions src/linter/block_linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,31 @@ import (
type blockLinter struct {
walker *blockWalker
quickfix *QuickFixGenerator
useList map[string]UsePair
}

type UsePair struct {
isUsed bool
pointer *ir.UseStmt
}

func (b *blockLinter) fillUseList(uses []ir.Node) {
for _, use := range uses {
stm, ok := use.(*ir.UseStmt)
if !ok {
return
}

if b.useList == nil {
b.useList = make(map[string]UsePair)
}

b.useList[stm.Use.Value] = UsePair{false, stm}
}
}

func (b *blockLinter) checkUsingStatement(n ir.Node) {

Check failure on line 46 in src/linter/block_linter.go

View workflow job for this annotation

GitHub Actions / Build

func `(*blockLinter).checkUsingStatement` is unused (unused)

}

func (b *blockLinter) enterNode(n ir.Node) {
Expand All @@ -33,6 +58,9 @@ func (b *blockLinter) enterNode(n ir.Node) {
case *ir.ClassStmt:
b.checkClass(n)

case *ir.UseListStmt:
b.fillUseList(n.Uses)

case *ir.FunctionCallExpr:
b.checkFunctionCall(n)

Expand Down

0 comments on commit f308f21

Please sign in to comment.