ast

package
v1.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 9 Imported by: 132 modules, 114 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(node Node) string

func Patch

func Patch(node *Node, newNode Node)

Patch replaces the node with a new one. Location information is preserved. Type information is lost.

func Walk

func Walk(node *Node, v Visitor)

Types

type ArrayNode

type ArrayNode struct {
	Nodes []Node // Nodes of the array.
	// contains filtered or unexported fields
}

ArrayNode represents an array.

func (*ArrayNode) Location

func (n *ArrayNode) Location() file.Location

Location returns the location of the node in the source code.

func (*ArrayNode) Nature added in v1.17.0

func (n *ArrayNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*ArrayNode) SetLocation

func (n *ArrayNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*ArrayNode) SetNature added in v1.17.0

func (n *ArrayNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*ArrayNode) SetType

func (n *ArrayNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*ArrayNode) String

func (n *ArrayNode) String() string

func (*ArrayNode) Type

func (n *ArrayNode) Type() reflect.Type

Type returns the type of the node.

type BinaryNode

type BinaryNode struct {
	Operator string // Operator of the binary operator. Like "+" in "foo + bar" or "matches" in "foo matches bar".
	Left     Node   // Left node of the binary operator.
	Right    Node   // Right node of the binary operator.
	// contains filtered or unexported fields
}

BinaryNode represents a binary operator.

func (*BinaryNode) Location

func (n *BinaryNode) Location() file.Location

Location returns the location of the node in the source code.

func (*BinaryNode) Nature added in v1.17.0

func (n *BinaryNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*BinaryNode) SetLocation

func (n *BinaryNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*BinaryNode) SetNature added in v1.17.0

func (n *BinaryNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*BinaryNode) SetType

func (n *BinaryNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*BinaryNode) String

func (n *BinaryNode) String() string

func (*BinaryNode) Type

func (n *BinaryNode) Type() reflect.Type

Type returns the type of the node.

type BoolNode

type BoolNode struct {
	Value bool // Value of the boolean.
	// contains filtered or unexported fields
}

BoolNode represents a boolean.

func (*BoolNode) Location

func (n *BoolNode) Location() file.Location

Location returns the location of the node in the source code.

func (*BoolNode) Nature added in v1.17.0

func (n *BoolNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*BoolNode) SetLocation

func (n *BoolNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*BoolNode) SetNature added in v1.17.0

func (n *BoolNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*BoolNode) SetType

func (n *BoolNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*BoolNode) String

func (n *BoolNode) String() string

func (*BoolNode) Type

func (n *BoolNode) Type() reflect.Type

Type returns the type of the node.

type BuiltinNode

type BuiltinNode struct {
	Name      string // Name of the builtin function. Like "len" in "len(foo)".
	Arguments []Node // Arguments of the builtin function.
	Throws    bool   // If true then accessing a field or array index can throw an error. Used by optimizer.
	Map       Node   // Used by optimizer to fold filter() and map() builtins.
	Threshold *int   // Used by optimizer for count() early termination.
	// contains filtered or unexported fields
}

BuiltinNode represents a builtin function call.

func (*BuiltinNode) Location

func (n *BuiltinNode) Location() file.Location

Location returns the location of the node in the source code.

func (*BuiltinNode) Nature added in v1.17.0

func (n *BuiltinNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*BuiltinNode) SetLocation

func (n *BuiltinNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*BuiltinNode) SetNature added in v1.17.0

func (n *BuiltinNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*BuiltinNode) SetType

func (n *BuiltinNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*BuiltinNode) String

func (n *BuiltinNode) String() string

func (*BuiltinNode) Type

func (n *BuiltinNode) Type() reflect.Type

Type returns the type of the node.

type BytesNode added in v1.17.8

type BytesNode struct {
	Value []byte // Value of the byte slice.
	// contains filtered or unexported fields
}

BytesNode represents a byte slice.

func (*BytesNode) Location added in v1.17.8

func (n *BytesNode) Location() file.Location

Location returns the location of the node in the source code.

