Expose read-only AST Node traversal API and internal classifiers#11
Expose read-only AST Node traversal API and internal classifiers#11sewerynplazuk wants to merge 1 commit into
Conversation
| } | ||
|
|
||
| var isMacroExpandion: Bool { | ||
| public var isMacroExpansion: Bool { |
|
Thanks for the follow-up to #9, @sewerynplazuk — and nice catch on the One concern before merging: exposing classifiers like What if we exposed the goal directly instead? public extension String {
/// The nominal type or module that owns the demangled symbol.
var nominalOwner: SymbolOwner? { get }
}Internally it would reuse your classifiers but keep them Two questions to size this right:
The |
|
Hey @oozoofrog, I'm sorry for the late reply!
That's pretty much what I have right now. The “default” part is an acceptable simplification for my use case, but I'm not sure if it's acceptable upstream. It's for sure not always correct.
Just the owner for my use case. |
|
Hi @sewerynplazuk, No worries, I’m late getting back to this too. Thanks for sharing the call site. This clarifies the use case. Since the goal is specifically to find the owner, I don’t think we should expose I think Also, since you mentioned the current fallback is not always correct, I don’t think we should merge that behavior implicitly through public classifiers. Could you revise the PR in that direction? |
This PR enables downstream tools to traverse the demangled AST to find the nominal owners of symbols. Currently, they have to manually duplicate compiler logic to guess what constitutes a "context" or "function attribute," which may break between Swift releases.
The changes are straightforward and don't add any new logic or maintenance burden to upstream. Please let me know if this is acceptable, as it does enforce some sort of public contract.