Skip to content

Commit fe01673

Browse files
committed
make fallible_semantic_parent do ffi call
1 parent 8504570 commit fe01673

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/clang.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ impl Cursor {
110110
/// See documentation for `lexical_parent` for details on semantic vs
111111
/// lexical parents.
112112
pub fn fallible_semantic_parent(&self) -> Option<Cursor> {
113-
let sp = self.semantic_parent();
113+
let sp = unsafe {
114+
Cursor { x: clang_getCursorSemanticParent(self.x) }
115+
};
114116
if sp == *self || !sp.is_valid() {
115117
return None;
116118
}
@@ -122,9 +124,7 @@ impl Cursor {
122124
/// See documentation for `lexical_parent` for details on semantic vs
123125
/// lexical parents.
124126
pub fn semantic_parent(&self) -> Cursor {
125-
unsafe {
126-
Cursor { x: clang_getCursorSemanticParent(self.x) }
127-
}
127+
self.fallible_semantic_parent().unwrap()
128128
}
129129

130130
/// Return the number of template arguments used by this cursor's referent,

0 commit comments

Comments
 (0)