Skip to content

Commit adfe452

Browse files
committed
Fix procedure as argument in sprintf() and lsprintf() not resolving
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 ```
1 parent e8efb5c commit adfe452

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/java/com/laytonsmith/core/functions/StringHandling.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,7 @@ public ParseTree optimizeDynamic(Target t, Environment env,
16231623
me.setChildren(children);
16241624
me.setOptimized(true); //After this run, we will be, anyways.
16251625
if(children.size() == 3 && children.get(2).getData() instanceof CFunction
1626+
&& ((CFunction) children.get(2).getData()).hasFunction()
16261627
&& ((CFunction) children.get(2).getData()).getFunction().getName().equals(array.NAME)) {
16271628
//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,
16281629
//because the array's size is constant, even if the arguments in it aren't.

0 commit comments

Comments
 (0)