func (*BytesNode) Nature added in v1.17.8

func (n *BytesNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*BytesNode) SetLocation added in v1.17.8

func (n *BytesNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*BytesNode) SetNature added in v1.17.8

func (n *BytesNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*BytesNode) SetType added in v1.17.8

func (n *BytesNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*BytesNode) String added in v1.17.8

func (n *BytesNode) String() string

func (*BytesNode) Type added in v1.17.8

func (n *BytesNode) Type() reflect.Type

Type returns the type of the node.

type CallNode

type CallNode struct {
	Callee    Node   // Node of the call. Like "foo" in "foo()".
	Arguments []Node // Arguments of the call.
	// contains filtered or unexported fields
}

CallNode represents a function or a method call.

func (*CallNode) Location

func (n *CallNode) Location() file.Location

Location returns the location of the node in the source code.

func (*CallNode) Nature added in v1.17.0

func (n *CallNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*CallNode) SetLocation

func (n *CallNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*CallNode) SetNature added in v1.17.0

func (n *CallNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*CallNode) SetType

func (n *CallNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*CallNode) String

func (n *CallNode) String() string

func (*CallNode) Type

func (n *CallNode) Type() reflect.Type

Type returns the type of the node.

type ChainNode

type ChainNode struct {
	Node Node // Node of the chain.
	// contains filtered or unexported fields
}

ChainNode represents an optional chaining group. A few MemberNode nodes can be chained together, and will be wrapped in a ChainNode. Example:

foo.bar?.baz?.qux

The whole chain will be wrapped in a ChainNode.

func (*ChainNode) Location

func (n *ChainNode) Location() file.Location

Location returns the location of the node in the source code.

func (*ChainNode) Nature added in v1.17.0

func (n *ChainNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*ChainNode) SetLocation

func (n *ChainNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*ChainNode) SetNature added in v1.17.0

func (n *ChainNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*ChainNode) SetType

func (n *ChainNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*ChainNode) String

func (n *ChainNode) String() string

func (*ChainNode) Type

func (n *ChainNode) Type() reflect.Type

Type returns the type of the node.

type ConditionalNode

type ConditionalNode struct {
	Ternary bool // Is it ternary or if/else operator?
	Cond    Node // Condition
	Exp1    Node // Expression 1
	Exp2    Node // Expression 2
	// contains filtered or unexported fields
}

ConditionalNode represents a ternary operator or if/else operator.

func (*ConditionalNode) Location

func (n *ConditionalNode) Location() file.Location

Location returns the location of the node in the source code.

func (*ConditionalNode) Nature added in v1.17.0

func (n *ConditionalNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*ConditionalNode) SetLocation

func (n *ConditionalNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*ConditionalNode) SetNature added in v1.17.0

func (n *ConditionalNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*ConditionalNode) SetType

func (n *ConditionalNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*ConditionalNode) String

func (n *ConditionalNode) String() string

func (*ConditionalNode) Type

func (n *ConditionalNode) Type() reflect.Type

Type returns the type of the node.

type ConstantNode

type ConstantNode struct {
	Value any // Value of the constant.
	// contains filtered or unexported fields
}

ConstantNode represents a constant. Constants are predefined values like nil, true, false, array, map, etc. The parser.Parse will never generate ConstantNode, it is only generated by the optimizer.

func (*ConstantNode) Location

func (n *ConstantNode) Location() file.Location

Location returns the location of the node in the source code.

func (*ConstantNode) Nature added in v1.17.0

func (n *ConstantNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*ConstantNode) SetLocation

func (n *ConstantNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*ConstantNode) SetNature added in v1.17.0

func (n *ConstantNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*ConstantNode) SetType

func (n *ConstantNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*ConstantNode) String

func (n *ConstantNode) String() string

func (*ConstantNode) Type

func (n *ConstantNode) Type() reflect.Type

Type returns the type of the node.

type FloatNode

type FloatNode struct {
	Value float64 // Value of the float.
	// contains filtered or unexported fields
}

