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

fix: struct ordering #6

Merged
merged 1 commit into from
Dec 5, 2024
Merged

fix: struct ordering #6

merged 1 commit into from
Dec 5, 2024

Conversation

G4Vi
Copy link
Contributor

@G4Vi G4Vi commented Dec 4, 2024

Before objects were either inserted before already inserted objects that reference them or at the end of the list. This algorithm fails when structs are reference structs that reference other structs. Now dependent objects are always inserted first. To implement quickly it naively iterates over the object list N times to insert all of the remaining objects.

This allows the cpp bindgen to run successfully on the twenty schema with extism-js v1.3.0. Unfortunately it crashes on v1.2.0: Error: error generating plugin: failed to render template: wasm error: unreachable.

Before objects were either inserted before already inserted objects that
reference them or at the end of the list. This algorithm fails when
structs are reference structs that reference other structs. Now
dependent objects are always inserted first. To implement quickly it
naively iterates over the object list N times to insert all of the
remaining objects.
@G4Vi G4Vi requested a review from bhelx December 4, 2024 00:51
Copy link

@bhelx bhelx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is some unfortunate complexity but we what to do with the language wants. I think the way you've implemented it is clear here!

@G4Vi G4Vi merged commit 472c5bc into main Dec 5, 2024
1 check failed
@G4Vi G4Vi deleted the fix-struct-ordering branch December 5, 2024 15:14
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