aboutsummaryrefslogtreecommitdiff
path: root/go/ast/astutil/enclosing18.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/ast/astutil/enclosing18.go')
-rw-r--r--go/ast/astutil/enclosing18.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/go/ast/astutil/enclosing18.go b/go/ast/astutil/enclosing18.go
index af897cb0b..4a91c1d3b 100644
--- a/go/ast/astutil/enclosing18.go
+++ b/go/ast/astutil/enclosing18.go
@@ -200,6 +200,11 @@ func childrenOf(n ast.Node) []ast.Node {
// Then add fake Nodes for bare tokens.
switch n := n.(type) {
+ case *ast.AliasSpec:
+ // TODO(adonovan): AliasSpec.{Doc,Comment}?
+ // Guess position of "=>" assuming well-formattedness.
+ children = append(children, tok(n.Orig.Pos()-token.Pos(len("=> ")), len("=>")))
+
case *ast.ArrayType:
children = append(children,
tok(n.Lbrack, len("[")),
@@ -623,7 +628,8 @@ func NodeDescription(n ast.Node) string {
return fmt.Sprintf("unary %s operation", n.Op)
case *ast.ValueSpec:
return "value specification"
-
+ case *ast.AliasSpec:
+ return "alias specification"
}
panic(fmt.Sprintf("unexpected node type: %T", n))
}