org.snapscript.tree.define.ThisScopeBinder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap-all Show documentation
Show all versions of snap-all Show documentation
Dynamic scripting for the JVM
package org.snapscript.tree.define;
import static org.snapscript.core.Reserved.TYPE_THIS;
import org.snapscript.core.Scope;
import org.snapscript.core.State;
import org.snapscript.core.Value;
public class ThisScopeBinder {
public ThisScopeBinder() {
super();
}
public Scope bind(Scope scope, Scope instance) {
if(instance != null) {
State state = instance.getState();
Value value = state.get(TYPE_THIS);
if(value != null) {
return value.getValue();
}
}
return scope;
}
}