Conversation
tlively
reviewed
Apr 24, 2025
Comment on lines
+141
to
+144
| // We preserve the name of the tryy because IRBuilder expects | ||
| // visitTryStart() to be called on an empty Try, during the normal case of | ||
| // parsing. | ||
| auto name = curr->tryy->name; |
Member
There was a problem hiding this comment.
Suggested change
| // We preserve the name of the tryy because IRBuilder expects | |
| // visitTryStart() to be called on an empty Try, during the normal case of | |
| // parsing. | |
| auto name = curr->tryy->name; | |
| // We preserve the name of the tryy because IRBuilder expects | |
| // visitTryStart() to be called on an empty Try, during the normal case of | |
| // parsing. TODO: Fix this. | |
| auto name = curr->tryy->name; |
src/wasm-ir-builder.h
Outdated
Comment on lines
+402
to
+403
| makeTry(Try* tryy, Name originalLabel, Type inputType, Index index) { | ||
| return ScopeCtx(TryScope{tryy, originalLabel, index}, inputType); |
Member
There was a problem hiding this comment.
It would never make sense to create a Try scope with any index other than 0.
Suggested change
| makeTry(Try* tryy, Name originalLabel, Type inputType, Index index) { | |
| return ScopeCtx(TryScope{tryy, originalLabel, index}, inputType); | |
| makeTry(Try* tryy, Name originalLabel, Type inputType) { | |
| return ScopeCtx(TryScope{tryy, originalLabel, 0}, inputType); |
src/wasm-ir-builder.h
Outdated
Comment on lines
+405
to
+406
| static ScopeCtx makeCatch(ScopeCtx&& scope, Try* tryy, Index index) { | ||
| scope.scope = CatchScope{tryy, scope.getOriginalLabel(), index}; |
Member
There was a problem hiding this comment.
Let's remove the index parameter here and do the increment automatically, since it never makes sense to create a Catch (or CatchAll) scope with any index other than one more than the previous index.
src/wasm/wasm-ir-builder.cpp
Outdated
Comment on lines
+951
to
+962
| // Indexes are managed manually to support Outlining. | ||
| // Its prepopulated try catchBodies and catchTags vectors | ||
| // cannot be appended to, as in the case of the empty try | ||
| // used during parsing. | ||
| if (tryy->catchBodies.size() < index) { | ||
| tryy->catchBodies.resize(tryy->catchBodies.size() + 1); | ||
| } | ||
| // The first time visitCatch is called: the body of the | ||
| // try is set and catchBodies is not appended to, but the tag | ||
| // for the following catch is appended. So, catchTags uses | ||
| // index as-is, but catchBodies uses index-1. | ||
| tryy->catchBodies[index - 1] = *expr; |
Member
There was a problem hiding this comment.
Let's put this all in a helper function since it's repeated three times.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supports try/catch/catchAll in the stringify of the module. Its contents can now be outlined.