Skip to content

fix: struct ordering#6

Merged
G4Vi merged 1 commit intomainfrom
fix-struct-ordering
Dec 5, 2024
Merged

fix: struct ordering#6
G4Vi merged 1 commit intomainfrom
fix-struct-ordering

Conversation

@G4Vi
Copy link
Copy Markdown
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
Copy Markdown

@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
@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