Golang go/ast.BadStmt type example

package go/ast

A BadStmt node is a placeholder for statements containing syntax errors for which no correct statement nodes can be created.

Golang go/ast.BadStmt 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.BadStmt:
     return "bad statement"
     ...
 }

Reference :

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

Advertisement