fix: compile incrementors in for loops within the initializer's flow#2826
Merged
CountBleck merged 1 commit intoAssemblyScript:mainfrom Apr 2, 2024
Merged
fix: compile incrementors in for loops within the initializer's flow#2826CountBleck merged 1 commit intoAssemblyScript:mainfrom
CountBleck merged 1 commit intoAssemblyScript:mainfrom
Conversation
6293b10 to
550bbf5
Compare
HerrCai0907
approved these changes
Mar 10, 2024
Member
HerrCai0907
left a comment
There was a problem hiding this comment.
LGTM after fixes.
Please add assert test case like code in issue to enhance test quality.
Member
Author
|
@HerrCai0907 I don't think that's possible to do unless I have an |
Member
|
Like function inc(i: i32): i32 {
assert(i != 100); // failed
return i + 1;
}
export function _start(): void {
for (let i = 0; i < 1; i = inc(i)) {
let i = 100;
}
} |
It turns out that incrementors were compiled with the body's flow, which meant that the incrementor had access to local variables declared in the body. Now, incrementors no longer have access to such variables. Fixes AssemblyScript#2825.
HerrCai0907
approved these changes
Mar 12, 2024
MaxGraey
approved these changes
Mar 12, 2024
This was referenced Apr 3, 2024
Merged
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.
Fixes #2825.
Changes proposed in this pull request:
⯈ Compile for-loop incrementors within the initializer's flow