fix: return LanguageRef in Parser::language
`ts_parser_language` doesn't do any refcounting, so we can't return the resulting pointer as an owned Language object
This commit is contained in:
parent
e87181ec9c
commit
c03977a87e
1 changed files with 2 additions and 2 deletions
|
|
@ -496,9 +496,9 @@ impl Parser {
|
|||
/// Get the parser's current language.
|
||||
#[doc(alias = "ts_parser_language")]
|
||||
#[must_use]
|
||||
pub fn language(&self) -> Option<Language> {
|
||||
pub fn language(&self) -> Option<LanguageRef<'_>> {
|
||||
let ptr = unsafe { ffi::ts_parser_language(self.0.as_ptr()) };
|
||||
(!ptr.is_null()).then(|| Language(ptr))
|
||||
(!ptr.is_null()).then_some(LanguageRef(ptr, PhantomData))
|
||||
}
|
||||
|
||||
/// Get the parser's current logger.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue