Skip to content

Commit eca6448

Browse files
committed
Don’t re-declare protocols from partial interface mixins
1 parent 80cc677 commit eca6448

File tree

5 files changed

+4
-4
lines changed

5 files changed

+4
-4
lines changed

Sources/CSSOM/Generated.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,6 @@ public class ConvertCoordinateOptions: BridgedDictionary {
16401640
public var toBox: CSSBoxType
16411641
}
16421642

1643-
public protocol DocumentOrShadowRoot: JSBridgedClass {}
16441643
public extension DocumentOrShadowRoot {
16451644
@inlinable var styleSheets: StyleSheetList { jsObject[Strings.styleSheets].fromJSValue()! }
16461645

Sources/Gamepad/Generated.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ public class Navigator: JSBridgedClass {
377377
}
378378
}
379379

380-
public protocol WindowEventHandlers: JSBridgedClass {}
381380
public extension WindowEventHandlers {
382381
@inlinable var ongamepadconnected: EventHandler {
383382
get { ClosureAttribute1Optional[Strings.ongamepadconnected, in: jsObject] }

Sources/WebAnimations/Generated.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ public class ComputedEffectTiming: BridgedDictionary {
340340
public var currentIteration: Double?
341341
}
342342

343-
public protocol DocumentOrShadowRoot: JSBridgedClass {}
344343
public extension DocumentOrShadowRoot {
345344
@inlinable func getAnimations() -> [Animation] {
346345
let this = jsObject

Sources/WebIDLToSwift/MergeDeclarations.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,14 @@ enum DeclarationMerger {
102102
grouping: allNodes(ofType: IDLInterfaceMixin.self).map {
103103
MergedMixin(
104104
name: $0.name,
105+
partial: $0.partial,
105106
members: enhanceMembers($0.members.array) as! [IDLInterfaceMixinMember]
106107
)
107108
},
108109
by: \.name
109110
).mapValues {
110111
$0.dropFirst().reduce(into: $0.first!) { partialResult, mixin in
112+
partialResult.partial = partialResult.partial && mixin.partial
111113
partialResult.members += mixin.members
112114
}
113115
}
@@ -273,6 +275,7 @@ struct MergedNamespace: DeclarationFile {
273275

274276
struct MergedMixin: DeclarationFile {
275277
let name: String
278+
var partial: Bool
276279
var members: [IDLInterfaceMixinMember]
277280
}
278281

Sources/WebIDLToSwift/WebIDL+SwiftRepresentation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ extension MergedMixin: SwiftRepresentable {
305305
var swiftRepresentation: SwiftSource {
306306
ModuleState.withScope(.instance(constructor: nil, this: "jsObject", className: "\(name)", inProtocol: true)) {
307307
"""
308-
public protocol \(name): JSBridgedClass {}
308+
\(partial ? "" : "public protocol \(name): JSBridgedClass {}")
309309
public extension \(name) {
310310
\(members.map(toSwift).joined(separator: "\n\n"))
311311
}

0 commit comments

Comments
 (0)