internal JukaEnvironment Ancestor(int distance) { JukaEnvironment environment = this; for (int i = 0; i < distance; i++) { environment = environment.enclosing; } return(environment); }
internal void ExecuteBlock(List <Stmt> statements, JukaEnvironment environment) { JukaEnvironment previous = this.environment; try { this.environment = environment; foreach (Stmt statement in statements) { Execute(statement); } } finally { this.environment = previous; } }
internal JukaInterpreter(ServiceProvider services) { environment = globals = new JukaEnvironment(); this.serviceProvider = services; if (serviceProvider != null) { #pragma warning disable CS8604 // Possible null reference argument. globals.Define("clock", serviceProvider.GetService <ISystemClock>()); globals.Define("fileOpen", services.GetService <IFileOpen>()); #pragma warning restore CS8604 // Possible null reference argument. } else { throw new JRuntimeException("Unable to load system calls"); } }
internal JukaFunction(Stmt.Function declaration, JukaEnvironment closure, bool isInitializer) { this.isInitializer = isInitializer; this.declaration = declaration; this.closure = closure; }
internal JukaEnvironment(JukaEnvironment enclosing) { this.enclosing = enclosing; }