feat(api): align uint64 constructor and dump flags#745
Conversation
buke
commented
May 22, 2026
- add NewUint64 and the deprecated Uint64 alias for JavaScript Number values
- export Go dump flag constants that mirror the quickjs-ng runtime flags
- cover the new constructor and dump flag constants in focused context and runtime tests
- add NewUint64 and the deprecated Uint64 alias for JavaScript Number values - export Go dump flag constants that mirror the quickjs-ng runtime flags - cover the new constructor and dump flag constants in focused context and runtime tests
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #745 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 17
Lines 3705 3711 +6
=========================================
+ Hits 3705 3711 +6
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces NewUint64 and its deprecated alias Uint64 to the Context type, along with corresponding tests. It also exports a comprehensive set of DumpFlag constants in runtime.go to mirror the underlying QuickJS runtime flags. The reviewer suggested adding documentation comments to these new exported constants to improve discoverability and clarity for library users.
- document that DumpFlag* values mirror quickjs-ng runtime dump flags - note that the flags are combined with bitwise OR for Runtime.SetDumpFlags - clarify that DumpFlagAbortOnLeaks is intended for testing
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces NewUint64 and its deprecated alias Uint64 to the Context type, alongside a comprehensive set of DumpFlag constants for the Runtime. Feedback suggests implementing defensive checks for context validity in NewUint64 and enhancing documentation to warn about potential precision loss when mapping 64-bit integers to JavaScript Numbers.
- add a hasValidRef check before building a JavaScript Number from uint64 - document that NewUint64 and Uint64 return JavaScript Number values - warn about precision loss beyond 2^53 - 1 and point callers to NewBigUint64
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces NewUint64 and a deprecated Uint64 method to the Context struct, allowing the conversion of Go uint64 values to JavaScript Numbers. It also adds a comprehensive set of DumpFlag constants to the Runtime package, mirroring the quickjs-ng runtime dump flags. Corresponding tests have been added or updated to verify these new features. I have no feedback to provide.
- add nil-context coverage for NewUint64 in the existing libc helper guard test - add closed-context coverage for NewUint64 in the same guard test - keep the coverage fix isolated to the existing guard test surface