MCPcopy
hub / github.com/expr-lang/expr / visit

Method visit

checker/checker.go:183–237  ·  view source on GitHub ↗
(node ast.Node)

Source from the content-addressed store, hash-verified

181}
182
183func (v *Checker) visit(node ast.Node) Nature {
184 var nt Nature
185 switch n := node.(type) {
186 case *ast.NilNode:
187 nt = v.config.NtCache.NatureOf(nil)
188 case *ast.IdentifierNode:
189 nt = v.identifierNode(n)
190 case *ast.IntegerNode:
191 nt = v.config.NtCache.FromType(intType)
192 case *ast.FloatNode:
193 nt = v.config.NtCache.FromType(floatType)
194 case *ast.BoolNode:
195 nt = v.config.NtCache.FromType(boolType)
196 case *ast.StringNode:
197 nt = v.config.NtCache.FromType(stringType)
198 case *ast.BytesNode:
199 nt = v.config.NtCache.FromType(byteSliceType)
200 case *ast.ConstantNode:
201 nt = v.config.NtCache.FromType(reflect.TypeOf(n.Value))
202 case *ast.UnaryNode:
203 nt = v.unaryNode(n)
204 case *ast.BinaryNode:
205 nt = v.binaryNode(n)
206 case *ast.ChainNode:
207 nt = v.chainNode(n)
208 case *ast.MemberNode:
209 nt = v.memberNode(n)
210 case *ast.SliceNode:
211 nt = v.sliceNode(n)
212 case *ast.CallNode:
213 nt = v.callNode(n)
214 case *ast.BuiltinNode:
215 nt = v.builtinNode(n)
216 case *ast.PredicateNode:
217 nt = v.predicateNode(n)
218 case *ast.PointerNode:
219 nt = v.pointerNode(n)
220 case *ast.VariableDeclaratorNode:
221 nt = v.variableDeclaratorNode(n)
222 case *ast.SequenceNode:
223 nt = v.sequenceNode(n)
224 case *ast.ConditionalNode:
225 nt = v.conditionalNode(n)
226 case *ast.ArrayNode:
227 nt = v.arrayNode(n)
228 case *ast.MapNode:
229 nt = v.mapNode(n)
230 case *ast.PairNode:
231 nt = v.pairNode(n)
232 default:
233 panic(fmt.Sprintf("undefined node type (%T)", node))
234 }
235 node.SetNature(nt)
236 return nt
237}
238
239func (v *Checker) error(node ast.Node, format string, args ...any) Nature {
240 if v.err == nil { // show first error

Callers 15

checkMethod · 0.95
unaryNodeMethod · 0.95
binaryNodeMethod · 0.95
chainNodeMethod · 0.95
memberNodeMethod · 0.95
sliceNodeMethod · 0.95
callNodeMethod · 0.95
builtinNodeMethod · 0.95
checkBuiltinGetMethod · 0.95
checkFunctionMethod · 0.95
checkArgumentsMethod · 0.95
predicateNodeMethod · 0.95

Implementers 3

Configconf/config.go
Checkerchecker/checker.go
OperatorOverloadingpatcher/operator_override.go

Calls 15

identifierNodeMethod · 0.95
unaryNodeMethod · 0.95
binaryNodeMethod · 0.95
chainNodeMethod · 0.95
memberNodeMethod · 0.95
sliceNodeMethod · 0.95
callNodeMethod · 0.95
builtinNodeMethod · 0.95
predicateNodeMethod · 0.95
pointerNodeMethod · 0.95
sequenceNodeMethod · 0.95

Tested by

no test coverage detected