MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / sv_makeMove

Method sv_makeMove

src/ast/ast_simulate.cpp:575–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

573 }
574
575 SimNode * SimulateVisitor::sv_makeMove (const LineInfo & at, ExpressionPtr lE, ExpressionPtr rE ) {
576 const auto & rightType = *rE->type;
577 // now, call with CMRES
578 if ( rE->rtti_isCall() ) {
579 auto cll = static_cast<ExprCall*>(rE);
580 if ( cll->allowCmresSkip() ) {
581 auto right = getE(rE);
582 getCallBase(right)->cmresEval = getE(lE);
583 return right;
584 }
585 }
586 // now, invoke with CMRES
587 if ( rE->rtti_isInvoke() ) {
588 auto cll = static_cast<ExprInvoke*>(rE);
589 if ( cll->allowCmresSkip() ) {
590 auto right = getE(rE);
591 getCallBase(right)->cmresEval = getE(lE);
592 return right;
593 }
594 }
595 // now to the regular one
596 if ( rightType.isRef() ) {
597 auto left = getE(lE);
598 auto right = getE(rE);
599 return context.code->makeNode<SimNode_MoveRefValue>(at, left, right, rightType.getSizeOf());
600 } else {
601 // this here might happen during initialization, by moving value types
602 // like var t <- 5
603 // its ok to generate simplified set here
604 auto left = getE(lE);
605 auto right = getE(rE);
606 return context.code->makeValueNode<SimNode_Set>(rightType.getR2VType(), at, left, right);
607 }
608 }
609
610 SimNode * Function::makeSimNode ( Context & context, const vector<ExpressionPtr> & ) {
611 if ( copyOnReturn || moveOnReturn ) {

Callers

nothing calls this directly

Calls 4

getCallBaseFunction · 0.85
isRefMethod · 0.80
getR2VTypeMethod · 0.80
getSizeOfMethod · 0.45

Tested by

no test coverage detected