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

Method sv_makeLocalCMResCopy

src/ast/ast_simulate.cpp:383–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381 }
382
383 SimNode * SimulateVisitor::sv_makeLocalCMResCopy(const LineInfo & at, uint32_t offset, ExpressionPtr rE ) {
384 const auto & rightType = *rE->type;
385 DAS_ASSERT ( rightType.canCopy() &&
386 "we are calling makeLocalCMResCopy on a type, which can't be copied."
387 "we should not be here, script compiler should have caught this during compilation."
388 "compiler later will likely report internal compilation error.");
389 auto right = getE(rE);
390 // now, call with CMRES
391 if ( rE->rtti_isCall() ) {
392 auto cll = static_cast<ExprCall*>(rE);
393 if ( cll->allowCmresSkip() ) {
394 getCallBase(right)->cmresEval = context.code->makeNode<SimNode_GetCMResOfs>(rE->at, offset);
395 return right;
396 }
397 }
398 // now, invoke with CMRES
399 if ( rE->rtti_isInvoke() ) {
400 auto cll = static_cast<ExprInvoke*>(rE);
401 if ( cll->allowCmresSkip() ) {
402 getCallBase(right)->cmresEval = context.code->makeNode<SimNode_GetCMResOfs>(rE->at, offset);
403 return right;
404 }
405 }
406 // wo standard path
407 auto left = context.code->makeNode<SimNode_GetCMResOfs>(rE->at, offset);
408 if ( rightType.isRef() ) {
409 return context.code->makeNode<SimNode_CopyRefValue>(at, left, right, rightType.getSizeOf());
410 } else {
411 return context.code->makeValueNode<SimNode_Set>(rightType.getR2VType(), at, left, right);
412 }
413 }
414
415 SimNode * SimulateVisitor::sv_makeLocalRefMove (const LineInfo & at, uint32_t stackTop, uint32_t offset, ExpressionPtr rE ) {
416 const auto & rightType = *rE->type;

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected