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

Function PrintBlockStatement

src/Chain/libraries/glua/glua_statement.cpp:143–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141 }
142
143 void PrintBlockStatement(GluaDecompileContextP ctx, AstStatement* stmt, std::stringstream &buff, int indent) {
144 std::stringstream startCode;
145 std::stringstream endCode;
146 switch (stmt->type) {
147 case DO_STMT:
148 startCode << "do";
149 endCode << "end";
150 break;
151 case FUNCTION_STMT:
152 startCode << "function(" << stmt->code << ")";
153 endCode << "end";
154 break;
155 case WHILE_STMT:
156 startCode << "while " << stmt->code << " do";
157 endCode << "end";
158 break;
159 case REPEAT_STMT:
160 startCode << "repeat";
161 endCode << "until " << stmt->code;
162 break;
163 case FORLOOP_STMT:
164 startCode << "for " << stmt->code << " do";
165 endCode << "end";
166 break;
167 case TFORLOOP_STMT:
168 startCode << "for " << stmt->code << " do";
169 endCode << "end";
170 break;
171 default:
172 PrintIndent(buff, indent);
173 buff << "-- DECOMPILER ERROR: unexpected statement " << stmttype[stmt->type] << " , should be one of LOOP_STMT\n";
174 goto PrintLoopStatement_ERROR_HANDLER;
175 }
176 PrintIndent(buff, indent);
177 buff << startCode.str() << "\n";
178 PrintAstSub(ctx, stmt, buff, indent + 1);
179 PrintIndent(buff, indent);
180 buff << endCode.str() << "\n";
181 PrintLoopStatement_ERROR_HANDLER:
182 (0);
183 }
184
185 void PrintIfStatement(GluaDecompileContextP ctx, AstStatement* stmt, std::stringstream &buff, int indent, int elseif) {
186 AstStatement* thenstmt = lua_cast(AstStatement*, stmt->sub->head);

Callers 1

PrintAstStatementFunction · 0.85

Calls 3

PrintIndentFunction · 0.85
PrintAstSubFunction · 0.85
strMethod · 0.45

Tested by

no test coverage detected