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

Add reverse-topological index #545

Merged
merged 2 commits into from
Aug 28, 2020
Merged

Add reverse-topological index #545

merged 2 commits into from
Aug 28, 2020

Conversation

mtdowling
Copy link
Member

Some languages require types to be defined before they're referenced, so
they need a reverse topological ordering of shapes. They also need to
know which shapes are recursive so that they can use forward
declarations before referencing recursive types. This commit adds a
TopologicalIndex to smithy-codegen-core to provide a stable ordered
reverse-topological set of shapes, and a set of recursive shapes along
with their recursive closures. This recursive closure may also be of
interest to code generators when deciding whether or not a recursive
reference needs to be boxed or not to compute a type's size at compile
time.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Some languages require types to be defined before they're referenced, so
they need a reverse topological ordering of shapes. They also need to
know which shapes are recursive so that they can use forward
declarations before referencing recursive types. This commit adds a
TopologicalIndex to smithy-codegen-core to provide a stable ordered
reverse-topological set of shapes, and a set of recursive shapes along
with their recursive closures. This recursive closure may also be of
interest to code generators when deciding whether or not a recursive
reference needs to be boxed or not to compute a type's size at compile
time.
@mtdowling mtdowling merged commit 8ab2c73 into master Aug 28, 2020
@mtdowling mtdowling deleted the topological-sort branch September 14, 2020 22:49
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