MCPcopy Create free account
hub / github.com/albertodemichelis/squirrel / PrefixIncDec

Method PrefixIncDec

squirrel/sqcompiler.cpp:1511–1537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1509 _es = es;
1510 }
1511 void PrefixIncDec(SQInteger token)
1512 {
1513 SQExpState es;
1514 SQInteger diff = (token==TK_MINUSMINUS) ? -1 : 1;
1515 Lex();
1516 es = _es;
1517 _es.donot_get = true;
1518 PrefixedExpr();
1519 if(_es.etype==EXPR) {
1520 Error(_SC("can't '++' or '--' an expression"));
1521 }
1522 else if(_es.etype==OBJECT || _es.etype==BASE) {
1523 Emit2ArgsOP(_OP_INC, diff);
1524 }
1525 else if(_es.etype==LOCAL) {
1526 SQInteger src = _fs->TopTarget();
1527 _fs->AddInstruction(_OP_INCL, src, src, 0, diff);
1528
1529 }
1530 else if(_es.etype==OUTER) {
1531 SQInteger tmp = _fs->PushTarget();
1532 _fs->AddInstruction(_OP_GETOUTER, tmp, _es.epos);
1533 _fs->AddInstruction(_OP_INCL, tmp, tmp, 0, diff);
1534 _fs->AddInstruction(_OP_SETOUTER, tmp, _es.epos, tmp);
1535 }
1536 _es = es;
1537 }
1538 void CreateFunction(SQObject &name,SQInteger boundtarget,bool lambda = false)
1539 {
1540 SQFuncState *funcstate = _fs->PushChildState(_ss(_vm));

Callers

nothing calls this directly

Calls 3

TopTargetMethod · 0.80
PushTargetMethod · 0.80
AddInstructionMethod · 0.45

Tested by

no test coverage detected