feat: resolve file-scope string consts in decorator metadata#271
Open
ashley-hunter wants to merge 2 commits into
Open
feat: resolve file-scope string consts in decorator metadata#271ashley-hunter wants to merge 2 commits into
ashley-hunter wants to merge 2 commits into
Conversation
Introduce `StringConsts` (a `HashMap<&str, Ident>`) and `collect_string_consts`
to walk a program's top-level `const` declarations and capture literal string
values. Pass the map through `extract_directive_metadata`,
`extract_component_metadata`, and all helper functions so that identifier
references used as host-binding keys or values (e.g. `host: { [MARKER_ATTR]: '' }`)
are resolved to their string values at compile time, matching the official
Angular compiler's constant-folding behaviour.
Add integration tests covering identifier keys and identifier values in host
bindings for both directives and components.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
|
@ashley-hunter run cargo fmt |
Contributor
Author
|
Thank you - formatting fixed |
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 use of variables within decorators is not currently supported - this PR provides basic support for the use of variables in decorators. Currently this supports variables defined within the same file, e.g.
For full equivalent to Angular we would need to add resolving across multiple files, i.e. following imports - but that could be covered by a separate PR - this provides the initial basic support.