org.snapscript.tree.reference.GenericArgumentList 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.reference;
import java.util.ArrayList;
import java.util.List;
import org.snapscript.core.InternalStateException;
import org.snapscript.core.constraint.Constraint;
import org.snapscript.core.scope.Scope;
import org.snapscript.core.type.Type;
public class GenericArgumentList {
private final GenericArgument[] arguments;
public GenericArgumentList(GenericArgument... arguments) {
this.arguments = arguments;
}
public List create(Scope scope) throws Exception {
List result = new ArrayList();
for(GenericArgument argument : arguments) {
Constraint constraint = argument.getConstraint();
Type type = constraint.getType(scope);
if(type == null) {
throw new InternalStateException("Could not find constraint");
}
result.add(constraint);
}
return result;
}
}