FloatNode represents a float.

func (*FloatNode) Location

func (n *FloatNode) Location() file.Location

Location returns the location of the node in the source code.

func (*FloatNode) Nature added in v1.17.0

func (n *FloatNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*FloatNode) SetLocation

func (n *FloatNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*FloatNode) SetNature added in v1.17.0

func (n *FloatNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*FloatNode) SetType

func (n *FloatNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*FloatNode) String

func (n *FloatNode) String() string

func (*FloatNode) Type

func (n *FloatNode) Type() reflect.Type

Type returns the type of the node.

type IdentifierNode

type IdentifierNode struct {
	Value string // Name of the identifier. Like "foo" in "foo.bar".
	// contains filtered or unexported fields
}

IdentifierNode represents an identifier.

func (*IdentifierNode) Location

func (n *IdentifierNode) Location() file.Location

Location returns the location of the node in the source code.

func (*IdentifierNode) Nature added in v1.17.0

func (n *IdentifierNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*IdentifierNode) SetLocation

func (n *IdentifierNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*IdentifierNode) SetNature added in v1.17.0

func (n *IdentifierNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*IdentifierNode) SetType

func (n *IdentifierNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*IdentifierNode) String

func (n *IdentifierNode) String() string

func (*IdentifierNode) Type

func (n *IdentifierNode) Type() reflect.Type

Type returns the type of the node.

type IntegerNode

type IntegerNode struct {
	Value int // Value of the integer.
	// contains filtered or unexported fields
}

IntegerNode represents an integer.

func (*IntegerNode) Location

func (n *IntegerNode) Location() file.Location

Location returns the location of the node in the source code.

func (*IntegerNode) Nature added in v1.17.0

func (n *IntegerNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*IntegerNode) SetLocation

func (n *IntegerNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*IntegerNode) SetNature added in v1.17.0

func (n *IntegerNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*IntegerNode) SetType

func (n *IntegerNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*IntegerNode) String

func (n *IntegerNode) String() string

func (*IntegerNode) Type

func (n *IntegerNode) Type() reflect.Type

Type returns the type of the node.

type MapNode

type MapNode struct {
	Pairs []Node // PairNode nodes.
	// contains filtered or unexported fields
}

MapNode represents a map.

func (*MapNode) Location

func (n *MapNode) Location() file.Location

Location returns the location of the node in the source code.

func (*MapNode) Nature added in v1.17.0

func (n *MapNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*MapNode) SetLocation

func (n *MapNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*MapNode) SetNature added in v1.17.0

func (n *MapNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*MapNode) SetType

func (n *MapNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*MapNode) String

func (n *MapNode) String() string

func (*MapNode) Type

func (n *MapNode) Type() reflect.Type

Type returns the type of the node.

type MemberNode

type MemberNode struct {
	Node     Node // Node of the member access. Like "foo" in "foo.bar".
	Property Node // Property of the member access. For property access it is a StringNode.
	Optional bool // If true then the member access is optional. Like "foo?.bar".
	Method   bool
	// contains filtered or unexported fields
}

MemberNode represents a member access. It can be a field access, a method call, or an array element access. Example:

foo.bar or foo["bar"]
foo.bar()
array[0]

func (*MemberNode) Location

func (n *MemberNode) Location() file.Location

Location returns the location of the node in the source code.

func (*MemberNode) Nature added in v1.17.0

func (n *MemberNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*MemberNode) SetLocation

func (n *MemberNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*MemberNode) SetNature added in v1.17.0

func (n *MemberNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*MemberNode) SetType

func (n *MemberNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*MemberNode) String

func (n *MemberNode) String() string

func (*MemberNode) Type

func (n *MemberNode) Type() reflect.Type

Type returns the type of the node.

type NilNode

type NilNode struct {
	// contains filtered or unexported fields
}

NilNode represents nil.

func (*NilNode) Location

func (n *NilNode) Location() file.Location

Location returns the location of the node in the source code.

func (*NilNode) Nature added in v1.17.0

