Skip to content

Commit

Permalink
Fix, at least trim the comments and position for simple identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
zimmski committed Oct 28, 2016
1 parent d200860 commit f85323e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion astutil/query.go
Expand Up @@ -55,7 +55,10 @@ func (w *identifierWalker) Visit(node ast.Node) ast.Visitor {
}
}

w.identifiers = append(w.identifiers, n)
// FIXME instead of manually creating a new node, clone it and trim the node from its comments and position https://github.com/zimmski/go-mutesting/issues/49
w.identifiers = append(w.identifiers, &ast.Ident{
Name: n.Name,
})

return nil
case *ast.SelectorExpr:
Expand All @@ -77,10 +80,12 @@ func (w *identifierWalker) Visit(node ast.Node) ast.Visitor {
}

if initialize {
// FIXME we need to clone the node and trim comments and position recursively https://github.com/zimmski/go-mutesting/issues/49
w.identifiers = append(w.identifiers, &ast.CompositeLit{
Type: n,
})
} else {
// FIXME we need to clone the node and trim comments and position recursively https://github.com/zimmski/go-mutesting/issues/49
w.identifiers = append(w.identifiers, n)
}

Expand Down

0 comments on commit f85323e

Please sign in to comment.