1
0
mirror of https://github.com/mgechev/revive.git synced 2025-01-24 03:47:45 +02:00
revive/internal/ifelse/target.go

26 lines
448 B
Go
Raw Normal View History

package ifelse
import "go/ast"
// Target decides what line/column should be indicated by the rule in question.
type Target int
const (
// TargetIf means the text refers to the "if"
TargetIf Target = iota
// TargetElse means the text refers to the "else"
TargetElse
)
func (t Target) node(ifStmt *ast.IfStmt) ast.Node {
switch t {
case TargetIf:
return ifStmt
case TargetElse:
return ifStmt.Else
default:
panic("bad target")
}
}