| 1125 | } |
| 1126 | |
| 1127 | void SetList(GluaDecompileContextP ctx, Function* F, int a, int b, int c) { |
| 1128 | int i; |
| 1129 | DecTable* tbl = (DecTable*)FindFromListTail(&(F->tables), (ListItemCmpFn)MatchTable, &a); |
| 1130 | if (!tbl) { |
| 1131 | ctx->errortmp = std::string("No list found for R") + std::to_string(a) + " , SetList fails"; |
| 1132 | SET_ERROR(ctx, F, ctx->errortmp); |
| 1133 | return; |
| 1134 | } |
| 1135 | if (b == 0) { |
| 1136 | std::string rstr; |
| 1137 | i = 1; |
| 1138 | while (1) { |
| 1139 | rstr = GetR(ctx, F, a + i); |
| 1140 | if (ctx->error.length()>0) |
| 1141 | return; |
| 1142 | if (strcmp(rstr.c_str(), ".end") == 0) |
| 1143 | break; |
| 1144 | AddToTable(F, tbl, rstr, nullptr); // Lua5.1 specific TODO: it's not really this :( |
| 1145 | i++; |
| 1146 | }; |
| 1147 | } //should be {...} or func(func()) ,when b == 0, that will use all avaliable reg from R(a) |
| 1148 | |
| 1149 | for (i = 1; i <= b; i++) { |
| 1150 | auto rstr = GetR(ctx, F, a + i); |
| 1151 | if (ctx->error.length()>0) |
| 1152 | return; |
| 1153 | AddToTable(F, tbl, rstr, nullptr); // Lua5.1 specific TODO: it's not really this :( |
| 1154 | } |
| 1155 | } |
| 1156 | |
| 1157 | void UnsetPending(GluaDecompileContextP ctx, Function* F, int r) { |
| 1158 | if (!IS_VARIABLE(r)) { |
no test coverage detected