Merged
Conversation
- Add BSON utilities (BSONWriter, BSONReader) with proper type handling - Implement toBSON and fromBSON JIT compilation functions - Add BSON type constants and helper functions - Update core types to include ToBSONFn and FromBSONFn - Add BSON functions to JIT compiler and base RunType classes - Create comprehensive test suite for BSON serialization - Support atomic types: null, boolean, number, string, bigint - Support collection types: arrays, objects, literals - Follow BSON 1.1 specification for binary format - Fix linting issues and code formatting
- Fix BSON function configuration to use expression type and standard jitArgs - Implement atomic types: null, boolean, number, string, bigint, literal - Generate JIT code that returns Uint8Array expressions instead of modifying shared buffer - Use dynamic variable names with comp.getNestLevel() for unique naming - Follow BSON 1.1 specification for binary format - All atomic type tests passing: null, boolean, string, int32 number serialization - Use self-invoking functions for complex logic to return single expressions - Fix linting issues by removing unused imports and parameters
- Remove bsonUtils.ts file as it's not needed for JIT approach - Rewrite bson.spec.ts to test JIT-generated code following toCode.spec.ts pattern - Fix fromBSON.ts import to use inline BSON_TYPES constants - Add comprehensive tests for all atomic types: null, boolean, string, number, bigint - Add tests for literal types: string, number, boolean literals - Verify JIT code generation with DEBUG_JIT flag shows correct optimized code - All 10 BSON serialization tests passing - JIT generates proper BSON format with type detection and dynamic variable names - Fix code formatting with Prettier
- Add tests for empty strings, Unicode strings, negative numbers, zero, and large bigints - Verify proper UTF-8 encoding for Unicode characters including emojis - Test boundary conditions for number types and string lengths - All 15 BSON tests passing including edge cases - Verify existing functionality still works (toCode and string runType tests passing) - JIT code generation handles all edge cases correctly
- Add back bsonUtils.ts with class-based BSONWriter/BSONReader for reference - Create bsonPureFunctions.ts with pure functional BSON utilities - Pure functions have no external dependencies, all constants defined inside - Buffer state passed as parameters, immutable functional approach - Add comprehensive tests for both class-based and pure functional approaches - Create bsonExamples.ts demonstrating all three approaches: 1. JIT-generated (production) 2. Class-based (reference) 3. Pure functional (alternative reference) - All 18 tests passing including reference implementation tests - Examples show identical output from all three approaches - Fix linting issues with const/let usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add binary serialization feature, WIP