Skip to content

Commit

Permalink
Update the return signatures of WebIDL indexing getters
Browse files Browse the repository at this point in the history
  • Loading branch information
j-devel committed Oct 2, 2019
1 parent 57522cd commit 53b0cd0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/webidl/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,20 @@ impl<'src> FirstPassRecord<'src> {
let structural =
force_structural || is_structural(signature.orig.attrs.as_ref(), container_attrs);
let catch = force_throws || throws(&signature.orig.attrs);
let ret_ty = if id == &OperationId::IndexingGetter {
// All indexing getters should return optional values (or
// otherwise be marked with catch).
match ret_ty {
IdlType::Nullable(_) => ret_ty,
ref ty @ _ => if catch {
ret_ty
} else {
IdlType::Nullable(Box::new(ty.clone()))
},
}
} else {
ret_ty
};
let variadic = signature.args.len() == signature.orig.args.len()
&& signature
.orig
Expand Down

0 comments on commit 53b0cd0

Please sign in to comment.