Minor improvements to scarpet annotation API (#1239)
This commit is contained in:
1 parent
212eb07131
commit
9fb6ec91cb
5 files changed
+30
-17
No files matched your search
@@ -481,9 +481,9 @@ public class Expression
|
||||
}
|
||||
|
||||
|
||||
public void addLazyFunction(String name, int num_params, TriFunction<Context, Context.Type, List<LazyValue>, LazyValue> fun)
|
||||
public void addLazyFunction(String name, int numParams, TriFunction<Context, Context.Type, List<LazyValue>, LazyValue> fun)
|
||||
{
|
||||
functions.put(name, new AbstractLazyFunction(num_params, name)
|
||||
functions.put(name, new AbstractLazyFunction(numParams, name)
|
||||
{
|
||||
@Override
|
||||
public boolean pure() {
|
||||
@@ -499,8 +499,11 @@ public class Expression
|
||||
public LazyValue lazyEval(Context c, Context.Type i, Expression e, Tokenizer.Token t, List<LazyValue> lazyParams)
|
||||
{
|
||||
ILazyFunction.checkInterrupts();
|
||||
if (num_params >= 0 && lazyParams.size() != num_params)
|
||||
throw new InternalExpressionException("'"+name+"' requires "+num_params+" parameters, "+lazyParams.size()+" provided.");
|
||||
if (numParams >= 0 && lazyParams.size() != numParams)
|
||||
{
|
||||
String error = "Function '"+name+"' requires "+numParams+" arguments, got "+lazyParams.size()+". ";
|
||||
throw new InternalExpressionException(error + (fun instanceof Fluff.UsageProvider up ? up.getUsage() : ""));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user