(node ast.Node)
| 181 | } |
| 182 | |
| 183 | func (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 | |
| 239 | func (v *Checker) error(node ast.Node, format string, args ...any) Nature { |
| 240 | if v.err == nil { // show first error |
no test coverage detected