func (n *NilNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*NilNode) SetLocation

func (n *NilNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*NilNode) SetNature added in v1.17.0

func (n *NilNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*NilNode) SetType

func (n *NilNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*NilNode) String

func (n *NilNode) String() string

func (*NilNode) Type

func (n *NilNode) Type() reflect.Type

Type returns the type of the node.

type Node

type Node interface {
	Location() file.Location
	SetLocation(file.Location)
	Nature() *nature.Nature
	SetNature(nature.Nature)
	Type() reflect.Type
	SetType(reflect.Type)
	String() string
}

Node represents items of abstract syntax tree.

func Find added in v1.17.0

func Find(node Node, fn func(node Node) bool) Node

type PairNode

type PairNode struct {
	Key   Node // Key of the pair.
	Value Node // Value of the pair.
	// contains filtered or unexported fields
}

PairNode represents a key-value pair of a map.

func (*PairNode) Location

func (n *PairNode) Location() file.Location

Location returns the location of the node in the source code.

func (*PairNode) Nature added in v1.17.0

func (n *PairNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*PairNode) SetLocation

func (n *PairNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*PairNode) SetNature added in v1.17.0

func (n *PairNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*PairNode) SetType

func (n *PairNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*PairNode) String

func (n *PairNode) String() string

func (*PairNode) Type

func (n *PairNode) Type() reflect.Type

Type returns the type of the node.

type PointerNode

type PointerNode struct {
	Name string // Name of the pointer. Like "index" in "#index".
	// contains filtered or unexported fields
}

PointerNode represents a pointer to a current value in predicate.

func (*PointerNode) Location

func (n *PointerNode) Location() file.Location

Location returns the location of the node in the source code.

func (*PointerNode) Nature added in v1.17.0

func (n *PointerNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*PointerNode) SetLocation

func (n *PointerNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*PointerNode) SetNature added in v1.17.0

func (n *PointerNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*PointerNode) SetType

func (n *PointerNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*PointerNode) String

func (n *PointerNode) String() string

func (*PointerNode) Type

func (n *PointerNode) Type() reflect.Type

Type returns the type of the node.

type PredicateNode added in v1.17.0

type PredicateNode struct {
	Node Node // Node of the predicate body.
	// contains filtered or unexported fields
}

PredicateNode represents a predicate. Example:

filter(foo, .bar == 1)

The predicate is ".bar == 1".

func (*PredicateNode) Location added in v1.17.0

func (n *PredicateNode) Location() file.Location

Location returns the location of the node in the source code.

func (*PredicateNode) Nature added in v1.17.0

func (n *PredicateNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*PredicateNode) SetLocation added in v1.17.0

func (n *PredicateNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*PredicateNode) SetNature added in v1.17.0

func (n *PredicateNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*PredicateNode) SetType added in v1.17.0

func (n *PredicateNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*PredicateNode) String added in v1.17.0

func (n *PredicateNode) String() string

func (*PredicateNode) Type added in v1.17.0

func (n *PredicateNode) Type() reflect.Type

Type returns the type of the node.

type SequenceNode added in v1.17.0

type SequenceNode struct {
	Nodes []Node
	// contains filtered or unexported fields
}

SequenceNode represents a sequence of nodes separated by semicolons. All nodes are executed, only the last node will be returned.

func (*SequenceNode) Location added in v1.17.0

func (n *SequenceNode) Location() file.Location

Location returns the location of the node in the source code.

func (*SequenceNode) Nature added in v1.17.0

func (n *SequenceNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*SequenceNode) SetLocation added in v1.17.0

func (n *SequenceNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*SequenceNode) SetNature added in v1.17.0

func (n *SequenceNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*SequenceNode) SetType added in v1.17.0

func (n *SequenceNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*SequenceNode) String added in v1.17.0

func (n *SequenceNode) String() string

func (*SequenceNode) Type added in v1.17.0

func (n *SequenceNode) Type() reflect.Type

Type returns the type of the node.

type SliceNode

