Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emitter framework: Allow reference context to be passed to emitTypeReference #2712

Merged

Conversation

timotheeguerin
Copy link
Member

@timotheeguerin timotheeguerin commented Nov 30, 2023

Current way of setting reference context is flawed in that you cannot have a different context to different reference. It is also run before the element itself instead of before emitting the reference so this mean the context would apply to the referrer as well.

This allows the emitTypeReference to take a parameter to patch the reference context

Next step would be to reconsider the *ReferenceContext and *Context methods to make more sense.

Copy link
Contributor

Changes in this PR will be published to the following url to try(check status of TypeSpec Pull Request Try It pipeline for publish status):
Playground: https://cadlplayground.z22.web.core.windows.net/prs/2712/

Website: https://tspwebsitepr.z22.web.core.windows.net/prs/2712/

@bterlson
Copy link
Member

bterlson commented Dec 1, 2023

Overall fine with the approach, but I think "patch" isn't a needed qualifier here - it's just plain reference context, set for any references from that point.

@timotheeguerin
Copy link
Member Author

timotheeguerin commented Dec 1, 2023

Overall fine with the approach, but I think "patch" isn't a needed qualifier here - it's just plain reference context, set for any references from that point.

that's fair I'll rename

@timotheeguerin timotheeguerin merged commit 4e63cab into microsoft:main Dec 1, 2023
10 checks passed
@timotheeguerin timotheeguerin deleted the emitter-framework-ref-context branch December 1, 2023 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants