[Dart] Fix issues in namespace_test#9103
Open
jakobkordez wants to merge 3 commits into
Open
Conversation
Contributor
Author
|
@jtdavis777 This is the issue I was referring to in #9088 |
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.
The Dart code generator was emitting invalid namespace qualifiers for enum and union types defined in nested namespaces. For example, it produced
namespace_a.namespace_b.EnumInNestedNs(dot-separated) instead of the correct Dart import aliasnamespace_a_namespace_b.EnumInNestedNs, and omitted the namespace prefix entirely for unionTypeIdenums. This happened becauseGenDartTypeNamehad a separate code path for enums that constructed the namespace prefix manually instead of routing throughMaybeWrapNamespacelike every other named type.Two further changes were required to make cross-namespace access work correctly:
_createOrNullwas removed from enums — its leading underscore made it private in Dart, so it could not be called from generated code in a different file. Enum reading now uses the public .reader directly (e.g.Color.reader.vTableGet(...)with a typed default).The per-field union switch dispatch was moved into a top-level
_getXxxReader()function in the same file as the union enum, so tables in other namespaces simply callxxxType?.valueReader?.vTableGetNullable(...)instead of embedding a switch that references type names they may not have access to.Commits c08fa85 and a71f417 were done to regenerate the
namespace_testtest that was failing. Commit 17e2ef3 is the actual fix and the files it affects.