Constructs a new Environment. This constructor cannot be used to create the global Environment.
Constructs a global environment
Attempt to declare and assign a new variable in the current environment. Returns false if it already exists.
Returns the depth from this Environment to the root Environment
Forces the removal of a const or variable in the current environment.
Force sets a variable or const no matter if the variable was declared already or is const. This is used by the host application to set globals or locals.
climb environment stack until finding one without a parent
Retrieves the interpreter object from the top level environment
Attempts to look up existing variable or const throughout the stack. If found, returns a pointer to the variable location, and if it is const, sets isConst to true. Note, this pointer should not be stored by native functions because the variable table may be modified between function calls.
returns the name of the Environment
returns the parent Environment
Attempts to reassign a variable anywhere in the stack and returns a pointer to the variable or null if the variable doesn't exist or is const. If the failure is due to const, failedBecauseConst is set to true. Note: this pointer should not be stored by native functions due to modifications to the variable table that may invalidate it and result in undefined behavior.
Returns a string representing the type and name
Removes a variable from anywhere on the Environment stack it is located. This function cannot be used to unset consts.
Returns the level of depth, relative to this Environment, 0-N for a variable location, or -1 if not found
Searches the entire Environment stack for a variable starting with the current environment and climbing the parent chain.
Holds the variables and consts of a script stack frame. The global environment can be accessed by climbing the Environment.parent chain until reaching the Environment whose parent is null. This allows native functions to define local and global variables. Note that calling a native function does not create a stack frame so one could write a native function that adds local variables to the stack frame where it was called.