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

Method variableDeclaratorNode

checker/checker.go:1250–1270  ·  view source on GitHub ↗
(node *ast.VariableDeclaratorNode)

Source from the content-addressed store, hash-verified

1248}
1249
1250func (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
1272func (v *Checker) sequenceNode(node *ast.SequenceNode) Nature {
1273 if len(node.Nodes) == 0 {

Callers 1

visitMethod · 0.95

Implementers 3

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

Calls 3

errorMethod · 0.95
visitMethod · 0.95
GetMethod · 0.65

Tested by

no test coverage detected