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

Method sv_simulateLetInits

src/ast/ast_simulate.cpp:3341–3363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3339 }
3340
3341 vector<SimNode *> SimulateVisitor::sv_simulateLetInits(const ExprLet * pLet) {
3342 vector<SimNode *> simlist;
3343 simlist.reserve(pLet->variables.size());
3344 for (auto & var : pLet->variables) {
3345 SimNode * init;
3346 if (var->init) {
3347 init = sv_simulateLetInit(var, true);
3348 } else if (var->aliasCMRES ) {
3349 int bytes = var->type->getSizeOf();
3350 if ( bytes==0 ) {
3351 init = nullptr;
3352 } else if ( bytes <= 32 ) {
3353 init = context.code->makeNodeUnrollNZ<SimNode_InitLocalCMResN>(bytes, pLet->at,0);
3354 } else {
3355 init = context.code->makeNode<SimNode_InitLocalCMRes>(pLet->at,0,bytes);
3356 }
3357 } else {
3358 init = context.code->makeNode<SimNode_InitLocal>(pLet->at, var->stackTop, var->type->getSizeOf());
3359 }
3360 if (init) simlist.push_back(init);
3361 }
3362 return simlist;
3363 }
3364
3365 SimNode * SimulateVisitor::sv_simulateLetInit(const VariablePtr & var, bool local) {
3366 gc_guard _guard;

Callers 1

simulateLetInitsFunction · 0.80

Calls 4

reserveMethod · 0.45
sizeMethod · 0.45
getSizeOfMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected