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.
15 lines
479 B
TypeScript
15 lines
479 B
TypeScript
import { IFunctionParameter } from '@/application/Parser/Script/Compiler/Function/Parameter/IFunctionParameter';
|
|
|
|
export class FunctionParameterStub implements IFunctionParameter {
|
|
public name: string = 'function-parameter-stub';
|
|
public isOptional: boolean = true;
|
|
public withName(name: string) {
|
|
this.name = name;
|
|
return this;
|
|
}
|
|
public withOptionality(isOptional: boolean) {
|
|
this.isOptional = isOptional;
|
|
return this;
|
|
}
|
|
}
|