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

Method sv_makeCopy

src/ast/ast_simulate.cpp:541–573  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539 }
540
541 SimNode * SimulateVisitor::sv_makeCopy(const LineInfo & at, ExpressionPtr lE, ExpressionPtr rE ) {
542 const auto & rightType = *rE->type;
543 DAS_ASSERT ( (rightType.canCopy() || rightType.isGoodBlockType()) &&
544 "we are calling makeCopy on a type, which can't be copied."
545 "we should not be here, script compiler should have caught this during compilation."
546 "compiler later will likely report internal compilation error.");
547 // now, call with CMRES
548 if ( rE->rtti_isCall() ) {
549 auto cll = static_cast<ExprCall*>(rE);
550 if ( cll->allowCmresSkip() ) {
551 auto right = getE(rE);
552 getCallBase(right)->cmresEval = getE(lE);
553 return right;
554 }
555 }
556 // now, invoke with CMRES
557 if ( rE->rtti_isInvoke() ) {
558 auto cll = static_cast<ExprInvoke*>(rE);
559 if ( cll->allowCmresSkip() ) {
560 auto right = getE(rE);
561 getCallBase(right)->cmresEval = getE(lE);
562 return right;
563 }
564 }
565 // now, to the regular copy
566 auto left = getE(lE);
567 auto right = getE(rE);
568 if ( rightType.isRef() ) {
569 return context.code->makeNode<SimNode_CopyRefValue>(at, left, right, rightType.getSizeOf());
570 } else {
571 return context.code->makeValueNode<SimNode_Set>(rightType.getR2VType(), at, left, right);
572 }
573 }
574
575 SimNode * SimulateVisitor::sv_makeMove (const LineInfo & at, ExpressionPtr lE, ExpressionPtr rE ) {
576 const auto & rightType = *rE->type;

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected