Golang go/ast.IfStmt type example

package go/ast

An IfStmt node represents an if statement.

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

Reference :

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

Advertisement