Closed kklorenzotesta closed 6 months ago
Thanks I will look into this
You should be able to fix this by updating your bm-thing-cli
/bm-thing-transformer
dependencies to version 2.0.1.
Please reopen if you're still seeing this issue after updating.
The fix is in this commit: https://github.com/BogdanMihaiciuc/ThingTransformer/commit/7520b5697fda9016eb1fac6de5e783f7b035da14
Normally, the thing transformer creates separate "code transformers" for global functions that are in files that haven't yet been processed and each of these can create their own code transformers for any other global functions they encounter. However these are not created when the global function is defined in the same file as the code that calls it since that transformer will end up visiting that global function at some point in its processing. The bug was that this rule was also in place for those code transformers specific to the global functions so they didn't properly process dependencies that were defined in the same file.
Thank you very much for the quick fix! I'll try it on monday
If I have a top level function that call another one like:
and f1 is called by a service in a Thing in a file that precedes alphabetically the file containing the function definitions, then f2 is not copied inside the service. Instead the service
is just:
In the transformer f2 is correcly collected as a dependency of the service but is not included in the transpiled service since f2 is not transpiled yet. I didn't understood the Transformer code good enough, but it seems like when visiting the nodes it compiles only the first level of dependencies discovered, maybe to avoid incidental infinite recursion.
A full ready to use example that reproduces the issue is on this fork: github.com/kklorenzotesta/ThingworxVSCodeProjectFunctionsOrderBug