Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions shared/tree-sitter-extractor/src/generator/ql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl fmt::Display for Class<'_> {
is_final: false,
return_type: None,
formal_parameters: vec![],
body: charpred.clone(),
body: Some(charpred.clone()),
overlay: None,
}
)?;
Expand Down Expand Up @@ -307,7 +307,9 @@ pub struct Predicate<'a> {
pub is_final: bool,
pub return_type: Option<Type<'a>>,
pub formal_parameters: Vec<FormalParameter<'a>>,
pub body: Expression<'a>,
/// The body of the predicate, or `None` if this is an `abstract`
/// predicate declaration with no body.
pub body: Option<Expression<'a>>,
pub overlay: Option<OverlayAnnotation>,
}

Expand All @@ -330,6 +332,9 @@ impl fmt::Display for Predicate<'_> {
if self.is_final {
write!(f, "final ")?;
}
if self.body.is_none() {
write!(f, "abstract ")?;
}
if self.overridden {
write!(f, "override ")?;
}
Expand All @@ -344,7 +349,10 @@ impl fmt::Display for Predicate<'_> {
}
write!(f, "{param}")?;
}
write!(f, ") {{ {} }}", self.body)?;
match &self.body {
Some(body) => write!(f, ") {{ {body} }}")?,
None => write!(f, ");")?,
}

Ok(())
}
Expand Down
Loading
Loading