formals = params.getFormals().getFormals();
if (params.isVarArgs() && formals.size() > 0) {
// deal with varags, change the last argument to a list if its not a pattern
Expression last = formals.get(formals.size() - 1);
if (last.isTypedVariable()) {
org.rascalmpl.ast.Type oldType = last.getType();
ISourceLocation origin = last.getLocation();
Structured newType = ASTBuilder.make("Type","Structured", origin, ASTBuilder.make("StructuredType",origin, ASTBuilder.make("BasicType","List", origin), Arrays.asList(ASTBuilder.make("TypeArg","Default", origin,oldType))));
last = ASTBuilder.make("Expression","TypedVariable",origin, newType, last.getName());
formals = replaceLast(formals, last);
}
else if (last.isQualifiedName()) {
ISourceLocation origin = last.getLocation();
org.rascalmpl.ast.Type newType = ASTBuilder.make("Type","Structured",origin, ASTBuilder.make("StructuredType",origin, ASTBuilder.make("BasicType","List", origin), Arrays.asList(ASTBuilder.make("TypeArg",origin, ASTBuilder.make("Type","Basic", origin, ASTBuilder.make("BasicType","Value", origin))))));
last = ASTBuilder.makeExp("TypedVariable", origin, newType, Names.lastName(last.getQualifiedName()));
formals = replaceLast(formals, last);
}
else {
throw new UnsupportedPattern("...", last);
}