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

Skip to content

Conversation

@liblit
Copy link
Contributor

@liblit liblit commented Dec 17, 2025

Remove some redundant Map lookups, such as calling containsKey immediately before get. That's redundant as long as we never map to null, which appears to be the case for the maps we're modifying here.

Also codify the existing null-avoidance policy for these maps by adding JSpecify annotations. It's not clear how thoroughly current tools check this annotation when used on a Map's value type. But even if current tools don't check them, it's worth adding these annotations as documentation and (hopefully) as hints for future checkers.

Remove some redundant `Map` lookups, such as calling `containsKey`
immediately before `get`.  That's redundant as long as we never map to
`null`, which appears to be the case for the maps we're modifying here.

Also codify the existing `null`-avoidance policy for these maps by
adding JSpecify annotations.  It's not clear how thoroughly current
tools check this annotation when used on a `Map`'s value type.  But even
if current tools don't check them, it's worth adding these annotations
as documentation and (hopefully) as hints for future checkers.
@liblit liblit requested a review from msridhar December 17, 2025 23:34
@liblit liblit self-assigned this Dec 17, 2025
@liblit liblit added the cleanup API cleanup and refactoring label Dec 17, 2025
@liblit liblit enabled auto-merge December 17, 2025 23:35
@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.26%. Comparing base (5ee5461) to head (7c8e01e).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1813      +/-   ##
============================================
- Coverage     50.27%   50.26%   -0.01%     
+ Complexity    12658    12657       -1     
============================================
  Files          1365     1365              
  Lines         85091    85091              
  Branches      14682    14682              
============================================
- Hits          42777    42774       -3     
- Misses        37525    37526       +1     
- Partials       4789     4791       +2     

☔ 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.

@github-actions
Copy link

Test Results

  848 files  ±0    848 suites  ±0   5h 19m 11s ⏱️ - 14m 36s
  800 tests ±0    781 ✅ ±0   19 💤 ±0  0 ❌ ±0 
5 484 runs  ±0  5 349 ✅ ±0  135 💤 ±0  0 ❌ ±0 

Results for commit 7c8e01e. ± Comparison against base commit 5ee5461.

@liblit liblit added this pull request to the merge queue Dec 18, 2025
Merged via the queue into wala:master with commit 27574e5 Dec 18, 2025
13 checks passed
@liblit liblit deleted the avoid-redundant-map-lookups-in-cast-js-rhino branch December 18, 2025 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup API cleanup and refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants