feat(context): add no-description Symbol API#744
Conversation
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
There was a problem hiding this comment.
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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
- 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
|
/gemini review |
There was a problem hiding this comment.
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.