Copy creates a copy of the current Scopes values, including a copy of its parent if non-nil.
()
| 39 | |
| 40 | // Copy creates a copy of the current Scopes values, including a copy of its parent if non-nil. |
| 41 | func (s *Scopes) Copy() *Scopes { |
| 42 | cpy := newScopes() |
| 43 | if s == nil { |
| 44 | return cpy |
| 45 | } |
| 46 | if s.parent != nil { |
| 47 | cpy.parent = s.parent.Copy() |
| 48 | } |
| 49 | cpy.scopes = s.scopes.copy() |
| 50 | return cpy |
| 51 | } |
| 52 | |
| 53 | // Push creates a new Scopes value which references the current Scope as its parent. |
| 54 | func (s *Scopes) Push() *Scopes { |