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

Fix lexical environments in for loops #2917

Merged
merged 2 commits into from
May 11, 2023
Merged

Fix lexical environments in for loops #2917

merged 2 commits into from
May 11, 2023

Conversation

raskad
Copy link
Member

@raskad raskad commented May 8, 2023

This Pull Request changes the following:

  • Only push a new environment in for loops when the initializer is a LexicalDeclaration.
  • Push a new environment for every iteration when let bindings are used in the initializer.

@raskad raskad added bug Something isn't working execution Issues or PRs related to code execution labels May 8, 2023
@raskad raskad added this to the v0.17.0 milestone May 8, 2023
@raskad raskad requested a review from a team May 8, 2023 23:56
@github-actions
Copy link

github-actions bot commented May 9, 2023

Test262 conformance changes

Test result main count PR count difference
Total 94,657 94,657 0
Passed 73,889 73,901 +12
Ignored 17,505 17,505 0
Failed 3,263 3,251 -12
Panics 0 0 0
Conformance 78.06% 78.07% +0.01%
Fixed tests (12):
test/language/statements/for/scope-body-lex-boundary.js [strict mode] (previously Failed)
test/language/statements/for/scope-body-lex-boundary.js (previously Failed)
test/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js [strict mode] (previously Failed)
test/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js (previously Failed)
test/language/statements/let/syntax/let-closure-inside-initialization.js [strict mode] (previously Failed)
test/language/statements/let/syntax/let-closure-inside-initialization.js (previously Failed)
test/language/statements/let/syntax/let-closure-inside-condition.js [strict mode] (previously Failed)
test/language/statements/let/syntax/let-closure-inside-condition.js (previously Failed)
test/language/statements/let/syntax/let-closure-inside-next-expression.js [strict mode] (previously Failed)
test/language/statements/let/syntax/let-closure-inside-next-expression.js (previously Failed)
test/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js [strict mode] (previously Failed)
test/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js (previously Failed)

@codecov
Copy link

codecov bot commented May 9, 2023

Codecov Report

Merging #2917 (b6fe05c) into main (c827313) will increase coverage by 0.02%.
The diff coverage is 94.73%.

@@            Coverage Diff             @@
##             main    #2917      +/-   ##
==========================================
+ Coverage   51.98%   52.01%   +0.02%     
==========================================
  Files         431      431              
  Lines       43647    43669      +22     
==========================================
+ Hits        22690    22713      +23     
+ Misses      20957    20956       -1     
Impacted Files Coverage Δ
boa_engine/src/bytecompiler/statement/loop.rs 84.08% <94.11%> (+1.55%) ⬆️
boa_ast/src/declaration/variable.rs 95.45% <100.00%> (+0.10%) ⬆️
boa_engine/src/vm/call_frame/env_stack.rs 96.82% <100.00%> (ø)

Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

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

Everything looks good to me, just a couple questions/thoughts

boa_engine/src/vm/call_frame/env_stack.rs Show resolved Hide resolved
boa_engine/src/bytecompiler/statement/loop.rs Outdated Show resolved Hide resolved
@raskad raskad force-pushed the fix-for-loop-let branch from 6e72f41 to b6fe05c Compare May 10, 2023 21:29
Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Nice work!

Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

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

Nice work 😄

@nekevss nekevss added this pull request to the merge queue May 11, 2023
Merged via the queue into main with commit f57872c May 11, 2023
@jedel1043 jedel1043 deleted the fix-for-loop-let branch May 11, 2023 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working execution Issues or PRs related to code execution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants