Skip to content

Commit

Permalink
Fix procedure as argument in sprintf() and lsprintf() not resolving
Browse files Browse the repository at this point in the history
Fix procedure as second and third argument in `sprintf()` and `lsprintf()` respectively causing a compile error when trying to resolve the procedure during optimization.

Fixes:
```
:proc _a() { return 123; } msg(sprintf('%x', _a()));
COMPILE ERROR: The function "_a" does not exist in the Java Interpreter
        at :Interpreter:1.45
```
  • Loading branch information
Pieter12345 committed Dec 25, 2024
1 parent e8efb5c commit adfe452
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1623,6 +1623,7 @@ public ParseTree optimizeDynamic(Target t, Environment env,
me.setChildren(children);
me.setOptimized(true); //After this run, we will be, anyways.
if(children.size() == 3 && children.get(2).getData() instanceof CFunction
&& ((CFunction) children.get(2).getData()).hasFunction()
&& ((CFunction) children.get(2).getData()).getFunction().getName().equals(array.NAME)) {
//Normally we can't do anything with a hardcoded array, it's considered dynamic. But in this case, we can at least pull up the arguments,
//because the array's size is constant, even if the arguments in it aren't.
Expand Down

0 comments on commit adfe452

Please sign in to comment.