Pop returns the parent Scopes value for the current scope, or the current scope if the parent is nil.
()
| 57 | // Pop returns the parent Scopes value for the current scope, or the current scope if the parent |
| 58 | // is nil. |
| 59 | func (s *Scopes) Pop() *Scopes { |
| 60 | if s.parent != nil { |
| 61 | return s.parent |
| 62 | } |
| 63 | // TODO: Consider whether this should be an error / panic. |
| 64 | return s |
| 65 | } |
| 66 | |
| 67 | // AddIdent adds the ident Decl in the current scope. |
| 68 | // Note: If the name collides with an existing identifier in the scope, the Decl is overwritten. |