--- linuxsampler/trunk/src/scriptvm/tree.cpp 2020/01/10 16:02:35 3713 +++ linuxsampler/trunk/src/scriptvm/tree.cpp 2020/01/11 20:19:11 3714 @@ -639,12 +639,30 @@ } VMIntArrayExpr* FunctionCall::asIntArray() const { + //FIXME: asIntArray() not intended for evaluation semantics (for both + // performance reasons with arrays, but also to prevent undesired value + // mutation by implied (hidden) evaluation, as actually done here. We must + // force function evaluation here though, because we need it for function + // calls to be evaluated at all. This issue should be addressed cleanly by + // adjusting the API appropriately. + FunctionCall* rwSelf = const_cast(this); + rwSelf->result = rwSelf->execVMFn(); + if (!result) return 0; VMIntArrayExpr* intArrExpr = dynamic_cast(result->resultValue()); return intArrExpr; } VMRealArrayExpr* FunctionCall::asRealArray() const { + //FIXME: asRealArray() not intended for evaluation semantics (for both + // performance reasons with arrays, but also to prevent undesired value + // mutation by implied (hidden) evaluation, as actually done here. We must + // force function evaluation here though, because we need it for function + // calls to be evaluated at all. This issue should be addressed cleanly by + // adjusting the API appropriately. + FunctionCall* rwSelf = const_cast(this); + rwSelf->result = rwSelf->execVMFn(); + if (!result) return 0; VMRealArrayExpr* realArrExpr = dynamic_cast(result->resultValue()); return realArrExpr;