| 1223 | } |
| 1224 | |
| 1225 | func (v *Checker) pointerNode(node *ast.PointerNode) Nature { |
| 1226 | if len(v.predicateScopes) == 0 { |
| 1227 | return v.error(node, "cannot use pointer accessor outside predicate") |
| 1228 | } |
| 1229 | scope := v.predicateScopes[len(v.predicateScopes)-1] |
| 1230 | if node.Name == "" { |
| 1231 | if scope.collection.IsUnknown(&v.config.NtCache) { |
| 1232 | return Nature{} |
| 1233 | } |
| 1234 | switch scope.collection.Kind { |
| 1235 | case reflect.Array, reflect.Slice: |
| 1236 | return scope.collection.Elem(&v.config.NtCache) |
| 1237 | } |
| 1238 | return v.error(node, "cannot use %v as array", scope) |
| 1239 | } |
| 1240 | if scope.vars != nil { |
| 1241 | for i := range scope.vars { |
| 1242 | if node.Name == scope.vars[i].name { |
| 1243 | return scope.vars[i].nature |
| 1244 | } |
| 1245 | } |
| 1246 | } |
| 1247 | return v.error(node, "unknown pointer #%v", node.Name) |
| 1248 | } |
| 1249 | |
| 1250 | func (v *Checker) variableDeclaratorNode(node *ast.VariableDeclaratorNode) Nature { |
| 1251 | if _, ok := v.config.Env.Get(&v.config.NtCache, node.Name); ok { |