Add optionality for parameters
This commit allows for parameters that does not require any arguments to be provided in function calls. It changes collection syntax where parameters are list of objects instead of primitive strings. A parameter has now 'name' and 'optional' properties. 'name' is required and used in same way as older strings as parameter definitions. 'Optional' property is optional, 'false' is the default behavior if undefined. It also adds additional validation to restrict parameter names to alphanumeric strings to have a clear syntax in expressions.
This commit is contained in:
15
tests/unit/stubs/FunctionCallArgumentStub.ts
Normal file
15
tests/unit/stubs/FunctionCallArgumentStub.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
// tslint:disable-next-line:max-line-length
|
||||
import { IFunctionCallArgument } from '@/application/Parser/Script/Compiler/FunctionCall/Argument/IFunctionCallArgument';
|
||||
|
||||
export class FunctionCallArgumentStub implements IFunctionCallArgument {
|
||||
public parameterName = 'stub-parameter-name';
|
||||
public argumentValue = 'stub-arg-name';
|
||||
public withParameterName(parameterName: string) {
|
||||
this.parameterName = parameterName;
|
||||
return this;
|
||||
}
|
||||
public withArgumentValue(argumentValue: string) {
|
||||
this.argumentValue = argumentValue;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user