
org.snapscript.tree.define.SuperFactory 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.tree.define;
import org.snapscript.core.Evaluation;
import org.snapscript.core.Result;
import org.snapscript.core.ResultType;
import org.snapscript.core.Scope;
import org.snapscript.core.Type;
import org.snapscript.core.TypeFactory;
import org.snapscript.core.Value;
public class SuperFactory extends TypeFactory {
private final SuperInstanceBuilder builder;
private final Evaluation expression;
public SuperFactory(Evaluation expression, Type type) {
this.builder = new SuperInstanceBuilder(type);
this.expression = expression;
}
@Override
public Result execute(Scope instance, Type real) throws Exception {
Value reference = expression.evaluate(instance, real);
Scope value = reference.getValue();
Scope base = builder.create(value, real);
return ResultType.getNormal(base);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy