Replace TOP-before-imports special case with assert

The case isn't actually possible afaict.
This commit is contained in:
Muh Muhten authored and Nico Williams committed 2019-02-20 19:16:18 -06:00
1 parent 4f4494c770
commit c814c4e001
1 file changed
+4 -7
+4 -7
View File
@@ -469,10 +469,10 @@ block block_drop_unreferenced(block body) {
jv block_take_imports(block* body) {
jv imports = jv_array();
inst* top = NULL;
if (body->first && body->first->op == TOP) {
top = block_take(body);
}
/* Parser should never generate TOP before imports */
assert(!(body->first && body->first->op == TOP && body->first->next &&
(body->first->next->op == MODULEMETA || body->first->next->op == DEPS)));
while (body->first && (body->first->op == MODULEMETA || body->first->op == DEPS)) {
inst* dep = block_take(body);
if (dep->op == DEPS) {
@@ -480,9 +480,6 @@ jv block_take_imports(block* body) {
}
inst_free(dep);
}
if (top) {
*body = block_join(inst_block(top),*body);
}
return imports;
}