Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

CountBleck
Copy link
Member

Fixes #2946.

Changes proposed in this pull request:
⯈ Precompute the LHSes of && and || when possible
⯈ Simplify the emitted expression for && and || if LHS is a constant value

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@CountBleck CountBleck force-pushed the simplify-logical-and-or branch from ff06740 to 67c8361 Compare September 7, 2025 06:22
@CountBleck CountBleck marked this pull request as draft September 7, 2025 06:22
We now precompute the LHS and have an additional optimization to check
the truthiness of the LHS and use that to simplify the expression to
either the LHS or the RHS, without generating an `if`.

Fixes AssemblyScript#2946.
@CountBleck CountBleck force-pushed the simplify-logical-and-or branch from 67c8361 to fd9c479 Compare September 7, 2025 18:37
@CountBleck CountBleck marked this pull request as ready for review September 7, 2025 18:37
Copy link
Member

@HerrCai0907 HerrCai0907 left a comment

Choose a reason for hiding this comment

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

LGTM

@CountBleck CountBleck merged commit 9b5b78d into AssemblyScript:main Sep 8, 2025
14 checks passed
@CountBleck CountBleck deleted the simplify-logical-and-or branch September 8, 2025 03:24
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.

&& can't be calculated at compile time
2 participants