Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions inputfiles/overridingTypes.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -327,21 +327,6 @@
},
"interfaces": {
"interface": {
"CryptoKey": {
"properties": {
"property": {
"algorithm": {
"type": "KeyAlgorithm"
},
"usages": {
"type": "sequence",
"subtype": {
"type": "KeyUsage"
}
}
}
}
},
"GPUPipelineError": {
// Web IDL optional argument can be followed by a required argument, but not in TS
// TODO: Maybe do this in the emitter?
Expand Down
9 changes: 9 additions & 0 deletions inputfiles/patches/crypto.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@ dictionary CryptoKeyPair {
member privateKey required=#true
member publicKey required=#true
}

interface CryptoKey {
property algorithm type=KeyAlgorithm
property usages {
type sequence {
type KeyUsage
}
}
}
12 changes: 11 additions & 1 deletion src/build/patches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,22 @@ function handleEvent(child: Node): Event {
* @param child The child node to handle.
*/
function handleProperty(child: Node): Partial<Property> {
let typeNode: Node | undefined;
for (const c of child.children) {
if (c.name === "type") {
typeNode = c;
break;
}
}

return {
name: string(child.values[0]),
...optionalMember("exposed", "string", child.properties?.exposed),
...optionalMember("optional", "boolean", child.properties?.optional),
...optionalMember("overrideType", "string", child.properties?.overrideType),
...optionalMember("type", "string", child.properties?.type),
...(typeNode
? handleTyped(typeNode)
: optionalMember("type", "string", child.properties?.type)),
...optionalMember("readonly", "boolean", child.properties?.readonly),
...optionalMember("deprecated", "boolean", child.properties?.deprecated),
};
Expand Down