Skip to content

Commit 32539d4

Browse files
authored
[Outlining] Test stringify-walker and fix Ifs (#7800)
Add unit tests checking that stringify-walker unnests control flow and places delimiters in the expected order. Fix a bug where control flow structures as if conditions were not traversed properly. Add an assertion that visited Try expressions do not have delegate clauses because they are not handled yet.
1 parent f99c826 commit 32539d4

File tree

3 files changed

+729
-143
lines changed

3 files changed

+729
-143
lines changed

src/passes/stringify-walker.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ template<typename SubType>
241241
inline void StringifyWalker<SubType>::scan(SubType* self, Expression** currp) {
242242
Expression* curr = *currp;
243243
if (Properties::isControlFlowStructure(curr)) {
244-
self->controlFlowQueue.push(curr);
245244
self->pushTask(doVisitExpression, currp);
246245
// The if-condition is a value child consumed by the if control flow, which
247246
// makes the if-condition a true sibling rather than part of its contents in
248247
// the binary format
249248
for (auto*& child : ValueChildIterator(curr)) {
250-
Super::scan(self, &child);
249+
scan(self, &child);
251250
}
251+
self->controlFlowQueue.push(curr);
252252
} else {
253253
Super::scan(self, currp);
254254
}
@@ -285,7 +285,7 @@ template<typename SubType> void StringifyWalker<SubType>::dequeueControlFlow() {
285285
}
286286
case Expression::Id::TryId: {
287287
auto* tryy = curr->cast<Try>();
288-
288+
assert(!tryy->isDelegate() && "TODO: try-delegate");
289289
addUniqueSymbol(SeparatorReason::makeTryStart(tryy));
290290
Super::walk(tryy->body);
291291
for (size_t i = 0; i < tryy->catchBodies.size(); i++) {

src/wasm-builder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,7 @@ class Builder {
788788
ret->body = body;
789789
ret->catchTags.set(catchTags);
790790
ret->catchBodies.set(catchBodies);
791+
ret->delegateTarget = delegateTarget;
791792
ret->finalize(type);
792793
return ret;
793794
}

0 commit comments

Comments
 (0)