NewVariableAlias creates a new variable alias, named |alias|, in the current frame of this stack, pointing to the specified |variable|.
(alias string, target string)
| 204 | // NewVariableAlias creates a new variable alias, named |alias|, in the current frame of this stack, |
| 205 | // pointing to the specified |variable|. |
| 206 | func (is *InterpreterStack) NewVariableAlias(alias string, target string) { |
| 207 | for i := 0; i < is.stack.Len(); i++ { |
| 208 | if iv, ok := is.stack.PeekDepth(i).variables[target]; ok { |
| 209 | // TODO: this won't work for RECORD types |
| 210 | is.stack.Peek().variables[alias] = iv |
| 211 | break |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | // PushScope creates a new scope. |
| 217 | func (is *InterpreterStack) PushScope() { |