Skip to content

fix eval delete bindings#5344

Open
Monti-27 wants to merge 3 commits into
boa-dev:mainfrom
Monti-27:evaldelete
Open

fix eval delete bindings#5344
Monti-27 wants to merge 3 commits into
boa-dev:mainfrom
Monti-27:evaldelete

Conversation

@Monti-27
Copy link
Copy Markdown
Contributor

Fixes #5333.

Direct eval-created local var and function bindings were not treated as deletable at runtime, so delete left them visible and later var initialization could recreate them.

This tracks deleted eval-created local bindings in function environments and avoids recreating them after deletion.

Tests:

  • cargo test -p boa_engine env -- --nocapture
  • cargo test -p boa_engine unary_delete -- --nocapture
  • cargo clippy -p boa_engine --all-features --all-targets -- -D warnings
  • cargo make run-ci

@Monti-27 Monti-27 requested a review from a team as a code owner April 22, 2026 09:22
@github-actions github-actions Bot added Waiting On Review Waiting on reviews from the maintainers C-Tests Issues and PRs related to the tests. C-Builtins PRs and Issues related to builtins/intrinsics C-VM Issues and PRs related to the Boa Virtual Machine. and removed Waiting On Review Waiting on reviews from the maintainers labels Apr 22, 2026
@github-actions github-actions Bot added this to the v1.0.0 milestone Apr 22, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

Test262 conformance changes

Test result main count PR count difference
Total 53,125 53,125 0
Passed 51,051 51,071 +20
Ignored 1,482 1,482 0
Failed 592 572 -20
Panics 0 0 0
Conformance 96.10% 96.13% +0.04%
Fixed tests (20):
test/staging/sm/Function/function-name-assignment.js (previously Failed)
test/staging/sm/strict/15.4.4.8.js (previously Failed)
test/staging/sm/strict/15.5.5.1.js (previously Failed)
test/staging/sm/strict/8.12.5.js (previously Failed)
test/staging/sm/strict/15.4.4.13.js (previously Failed)
test/staging/sm/strict/8.12.7.js (previously Failed)
test/staging/sm/strict/15.4.4.9.js (previously Failed)
test/staging/sm/strict/15.10.7.js (previously Failed)
test/staging/sm/strict/15.4.4.12.js (previously Failed)
test/staging/sm/async-functions/await-in-arrow-parameters.js (previously Failed)
test/staging/sm/async-functions/await-in-parameters-of-async-func.js (previously Failed)
test/staging/sm/expressions/nested-delete-name-in-evalcode.js (previously Failed)
test/staging/sm/expressions/destructuring-array-default-yield.js (previously Failed)
test/staging/sm/expressions/short-circuit-compound-assignment.js (previously Failed)
test/staging/sm/eval/exhaustive-fun-normalcaller-direct-normalcode.js (previously Failed)
test/staging/sm/PrivateName/lexical-presence.js (previously Failed)
test/staging/sm/extensions/for-loop-with-lexical-declaration-and-nested-function-statement.js (previously Failed)
test/staging/sm/extensions/nested-delete-name-in-evalcode.js (previously Failed)
test/language/eval-code/direct/var-env-func-init-local-new-delete.js (previously Failed)
test/language/eval-code/direct/var-env-var-init-local-new-delete.js (previously Failed)

Tested main commit: 3ce87f0fa03c5c037fb667f7f21a4996abbbc714
Tested PR commit: 15de044293e4c8f94052331b448e0f68356a4c7f
Compare commits: 3ce87f0...15de044

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 90.24390% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.05%. Comparing base (6ddc2b4) to head (15de044).
⚠️ Report is 965 commits behind head on main.

Files with missing lines Patch % Lines
core/engine/src/bytecompiler/mod.rs 40.00% 3 Missing ⚠️
core/engine/src/environments/runtime/mod.rs 90.32% 3 Missing ⚠️
core/engine/src/vm/code_block.rs 0.00% 3 Missing ⚠️
...e/src/environments/runtime/declarative/function.rs 94.59% 2 Missing ⚠️
...engine/src/environments/runtime/declarative/mod.rs 94.44% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5344       +/-   ##
===========================================
+ Coverage   47.24%   60.05%   +12.81%     
===========================================
  Files         476      566       +90     
  Lines       46892    63024    +16132     
===========================================
+ Hits        22154    37851    +15697     
- Misses      24738    25173      +435     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@zhuzhu81998 zhuzhu81998 left a comment

Choose a reason for hiding this comment

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

i am not familiar with this part of the codebase, but this feels, kinda hacky?

are you sure this is not something that happens because of incompliance with spec somewhere?

@Monti-27
Copy link
Copy Markdown
Contributor Author

Monti-27 commented May 7, 2026

i am not familiar with this part of the codebase, but this feels, kinda hacky?

are you sure this is not something that happens because of incompliance with spec somewhere?

Yeah, fair point. the current approach is not clean enough. The Test262 report also caught a regression around eval("var x=delete(x)") so I’ll rework this instead of trying to patch around it

@hansl hansl added the Waiting On Author Waiting on PR changes from the author label May 8, 2026
@hansl
Copy link
Copy Markdown
Contributor

hansl commented May 8, 2026

Let us know when this is ready to review, or close it and re-open a new PR :)

@Monti-27
Copy link
Copy Markdown
Contributor Author

Monti-27 commented May 9, 2026

this new changes moves deletability into the function environment itself, marks newly extended eval bindings as deletable, and re resolves stale deleted locators before assignment. this matches the EvalDeclarationInstantiation / CreateMutableBinding(name, true) behavior more directly

@github-actions github-actions Bot added the C-AST Issue surrounding the abstract syntax tree label May 9, 2026
@Monti-27
Copy link
Copy Markdown
Contributor Author

Monti-27 commented May 9, 2026

Updated this now. The fix keeps deleted eval-created bindings in the function environment and uses a separate eval declaration var path, so normal var statements do not recreate deleted bindings.

Tests:

  • cargo test -p boa_engine tests::env --lib
  • cargo clippy -p boa_engine -- -D warnings
  • cargo make run-ci from the pre-push hook
  • targeted Test262 eval delete cases

@Monti-27
Copy link
Copy Markdown
Contributor Author

Monti-27 commented May 9, 2026

@hansl its ready for review !!

@Monti-27 Monti-27 requested a review from zhuzhu81998 May 9, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-AST Issue surrounding the abstract syntax tree C-Builtins PRs and Issues related to builtins/intrinsics C-Tests Issues and PRs related to the tests. C-VM Issues and PRs related to the Boa Virtual Machine. Waiting On Author Waiting on PR changes from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eval-created local bindings survive delete

3 participants