mirror of
https://github.com/hanzoai/expr.git
synced 2026-09-24 16:58:58 +00:00
Update ast comments
This commit is contained in:
+13
-13
@@ -59,9 +59,9 @@ type NilNode struct {
|
||||
type IdentifierNode struct {
|
||||
base
|
||||
Value string // Name of the identifier. Like "foo" in "foo.bar".
|
||||
FieldIndex []int // Index of the field in the list of fields.
|
||||
Method bool // If true then the identifier is a method call.
|
||||
MethodIndex int // Index of the method in the list of methods.
|
||||
FieldIndex []int // Internal. Index of the field in the list of fields.
|
||||
Method bool // Internal. If true then the identifier is a method call.
|
||||
MethodIndex int // Internal. Index of the method in the list of methods.
|
||||
}
|
||||
|
||||
// SetFieldIndex sets the field index of the identifier.
|
||||
@@ -118,10 +118,10 @@ type UnaryNode struct {
|
||||
// BinaryNode represents a binary operator.
|
||||
type BinaryNode struct {
|
||||
base
|
||||
Regexp *regexp.Regexp // Regexp of the "matches" operator. Like "f.+" in `foo matches "f.+"`.
|
||||
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.
|
||||
Regexp *regexp.Regexp // Internal. Regexp of the "matches" operator. Like "f.+" in `foo matches "f.+"`.
|
||||
}
|
||||
|
||||
// ChainNode represents an optional chaining group.
|
||||
@@ -149,13 +149,13 @@ type MemberNode struct {
|
||||
base
|
||||
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.
|
||||
Name string // Name of the filed or method. Used for error reporting.
|
||||
Optional bool // If true then the member access is optional. Like "foo?.bar".
|
||||
FieldIndex []int // Index sequence of fields. Generated by type checker.
|
||||
Name string // Internal. Name of the filed or method. Used for error reporting.
|
||||
FieldIndex []int // Internal. Index sequence of fields. Generated by type checker.
|
||||
|
||||
// TODO: Combine Method and MethodIndex into a single MethodIndex field of &int type.
|
||||
Method bool // If true then the member access is a method call.
|
||||
MethodIndex int // Index of the method in the list of methods. Generated by type checker.
|
||||
Method bool // Internal. If true then the member access is a method call.
|
||||
MethodIndex int // Internal. Index of the method in the list of methods. Generated by type checker.
|
||||
}
|
||||
|
||||
// SetFieldIndex sets the field index of the member access.
|
||||
@@ -186,9 +186,9 @@ type CallNode struct {
|
||||
base
|
||||
Callee Node // Node of the call. Like "foo" in "foo()".
|
||||
Arguments []Node // Arguments of the call.
|
||||
Typed int // If more than 0 then the call is one of the types from vm.FuncTypes.
|
||||
Fast bool // If true then the call type is "func(...any) any".
|
||||
Func *Function // If not nil then the func is provider via expr.Function.
|
||||
Typed int // Internal. Used to indicate compiler what type is one of vm.FuncTypes.
|
||||
Fast bool // Internal. Used to indicate compiler what this call is a fast call.
|
||||
Func *Function // Internal. Used to pass function information from type checker to compiler.
|
||||
}
|
||||
|
||||
// BuiltinNode represents a builtin function call.
|
||||
@@ -196,8 +196,8 @@ type BuiltinNode struct {
|
||||
base
|
||||
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.
|
||||
Throws bool // Internal. If true then accessing a field or array index can throw an error. Used by optimizer.
|
||||
Map Node // Internal. Used by optimizer to fold filter() and map() builtins.
|
||||
}
|
||||
|
||||
// ClosureNode represents a predicate.
|
||||
|
||||
Reference in New Issue
Block a user