thingworx-field-work / ThingworxVSCodeProject

Develop thingworx models using a real IDE
MIT License
33 stars 17 forks source link

Maximum call stack size exceeded when two function call each other #70

Closed kklorenzotesta closed 6 months ago

kklorenzotesta commented 6 months ago

Since 2.0.1 when two function call each other like in:

function f1() {
  f2();
}

function f2() {
  if (false) {
    f1();
  }
}

@ThingDefinition
class MyThing extends GenericThing {
  test() {
    f1();
  }
}

I get a

14:19:12> npm run build

> bm-thingworx-vscode@3.0.0 build
> twc build

Running build (v2.0.1)
✔ Built declarations
❯ Building ExampleProject
[                                        ] | 0%
✔ Created extension zip/bm-thingworx-vscode-3.0.0.zip
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[RangeError: Maximum call stack size exceeded]

Node.js v20.5.0

when building the project

kklorenzotesta commented 6 months ago

It also happens in general with recursive functions, even if its only one calling itself

BogdanMihaiciuc commented 6 months ago

I am aware of this and there is already a PR open on thing transformer that will resolve this, I'll let you know when I publish the release containing that fix

BogdanMihaiciuc commented 6 months ago

This should be resolved in transformer/cli version 2.1. Please reopen if you're still encountering this.