mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-05-20 09:18:15 +00:00
82fd65665f
bidichk checks for dangerous unicode character sequences (https://github.com/golangci/golangci-lint/pull/2330)
30 lines
405 B
Go
30 lines
405 B
Go
package analyzer
|
|
|
|
import (
|
|
"go/ast"
|
|
)
|
|
|
|
type funcTypeStack []*ast.FuncType
|
|
|
|
func (s *funcTypeStack) Push(f *ast.FuncType) {
|
|
*s = append(*s, f)
|
|
}
|
|
|
|
func (s *funcTypeStack) Pop() *ast.FuncType {
|
|
if len(*s) == 0 {
|
|
return nil
|
|
}
|
|
|
|
last := len(*s) - 1
|
|
f := (*s)[last]
|
|
*s = (*s)[:last]
|
|
return f
|
|
}
|
|
|
|
func (s *funcTypeStack) Top() *ast.FuncType {
|
|
if len(*s) == 0 {
|
|
return nil
|
|
}
|
|
return (*s)[len(*s)-1]
|
|
}
|