| 505 | } |
| 506 | |
| 507 | SimNode * SimulateVisitor::sv_makeLocalCopy(const LineInfo & at, uint32_t stackTop, ExpressionPtr rE ) { |
| 508 | const auto & rightType = *rE->type; |
| 509 | DAS_ASSERT ( rightType.canCopy() && |
| 510 | "we are calling makeLocalCopy on a type, which can't be copied." |
| 511 | "we should not be here, script compiler should have caught this during compilation." |
| 512 | "compiler later will likely report internal compilation error."); |
| 513 | // now, call with CMRES |
| 514 | if ( rE->rtti_isCall() ) { |
| 515 | auto cll = static_cast<ExprCall*>(rE); |
| 516 | if ( cll->allowCmresSkip() ) { |
| 517 | auto right = getE(rE); |
| 518 | getCallBase(right)->cmresEval = context.code->makeNode<SimNode_GetLocal>(rE->at, stackTop); |
| 519 | return right; |
| 520 | } |
| 521 | } |
| 522 | // now, invoke with CMRES |
| 523 | if ( rE->rtti_isInvoke() ) { |
| 524 | auto cll = static_cast<ExprInvoke*>(rE); |
| 525 | if ( cll->allowCmresSkip() ) { |
| 526 | auto right = getE(rE); |
| 527 | getCallBase(right)->cmresEval = context.code->makeNode<SimNode_GetLocal>(rE->at, stackTop); |
| 528 | return right; |
| 529 | } |
| 530 | } |
| 531 | // now, to the regular copy |
| 532 | auto left = context.code->makeNode<SimNode_GetLocal>(rE->at, stackTop); |
| 533 | auto right = getE(rE); |
| 534 | if ( rightType.isRef() ) { |
| 535 | return context.code->makeNode<SimNode_CopyRefValue>(at, left, right, rightType.getSizeOf()); |
| 536 | } else { |
| 537 | return context.code->makeValueNode<SimNode_Set>(rightType.getR2VType(), at, left, right); |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | SimNode * SimulateVisitor::sv_makeCopy(const LineInfo & at, ExpressionPtr lE, ExpressionPtr rE ) { |
| 542 | const auto & rightType = *rE->type; |
nothing calls this directly
no test coverage detected