dart-lang / dart-lang/source_gen
Provide utility or recipe for referencing imported library aliases
- Dominant language
- Dart
- Stars
- 494
- Forks
- 115
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 3
Description
As referencing imported symbols is a common code generation need, it would be nice to provide a specific utility or recipe (with sample code) for doing so
As noted in #109:
> If you are generating code, and you have a DartType, and you want to know, "what prefix do I need to emit in order to produce a valid reference to this DartType", then using the element model to find the library is probably your best answer
It looks like `built_value` [parses the imported library's ast](https://github.com/google/built_value.dart/pull/703/files#diff-e86ce28f4538fe998a497569897b4a33)
Contributor guide
Research direction
Start by reading the discussion in #109, focusing on how a DartType and its element model identify the library and required import prefix. Compare that approach with the imported-library AST parsing shown in the linked built_value pull request. Done means a reviewed utility or recipe with sample code that addresses this code-generation use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100