Skip to content

Commit 53b0cd0

Browse files
committed
Update the return signatures of WebIDL indexing getters
1 parent 57522cd commit 53b0cd0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

crates/webidl/src/util.rs

+14
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,20 @@ impl<'src> FirstPassRecord<'src> {
580580
let structural =
581581
force_structural || is_structural(signature.orig.attrs.as_ref(), container_attrs);
582582
let catch = force_throws || throws(&signature.orig.attrs);
583+
let ret_ty = if id == &OperationId::IndexingGetter {
584+
// All indexing getters should return optional values (or
585+
// otherwise be marked with catch).
586+
match ret_ty {
587+
IdlType::Nullable(_) => ret_ty,
588+
ref ty @ _ => if catch {
589+
ret_ty
590+
} else {
591+
IdlType::Nullable(Box::new(ty.clone()))
592+
},
593+
}
594+
} else {
595+
ret_ty
596+
};
583597
let variadic = signature.args.len() == signature.orig.args.len()
584598
&& signature
585599
.orig

0 commit comments

Comments
 (0)