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)
| 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. |
| 294 | func (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. |
| 312 | func (e *Env) isOverloadDisabled(overloadID string) bool { |
no test coverage detected