MCPcopy Create free account
hub / github.com/cel-expr/cel-go / addIdent

Method addIdent

checker/env.go:294–309  ·  view source on GitHub ↗

addIdent adds the Decl to the declarations in the Env. Returns a non-empty errorMsg if the identifier is already declared in the scope.

(decl *decls.VariableDecl)

Source from the content-addressed store, hash-verified

292// addIdent adds the Decl to the declarations in the Env.
293// Returns a non-empty errorMsg if the identifier is already declared in the scope.
294func (e *Env) addIdent(decl *decls.VariableDecl) errorMsg {
295 current := e.declarations.FindIdentInScope(decl.Name())
296 if current != nil {
297 if current.DeclarationIsEquivalent(decl) {
298 decl, errMsg := maybeMergeConstant(current, decl)
299 if errMsg != "" {
300 return errMsg
301 }
302 e.declarations.AddIdent(decl)
303 return ""
304 }
305 return overlappingIdentifierError(decl.Name())
306 }
307 e.declarations.AddIdent(decl)
308 return ""
309}
310
311// isOverloadDisabled returns whether the overloadID is disabled in the current environment.
312func (e *Env) isOverloadDisabled(overloadID string) bool {

Callers 1

AddIdentsMethod · 0.95

Calls 6

maybeMergeConstantFunction · 0.85
FindIdentInScopeMethod · 0.80
AddIdentMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected