Beispiel #1
0
func (p *possibleBadRange) has(n *ast.Ident) bool {
	for _, asserted := range *p {

		// TODO(waigani) compare on more than name. We can't use pointer
		// addresses as they change per smell ast walk.
		if astutil.SameIdent(asserted, n) {
			return true
		}
	}
	return false
}
Beispiel #2
0
func (p *possibleBadRange) remove(n *ast.Ident) {
	v := *p
	var nv []*ast.Ident
	for _, ident := range v {

		// TODO(waigani) compare on more than name. We can't use pointer
		// addresses as they change per smell ast walk.
		if !astutil.SameIdent(ident, n) {
			nv = append(nv, ident)
		}
	}

	*p = nv
}