fix: make jserializer factory functions WASM-compatible#5
Open
abdalraheemKshinba wants to merge 6 commits into
Open
fix: make jserializer factory functions WASM-compatible#5abdalraheemKshinba wants to merge 6 commits into
abdalraheemKshinba wants to merge 6 commits into
Conversation
Author
|
Note: this PR is stacked on top of #3 (the Dart 3.7 / analyzer 9 migration). GitHub cannot set the base of this upstream PR to abdalraheemKshinba:feat/migrate-to-dart-3.7-analyzer-9 because PR base branches must exist in the upstream repo.\n\nFor the clean minimal diff, review the fork PR: https://github.com/abdalraheemKshinba/jserializer_library/pull/1\n\nOnce #3 is merged into upstream main, this PR should show only the WASM function type compatibility fix. |
62d1c38 to
bd3b830
Compare
- Update all packages to SDK >=3.7.0 <4.0.0 - Migrate to analyzer >=8.0.0 <10.0.0 - Update source_gen to >=4.0.0 <5.0.0 - Update build to >=3.0.0 <5.0.0 - Fix all breaking API changes: - TypeChecker.fromRuntime -> TypeChecker.fromUrl - Element.name returns String? (add null assertions) - parameters -> formalParameters - enclosingElement3 -> enclosingElement - getDisplayString(withNullability:) -> getDisplayString() - PropertyAccessorElement -> GetterElement - ParameterElement -> FormalParameterElement - library.definingCompilationUnit -> library.firstFragment - param.metadata -> param.metadata.annotations - Add caching optimizations to generator and type resolver - Remove tracked IDE and system files, add .gitignore - Internal git refs point to erabti:main Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bd3b830 to
dff851e
Compare
Internal jserializer and merging_builder git refs now point to the fork's migration branch instead of erabti:main, since the migration changes haven't been merged upstream yet. Once PRs erabti#3 and erabti#5 are merged into erabti/jserializer_library main, these refs should be updated back to erabti:main.
dff851e to
5cd6d24
Compare
The generator code references safeLookup for safe field lookup configuration, but the annotation class was missing this parameter.
5cd6d24 to
5ed771a
Compare
The caching optimization from the perf PR could miss annotated classes from libraries loaded after stabilization. Revert to always loading the full library list for each annotated file.
…compatibility
In WASM, calling a bare Function with generic type arguments fails at
runtime. Change typeFactory parameter from Function to dynamic Function<X>()
so the generated code uses properly typed function closures.
Changes:
- generator.dart: refer('Function') -> refer('dynamic Function<X>()')
- types_registry.dart: all (f) and (Function f) -> (dynamic Function<X>() f)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5ed771a to
e3267d8
Compare
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.
This fixes WASM builds by replacing bare Function factory types with typed generic function signatures, avoiding function type compatibility errors in Dart WASM.\n\nThis branch is based on the Dart 3.7/analyzer 9 migration work from abdalraheemKshinba:jserializer_library#1 / upstream #3, so it may be reviewed as a stacked follow-up to #3 if needed.