type SliceNode struct {
	Node     Node // Node of the slice. Like "array" in "array[1:4]".
	From     Node // From an index of the array. Like "1" in "array[1:4]".
	To       Node // To an index of the array. Like "4" in "array[1:4]".
	Optional bool // If true then the slice access is optional. Like "foo?.[1:4]".
	// contains filtered or unexported fields
}

SliceNode represents access to a slice of an array. Example:

array[1:4]

func (*SliceNode) Location

func (n *SliceNode) Location() file.Location

Location returns the location of the node in the source code.

func (*SliceNode) Nature added in v1.17.0

func (n *SliceNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*SliceNode) SetLocation

func (n *SliceNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*SliceNode) SetNature added in v1.17.0

func (n *SliceNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*SliceNode) SetType

func (n *SliceNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*SliceNode) String

func (n *SliceNode) String() string

func (*SliceNode) Type

func (n *SliceNode) Type() reflect.Type

Type returns the type of the node.

type StringNode

type StringNode struct {
	Value string // Value of the string.
	// contains filtered or unexported fields
}

StringNode represents a string.

func (*StringNode) Location

func (n *StringNode) Location() file.Location

Location returns the location of the node in the source code.

func (*StringNode) Nature added in v1.17.0

func (n *StringNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*StringNode) SetLocation

func (n *StringNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*StringNode) SetNature added in v1.17.0

func (n *StringNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*StringNode) SetType

func (n *StringNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*StringNode) String

func (n *StringNode) String() string

func (*StringNode) Type

func (n *StringNode) Type() reflect.Type

Type returns the type of the node.

type UnaryNode

type UnaryNode struct {
	Operator string // Operator of the unary operator. Like "!" in "!foo" or "not" in "not foo".
	Node     Node   // Node of the unary operator. Like "foo" in "!foo".
	// contains filtered or unexported fields
}

UnaryNode represents a unary operator.

func (*UnaryNode) Location

func (n *UnaryNode) Location() file.Location

Location returns the location of the node in the source code.

func (*UnaryNode) Nature added in v1.17.0

func (n *UnaryNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*UnaryNode) SetLocation

func (n *UnaryNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*UnaryNode) SetNature added in v1.17.0

func (n *UnaryNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*UnaryNode) SetType

func (n *UnaryNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*UnaryNode) String

func (n *UnaryNode) String() string

func (*UnaryNode) Type

func (n *UnaryNode) Type() reflect.Type

Type returns the type of the node.

type VariableDeclaratorNode

type VariableDeclaratorNode struct {
	Name  string // Name of the variable. Like "foo" in "let foo = 1; foo + 1".
	Value Node   // Value of the variable. Like "1" in "let foo = 1; foo + 1".
	Expr  Node   // Expression of the variable. Like "foo + 1" in "let foo = 1; foo + 1".
	// contains filtered or unexported fields
}

VariableDeclaratorNode represents a variable declaration.

func (*VariableDeclaratorNode) Location

func (n *VariableDeclaratorNode) Location() file.Location

Location returns the location of the node in the source code.

func (*VariableDeclaratorNode) Nature added in v1.17.0

func (n *VariableDeclaratorNode) Nature() *nature.Nature

Nature returns the nature of the node.

func (*VariableDeclaratorNode) SetLocation

func (n *VariableDeclaratorNode) SetLocation(loc file.Location)

SetLocation sets the location of the node in the source code.

func (*VariableDeclaratorNode) SetNature added in v1.17.0

func (n *VariableDeclaratorNode) SetNature(nature nature.Nature)

SetNature sets the nature of the node.

func (*VariableDeclaratorNode) SetType

func (n *VariableDeclaratorNode) SetType(t reflect.Type)

SetType sets the type of the node.

func (*VariableDeclaratorNode) String

func (n *VariableDeclaratorNode) String() string

func (*VariableDeclaratorNode) Type

func (n *VariableDeclaratorNode) Type() reflect.Type

Type returns the type of the node.

type Visitor

type Visitor interface {
	Visit(node *Node)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL