org.snapscript.core.LocalScope Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.core;
public class LocalScope implements Scope {
private final Index index;
private final Table table;
private final State state;
private final Scope inner;
private final Scope outer;
public LocalScope(Scope inner, Scope outer) {
this.state = new LocalState(inner);
this.table = new ArrayTable();
this.index = new StackIndex();
this.inner = inner;
this.outer = outer;
}
@Override
public Scope getStack() {
return new CompoundScope(this, outer);
}
@Override
public Scope getScope() {
return outer;
}
@Override
public Type getHandle() {
return inner.getType();
}
@Override
public Type getType() {
return inner.getType();
}
@Override
public Module getModule() {
return inner.getModule();
}
@Override
public Table getTable(){
return table;
}
@Override
public Index getIndex(){
return index;
}
@Override
public State getState() {
return state;
}
@Override
public String toString() {
return String.valueOf(state);
}
}