Class ScopeManager

java.lang.Object
dev.frostlake.executor.ScopeManager

public class ScopeManager extends Object
Owns procedural scripting variable state and nested-scope semantics for ProceduralExecutor: the variable map plus the scope stack used by BEGIN…END and control-flow blocks. Entering a scope snapshots the current variables; exiting propagates updates to inherited variables and discards any newly declared (or shadowed) within that scope.
  • Constructor Details

    • ScopeManager

      public ScopeManager()
  • Method Details

    • variables

      public Map<String,Object> variables()
      Live variable map — for raw record-field / session-variable / result-set access.
    • enterScope

      public void enterScope()
    • enterIsolatedScope

      public void enterIsolatedScope()
      Enter a scope that inherits NOTHING and propagates NOTHING — a fresh variable namespace whose exit restores the caller's variables exactly. Used for a SQL UDF body: a function is its own execution context, so it can neither read nor clobber the variables of a procedure that calls it (live-verified — a UDF body naming a caller procedure's variable fails "invalid identifier", and a UDF declaring a variable the caller also has leaves the caller's value untouched).
    • exitScope

      public void exitScope()
    • markDeclaredInCurrentScope

      public void markDeclaredInCurrentScope(String name)
      Called when a variable is DECLARED (not just assigned) in the current scope.
    • setVariable

      public void setVariable(String name, Object value)
    • getVariable

      public Object getVariable(String name)
    • getAllVariables

      public Map<String,Object> getAllVariables()