| 1248 | } |
| 1249 | |
| 1250 | func (v *Checker) variableDeclaratorNode(node *ast.VariableDeclaratorNode) Nature { |
| 1251 | if _, ok := v.config.Env.Get(&v.config.NtCache, node.Name); ok { |
| 1252 | return v.error(node, "cannot redeclare %v", node.Name) |
| 1253 | } |
| 1254 | if _, ok := v.config.Functions[node.Name]; ok { |
| 1255 | return v.error(node, "cannot redeclare function %v", node.Name) |
| 1256 | } |
| 1257 | if _, ok := v.config.Builtins[node.Name]; ok { |
| 1258 | return v.error(node, "cannot redeclare builtin %v", node.Name) |
| 1259 | } |
| 1260 | for i := len(v.varScopes) - 1; i >= 0; i-- { |
| 1261 | if v.varScopes[i].name == node.Name { |
| 1262 | return v.error(node, "cannot redeclare variable %v", node.Name) |
| 1263 | } |
| 1264 | } |
| 1265 | varNature := v.visit(node.Value) |
| 1266 | v.varScopes = append(v.varScopes, varScope{node.Name, varNature}) |
| 1267 | exprNature := v.visit(node.Expr) |
| 1268 | v.varScopes = v.varScopes[:len(v.varScopes)-1] |
| 1269 | return exprNature |
| 1270 | } |
| 1271 | |
| 1272 | func (v *Checker) sequenceNode(node *ast.SequenceNode) Nature { |
| 1273 | if len(node.Nodes) == 0 { |