Golang go/ast.BadDecl type example

package go/ast

A BadDecl node is a placeholder for declarations containing syntax errors for which no correct declaration nodes can be created.

Golang go/ast.BadDecl type usage example

 func NodeDescription(n ast.Node) string {
 switch n := n.(type) {
 case *ast.ArrayType:
 return "array type"
 case *ast.AssignStmt:
  return "assignment"
 case *ast.BadDecl:
  return "bad declaration"
 ...
 }

Reference :

http://golang.org/pkg/go/ast/#BadDecl

Advertisement