Skip to content

Commit

Permalink
parser: Read {a,}sync-func annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
A6GibKm committed Jun 2, 2024
1 parent f4162ce commit 7af7667
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,8 @@ pub struct Function {
pub doc: Option<String>,
pub doc_deprecated: Option<String>,
pub finish_func: Option<String>,
pub async_func: Option<String>,
pub sync_func: Option<String>,
}

#[derive(Debug)]
Expand Down
6 changes: 6 additions & 0 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,8 @@ impl Library {
doc,
doc_deprecated,
finish_func: None,
async_func: None,
sync_func: None,
})
} else {
Err(parser.fail("Missing <return-value> element"))
Expand Down Expand Up @@ -1019,6 +1021,8 @@ impl Library {
let is_method = kind == FunctionKind::Method;
let version = self.read_version(parser, ns_id, elem)?;
let deprecated_version = self.read_deprecated_version(parser, ns_id, elem)?;
let async_func = elem.attr("async-func").map(ToString::to_string);
let sync_func = elem.attr("sync-func").map(ToString::to_string);
let finish_func = c_identifier.and_then(|c_identifier| {
elem.attr("finish-func").map(|finish_func_name| {
format!(
Expand Down Expand Up @@ -1092,6 +1096,8 @@ impl Library {
doc,
doc_deprecated,
finish_func,
async_func,
sync_func,
})
} else {
Err(parser.fail_with_position(
Expand Down

0 comments on commit 7af7667

Please sign in to comment.