| 785 | } |
| 786 | |
| 787 | void 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 | |
| 826 | void RawAddStatement(Function* F, std::stringstream &ss) { |
| 827 | AstStatement* stmt = MakeSimpleStatement(ss.str()); |
no test coverage detected