feat(generator): add support for map[string]bool/int/float64#85
Merged
Conversation
- Extend GoType to support MapValue field for map scalar values - Update parseGoType to recognize map[string]bool, map[string]int, map[string]float64 - Update code generation to handle new map types - Refactor FS_ListDir from raw FFI to idiomatic: - Returns map[string]bool instead of constructing DirEntry structs - Ard code builds DirEntry struct from map - Removes getFSDirEntryType() type lookup entirely - Reduce raw FFI count from 15 to 14 This eliminates one type lookup (GetStdType pattern) by returning simpler types and letting Ard construct the struct.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Extends the FFI generator to support
map[string]bool,map[string]int, andmap[string]float64(previously onlymap[string]stringwas supported).Changes
Generator Extension
GoTypestruct withMapValuefield (replacesIsStringMap bool)parseGoTypeto recognizemap[string]bool,map[string]int,map[string]float64generateParamUnwrapandgenerateReturnWrapFS_ListDir Refactor
map[string]bool(name → is_file) instead of constructingDirEntrystructs in GoDirEntrystructs from the mapgetFSDirEntryType()type lookup entirelyBefore/After
Before (Raw FFI)
After (Idiomatic FFI)
Benefits
GetStdTypepattern)Testing
map[string]boolcorrectly generates.AsBool()for unwrapping andMakeBoolfor wrappingmap[string]intcorrectly generates.AsInt()for unwrapping andMakeIntfor wrapping