Skip to content

feat(context): add no-description Symbol API#744

Merged
buke merged 2 commits into
mainfrom
feat/symbol-no-description
May 22, 2026
Merged

feat(context): add no-description Symbol API#744
buke merged 2 commits into
mainfrom
feat/symbol-no-description

Conversation

@buke
Copy link
Copy Markdown
Owner

@buke buke commented May 22, 2026

  • add explicit constructors for local and global symbols without descriptions
  • keep the existing string-based Symbol constructors unchanged
  • cover no-description Symbol semantics and nil/closed guards in context tests

- add explicit constructors for local and global symbols without descriptions
- keep the existing string-based Symbol constructors unchanged
- cover no-description Symbol semantics and nil/closed guards in context tests
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors JavaScript symbol creation by introducing a private helper method and adding new functions to create symbols without descriptions, specifically NewSymbolWithoutDescription and NewGlobalSymbolWithoutDescription. Corresponding unit tests and safety guards for nil or closed contexts were also added. Feedback suggests optimizing NewSymbol and NewGlobalSymbol by moving the context validity check before C string allocations to avoid unnecessary memory overhead when the context is invalid.

Comment thread context.go
Comment thread context.go
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f04fc26) to head (3188aea).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #744   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines         3705      3713    +8     
=========================================
+ Hits          3705      3713    +8     
Files with missing lines Coverage Δ
context.go 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f04fc26...3188aea. Read the comment docs.

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

- move hasValidRef checks before C.CString in Symbol constructors
- keep the shared helper guard in place as a defensive fallback
- preserve existing behavior while removing unnecessary C allocations
@buke
Copy link
Copy Markdown
Owner Author

buke commented May 22, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces NewSymbolWithoutDescription and NewGlobalSymbolWithoutDescription to the Context struct, enabling the creation of JavaScript symbols without an explicit description. The implementation refactors existing symbol creation logic into a private newSymbol helper to reduce duplication. Additionally, comprehensive unit tests were added to verify the behavior of these new methods, including checks for nil and closed contexts. I have no feedback to provide as there were no review comments.

@buke buke merged commit 606b800 into main May 22, 2026
8 checks passed
@buke buke deleted the feat/symbol-no-description branch May 22, 2026 07:17
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.

1 participant