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

Adds bugfixes for generated code #90

Merged
merged 4 commits into from
Mar 25, 2024

Conversation

desaikd
Copy link
Contributor

@desaikd desaikd commented Mar 18, 2024

Issue #88:

Description of changes:

This PR includes the first prerequisites of #88. This PR adds some bug fixes for the generated code.

List of changes:

  • First commit adds few bug fixes of the generated rust and java code. These changes are now inside code-gen-core.
    • changed the template for rust struct.
    • add is_root_type in CodeGenerator, this will be used for stepping in for root and type for consecutive calls just calling next. (Note: This will be removed once we have Lazy Reader APIs)
    • Added a boolean parameter to AbstractDataType::Struct that will be used by template to check if the generated struct is closed or can contain open content. (Note: This just sets up the parameter to the enum but is not yet being used by template, those changes will arrive in later PRs.)
    • Field entry that is used by template now stores the ISL type name as that will be used to determine calling read/write_sym/string, blob/clob etc.
    • changed java/class.templ to properly case properties of a class and adds a minor change for constructor signature.

Tests:

Still uses the older tests in ion-cli but will be refactored in following PRs to use new roundtrip tests.


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

@desaikd
Copy link
Contributor Author

desaikd commented Mar 20, 2024

As per an offline discussion, there is a possible solution for generated code testing without the need to create code-gen-core. Retracting the workspace set up PR, will open up a separate PR that introduces the new solution for generated code's testing.

@desaikd desaikd changed the title Sets workspace and seperates code generation logic in code-gen-core Adds bugfixes for generated code Mar 20, 2024
Copy link
Contributor

@popematt popematt left a comment

Choose a reason for hiding this comment

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

Is it possible to make the generated types implement WriteAsIon? I think that will make it easier overall, especially since there's already things like impl <T> WriteAsIon for Vec<T> where T: WriteAsIon.

@desaikd desaikd merged commit 5281cca into amazon-ion:master Mar 25, 2024
4 checks passed
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