org.snapscript.tree.define.SuperInstanceBuilder 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 org.snapscript.core.module.Module;
import org.snapscript.core.scope.Scope;
import org.snapscript.core.scope.instance.Instance;
import org.snapscript.core.scope.instance.SuperInstance;
import org.snapscript.core.type.Type;
import org.snapscript.core.variable.Value;
public class SuperInstanceBuilder {
private final Type type;
public SuperInstanceBuilder(Type type) {
this.type = type;
}
public Scope create(Scope scope, Value left) throws Exception {
Type real = left.getValue();
Instance instance = (Instance)scope;
Instance outer = instance.getScope();
Module module = type.getModule();
return new SuperInstance(module, outer, real, type);
}
}