-
Notifications
You must be signed in to change notification settings - Fork 359
feat(dart): add uint annotation types to the fory's codegen system #3181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hey @chaokunyang |
|
@ayush00git Please add tests for feature pull request. |
|
Hey @chaokunyang |
dart/packages/fory/lib/src/codegen/analyze/impl/field/field_analyzer_impl.dart
Show resolved
Hide resolved
|
Hey @chaokunyang |
chaokunyang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Hey @chaokunyang |
Why?
While unsigned integer type annotations (
@Uint8Type,@Uint16Type,@Uint32Type,@Uint64Type) were added in PR #3144, they were not integrated into the code generation system. This meant:@Uint8Type() int agein struct fieldsWhat does this PR do?
1. Created Uint Annotation Analyzer
Added
uint_annotation_analyzer.dartto detect and parse uint type annotations during code generation:Supported annotations:
@Uint8Type()→ObjType.UINT8@Uint16Type()→ObjType.UINT16@Uint32Type()→ObjType.UINT32@Uint32Type(encoding: UintEncoding.varint)→ObjType.VAR_UINT32@Uint64Type()→ObjType.UINT64@Uint64Type(encoding: UintEncoding.varint)→ObjType.VAR_UINT64@Uint64Type(encoding: UintEncoding.tagged)→ObjType.TAGGED_UINT642. Extended Type Identifier System
Updated
analysis_type_identifier.dartto recognize uint annotation types:3. Integrated Annotation-Based Type Override
Modified
type_analyzer_impl.dartto support annotation-based type override:4. Updated Field Analyzer
Modified
field_analyzer_impl.dartto check for uint annotations:Related issues
Completes the unsigned integer annotation types support initiated in PR #3144 by integrating the annotations into the code generation system.
Does this PR introduce any user-facing change?
Does this PR introduce any public API change?
@Uint8Type(),@Uint16Type(),@Uint32Type(),@Uint64Type()annotations on nativeintfields in@ForyClassstructsencodingparameter for uint32/uint64@Uint8Type() int ageinstead ofUInt8 ageDoes this PR introduce any binary protocol compatibility change?
Benchmark
N/A - This PR only adds annotation processing during code generation (build-time). No runtime performance impact.