@Override
public Result<IValue> call(Type[] argTypes, IValue[] actuals, Map<String, IValue> keyArgValues) {
if (actuals.length >= 2) {
if (!argTypes[0].isSubtypeOf(getTypeFactory().integerType())) {
throw new UnexpectedType(getTypeFactory().integerType(), argTypes[0], ctx.getCurrentAST());
}
if (!argTypes[1].isSubtypeOf(getTypeFactory().integerType())) {
throw new UnexpectedType(getTypeFactory().integerType(), argTypes[1], ctx.getCurrentAST());
}
if (actuals.length == 4) {
if (!argTypes[2].isSubtypeOf(intTuple)) {
throw new UnexpectedType(intTuple, argTypes[2], ctx.getCurrentAST());
}
if (!argTypes[3].isSubtypeOf(intTuple)) {
throw new UnexpectedType(intTuple, argTypes[3], ctx.getCurrentAST());
}
}
else if (actuals.length != 2) {
throw new SyntaxError("location constructor", ctx.getCurrentAST().getLocation());
}