Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statically eliminate logical expression branches #1967

Merged
merged 2 commits into from
Jul 11, 2021
Merged

Conversation

dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Jul 11, 2021

As brought up in Discord, we currently do not statically eliminate expressions like isNullable<T>() && value === null, which may be surprising since we do this for normal ifs. This PR also applies it for logical expressions when interested in bool returns. Question is: Is this always safe?

  • I've read the contributing guidelines

@dcodeIO dcodeIO requested a review from MaxGraey July 11, 2021 09:49
@SebastianSpeitel
Copy link

Looking at the changes I already like how much unnecessary code was removed.

Copy link
Member

@MaxGraey MaxGraey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dcodeIO dcodeIO merged commit bf24bb9 into main Jul 11, 2021
romdotdog pushed a commit to romdotdog/assemblyscript that referenced this pull request Jul 19, 2021
@dcodeIO dcodeIO deleted the static-logical branch September 5, 2021 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants