Skip to content

Commit dc0dacd

Browse files
committed
Allow imported types to be declared more than once
1 parent 8b9ac19 commit dc0dacd

File tree

1 file changed

+6
-1
lines changed
  • crates/cli-support/src/webidl

1 file changed

+6
-1
lines changed

crates/cli-support/src/webidl/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,12 @@ impl<'a> Context<'a> {
10881088
) -> Result<(), Error> {
10891089
let import = self.determine_import(import, &type_.name)?;
10901090
log::debug!("inserting import id {:x?}: {}", type_.id, type_.name);
1091-
assert!(self.aux.internal_refs.insert(type_.id, Referenceable::Import(import.clone())).is_none());
1091+
let parent = Referenceable::Import(import.clone());
1092+
match self.aux.internal_refs.insert(type_.id, parent) {
1093+
Some(Referenceable::Struct(_)) => unreachable!(),
1094+
Some(Referenceable::Import(previous)) => assert_eq!(previous, import),
1095+
None => (),
1096+
}
10921097

10931098
let (import_id, _id) = match self.function_imports.get(type_.instanceof_shim) {
10941099
Some(pair) => *pair,

0 commit comments

Comments
 (0)