org.snapscript.tree.function.ParameterList 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.function;
import java.util.List;
import org.snapscript.core.constraint.Constraint;
import org.snapscript.core.constraint.ConstraintMapper;
import org.snapscript.core.function.Signature;
import org.snapscript.core.scope.Scope;
public class ParameterList {
private ParameterListCompiler compiler;
private ConstraintMapper mapper;
private Signature signature;
public ParameterList(ParameterDeclaration... list) {
this.compiler = new ParameterListCompiler(list);
this.mapper = new ConstraintMapper();
}
public Signature create(Scope scope, List generics) throws Exception{
return create(scope, generics, null);
}
public Signature create(Scope scope, List generics, String prefix) throws Exception{
if(signature == null) {
List constraints = mapper.map(scope, generics);
if(prefix == null) {
signature = compiler.compile(scope, constraints);
} else {
signature = compiler.compile(scope, constraints, prefix);
}
}
return signature;
}
}