org.snapscript.tree.compile.FunctionScopeCompiler 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.compile;
import org.snapscript.core.function.Function;
import org.snapscript.core.scope.Scope;
import org.snapscript.core.scope.index.LocalScopeExtractor;
import org.snapscript.core.type.Type;
public class FunctionScopeCompiler extends ScopeCompiler {
private final LocalScopeExtractor extractor;
public FunctionScopeCompiler() {
this.extractor = new LocalScopeExtractor(false, true);
}
public Scope compile(Scope local, Type type, Function function) throws Exception {
Scope scope = extractor.extract(local);
Scope stack = scope.getStack();
compileParameters(stack, function);
return stack;
}
}