639 |
} |
} |
640 |
|
|
641 |
VMIntArrayExpr* FunctionCall::asIntArray() const { |
VMIntArrayExpr* FunctionCall::asIntArray() const { |
642 |
|
//FIXME: asIntArray() not intended for evaluation semantics (for both |
643 |
|
// performance reasons with arrays, but also to prevent undesired value |
644 |
|
// mutation by implied (hidden) evaluation, as actually done here. We must |
645 |
|
// force function evaluation here though, because we need it for function |
646 |
|
// calls to be evaluated at all. This issue should be addressed cleanly by |
647 |
|
// adjusting the API appropriately. |
648 |
|
FunctionCall* rwSelf = const_cast<FunctionCall*>(this); |
649 |
|
rwSelf->result = rwSelf->execVMFn(); |
650 |
|
|
651 |
if (!result) return 0; |
if (!result) return 0; |
652 |
VMIntArrayExpr* intArrExpr = dynamic_cast<VMIntArrayExpr*>(result->resultValue()); |
VMIntArrayExpr* intArrExpr = dynamic_cast<VMIntArrayExpr*>(result->resultValue()); |
653 |
return intArrExpr; |
return intArrExpr; |
654 |
} |
} |
655 |
|
|
656 |
VMRealArrayExpr* FunctionCall::asRealArray() const { |
VMRealArrayExpr* FunctionCall::asRealArray() const { |
657 |
|
//FIXME: asRealArray() not intended for evaluation semantics (for both |
658 |
|
// performance reasons with arrays, but also to prevent undesired value |
659 |
|
// mutation by implied (hidden) evaluation, as actually done here. We must |
660 |
|
// force function evaluation here though, because we need it for function |
661 |
|
// calls to be evaluated at all. This issue should be addressed cleanly by |
662 |
|
// adjusting the API appropriately. |
663 |
|
FunctionCall* rwSelf = const_cast<FunctionCall*>(this); |
664 |
|
rwSelf->result = rwSelf->execVMFn(); |
665 |
|
|
666 |
if (!result) return 0; |
if (!result) return 0; |
667 |
VMRealArrayExpr* realArrExpr = dynamic_cast<VMRealArrayExpr*>(result->resultValue()); |
VMRealArrayExpr* realArrExpr = dynamic_cast<VMRealArrayExpr*>(result->resultValue()); |
668 |
return realArrExpr; |
return realArrExpr; |