Skip to content

Commit a711b1a

Browse files
committed
Fix readonly closure property precondition
1 parent d65dd9a commit a711b1a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/WebIDLToSwift/WebIDL+SwiftRepresentation.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,15 +671,16 @@ extension IDLType: SwiftRepresentable {
671671
// TODO: handle readonly closure properties
672672
// (should they be a JSFunction? or a closure? or something else?))
673673
if case let .single(name) = value {
674-
precondition(!readonly, "readonly closure properties are not supported")
675674
if let callback = ModuleState.types[name] as? IDLCallback {
675+
precondition(!readonly, "readonly closure properties are not supported")
676676
return "\(closureWrapper(callback, optional: false))"
677677
}
678678
if let ref = ModuleState.types[name] as? IDLTypedef,
679679
case let .single(name) = ref.idlType.value,
680680
let callback = ModuleState.types[name] as? IDLCallback
681681
{
682-
assert(ref.idlType.nullable)
682+
precondition(!readonly, "readonly closure properties are not supported")
683+
precondition(ref.idlType.nullable)
683684
return "\(closureWrapper(callback, optional: true))"
684685
}
685686
}

0 commit comments

Comments
 (0)