Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Move ABI versioning information from Parser to TreeSitter #129

Merged
merged 6 commits into from
Feb 11, 2024

Conversation

dabico
Copy link
Member

@dabico dabico commented Feb 11, 2024

Since we already have a class dedicated to tree-sitter versioning information, we should use it. Although ABI information was introduced back in 1.6.0, there were no dedicated versioning classes to contain this information, so we opted to store it in the Parser. Now that we have TreeSitter, said information feels more at place there, and as such we have opted to deprecate the following methods from Parser:

  • Parser#getLanguageVersion
  • Parser#getMinimumCompatibleLanguageVersion

And replace them with the equivalent TreeSitter methods:

  • TreeSitter#getCurrentABIVersion
  • TreeSitter#getMinimumABIVersion

As such the native code from Parser was moved to TreeSitter. Those deprecated methods are marked for removal, but they currently just call the new methods.

Although it _should_ not be triggered normally, I do think that it
should mirror the behaviour of the setter error behaviour.
Since we have re-introduced `TreeSitter` as a metaclass, I felt that the
ABI versioning information feels more at place there than it does in the
`Parser`. Conveniently, the generation of this versioning file takes
place right before compilation and the header files can thus be
generated properly on `package`. Subsequent commits will focus on laying
the foundation for sunsetting the corresponding `Parser` methods.
This affects:
- `Parser#getLanguageVersion`
- `Parser#getMinimumCompatibleLanguageVersion`

Both methods have been marked as deprecated for removal, each JavaDoc
explaining the alternative method to use. The native implementations of
the methods have been replaced with a delegating call to the new methods
of `TreeSitter`
@dabico dabico merged commit 443d190 into master Feb 11, 2024
2 checks passed
@dabico dabico deleted the refactoring/abi branch February 11, 2024 10:18
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant