Fix failing of functions without revert code
Add missing empty/undefined handling to fix a bug where defining new functions without `revertCode:` fails.
This commit is contained in:
@@ -10,11 +10,14 @@ export class ExpressionsCompiler implements IExpressionsCompiler {
|
||||
public constructor(
|
||||
private readonly extractor: IExpressionParser = new CompositeExpressionParser()) { }
|
||||
public compileExpressions(
|
||||
code: string,
|
||||
code: string | undefined,
|
||||
args: IReadOnlyFunctionCallArgumentCollection): string {
|
||||
if (!args) {
|
||||
throw new Error('undefined args, send empty collection instead');
|
||||
}
|
||||
if (!code) {
|
||||
return code;
|
||||
}
|
||||
const expressions = this.extractor.findExpressions(code);
|
||||
ensureParamsUsedInCodeHasArgsProvided(expressions, args);
|
||||
const context = new ExpressionEvaluationContext(args);
|
||||
|
||||
Reference in New Issue
Block a user