MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / RawAddAstStatement

Function RawAddAstStatement

src/Chain/libraries/glua/glua_decompile.cpp:787–824  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

785}
786
787void RawAddAstStatement(Function* F, AstStatement* stmt) {
788 if (F->released_local) {
789 AstStatement* block = F->currStmt;
790 AstStatement* curr = lua_cast(AstStatement*, block->sub->head);
791 AstStatement* tail = lua_cast(AstStatement*, block->sub->tail);
792 AstStatement* prev = nullptr;
793 int count = 0;
794 int lpc = F->released_local;
795 F->released_local = 0;
796 while (curr) {
797 if (curr->line >= lpc) {
798 break;
799 }
800 prev = curr;
801 curr = lua_cast(AstStatement*, prev->super.next);
802 count++;
803 }
804 if (curr) {
805 //TODO check list.size
806 int blockSize = block->sub->size;
807
808 AstStatement* dostmt = MakeBlockStatement(DO_STMT, nullptr);
809 dostmt->line = lpc;
810
811 while (curr) {
812 AstStatement* next = lua_cast(AstStatement*, curr->super.next);
813 RemoveFromList(block->sub, lua_cast(ListItem*, curr));
814 AddToStatement(dostmt, curr);
815 curr = next;
816 }
817 AddToStatement(block, dostmt);
818 F->currStmt = dostmt;
819 }
820 }
821 stmt->line = F->pc;
822 AddToStatement(F->currStmt, stmt);
823 F->lastLine = F->pc;
824}
825
826void RawAddStatement(Function* F, std::stringstream &ss) {
827 AstStatement* stmt = MakeSimpleStatement(ss.str());

Callers 4

RawAddStatementFunction · 0.85
FlushWhile1Function · 0.85
FlushBooleanFunction · 0.85
AddAstStatementFunction · 0.85

Calls 3

MakeBlockStatementFunction · 0.85
RemoveFromListFunction · 0.85
AddToStatementFunction · 0.85

Tested by

no test coverage detected