12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { Expression } from './expression';
- import { LanguageDefinedFunction } from '../../processor/definedFunctions';
- export class FunctionCall extends Expression {
- constructor (id, actualParameters) {
- super();
- this.id = id;
- this.actualParameters = actualParameters;
- }
- get isMainCall () {
- return this.id === null;
- }
- get parametersSize () {
- return this.actualParameters.length;
- }
- toString () {
- let name = null;
- if(this.isMainCall) {
- name = LanguageDefinedFunction.getMainFunctionName();
- } else {
- name = LanguageDefinedFunction.getLocalName(this.id);
- }
- let params = null;
- if(this.actualParameters.length == 0) {
- params = "()";
- } else {
- const strParams = this.actualParameters.map(v => v.toString());
- params = "(" + strParams.join(",") + ")";
- }
- if(this.parenthesis) {
- return `(${name + params})`;
- } else {
- return name + params;
- }
- }
- }
|