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

Refactor ast api #47

Merged
merged 19 commits into from
Jan 22, 2024
Merged

Refactor ast api #47

merged 19 commits into from
Jan 22, 2024

Conversation

Ygg01
Copy link
Owner

@Ygg01 Ygg01 commented Dec 29, 2023

Various refactors:

  • Made most properties/fields readonly
  • Added builders for AstMessage/AstTerm

Fixes #46

The serializers for FunctionReference and DynamicReference have been refactored and fixed. This includes updating conditions for properties and handling potential null values. Removed redundant converter in TestUtil following restructuring of serialization tests.
Updated and implemented multiple serializers in Linguini.Serialization to handle different types of data, including patterns, placeables, and named arguments. Additional tests were added in SerializeAndDeserializeTest.cs to verify correct serialization. Significant changes were also made to PatternSerializer and NamedArgumentSerializer.
A suite of new test cases have been added to SerializeAndDeserializeTest for comprehensive testing. Changes have been incorporated to the way of comparing Identifiers, using Identifier.Comparator for accurate comparisons.
Implemented equality logic for AstComment class in Entry.cs allowing for more complex comparisons. In addition to this, JSON deserialization has been implemented in CommentSerializer.cs allowing for reading AstComment from JSON. Now AstComment can be accurately compared and serialized from JSON format.
The commit moves the methods for variant and number literal serializations from the ResourceSerializer class to the VariantSerializer class. The move aids in organization and code readability, as variant serialization is now better isolated and number literal serialization is directly utilized in variant serialization. Exception messages for invalid inputs have also been improved during the refactoing.
Previously, all deserialization methods in the Converters threw a 'NotImplementedException'. The new updates replace these methods with actual implementations, ensuring that when serialized objects are read back, they are correctly converted back to their original form. This change improves the overall functionality and efficiency of the serialization process.
The serialization and deserialization test suite has been updated for clarity and performance. The process is now consolidated into a single method called `RoundTripTest()`. Additionally, equality implementations for `AstMessage` and `Junk` classes have been added, allowing for more reliable object comparison in tests. Implementations for processing `Junk` and `AstMessage` have been tweaked for correctness and better error reporting.
@Ygg01 Ygg01 merged commit dfa1d1b into master Jan 22, 2024
3 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.

Make better way to construct AstMessage/AstTerm
1 participant