A Node is a single node in the syntax tree. Actually the syntax tree is a syntax DAG, because there is only one node with Op=ONAME for a given instance of a variable x. The same is true for Op=OTYPE and Op=OLITERAL.


type Node struct {
	// Tree structure.
	// Generic recursive walks should follow these fields.
	Left  *Node
	Right *Node
	Ninit Nodes
	Nbody Nodes
	List  Nodes
	Rlist Nodes

	// most nodes
	Type *Type
	Orig *Node // original form, for printing, and tracking copies of ONAMEs

	// func
	Func *Func

	Name *Name

	Sym *Sym        // various
	E   interface{} // Opt or Val, see methods below

	// Various. Usually an offset into a struct. For example, ONAME nodes
	// that refer to local variables use it to identify their stack frame
	// position. ODOT, ODOTPTR, and OINDREG use it to indicate offset
	// relative to their base address. ONAME nodes on the left side of an
	// OKEY within an OSTRUCTLIT use it to store the named field's offset.
	// OXCASE and OXFALL use it to validate the use of fallthrough.
	// Possibly still more uses. If you find any, document them.
	Xoffset int64

	Lineno int32

	Reg int16

	Esc uint16 // EscXXX

	Op        Op
	Ullman    uint8 // sethi/ullman number
	Addable   bool  // addressable
	Etype     EType // op for OASOP, etype for OTYPE, exclam for export, 6g saved reg, ChanDir for OTCHAN
	Bounded   bool  // bounds check unnecessary
	NonNil    bool  // guaranteed to be non-nil
	Class     Class // PPARAM, PAUTO, PEXTERN, etc
	Embedded  uint8 // ODCLFIELD embedded type
	Colas     bool  // OAS resulting from :=
	Diag      uint8 // already printed error about this
	Noescape  bool  // func arguments do not escape; TODO(rsc): move Noescape to Func struct (see CL 7360)
	Walkdef   uint8 // tracks state during typecheckdef; 2 == loop detected
	Typecheck uint8 // tracks state during typechecking; 2 == loop detected
	Local     bool
	IsStatic  bool // whether this Node will be converted to purely static data
	Initorder uint8
	Used      bool // for variable/label declared and not used error
	Isddd     bool // is the argument variadic
	Implicit  bool
	Addrtaken bool  // address taken, even if not moved to heap
	Assigned  bool  // is the variable ever assigned to
	Likely    int8  // likeliness of if statement
	hasVal    int8  // +1 for Val, -1 for Opt, 0 for not yet set
	flags     uint8 // TODO: store more bool fields in this flag field