Comparing version 9.1.0 to 9.1.1
@@ -77,4 +77,3 @@ "use strict"; | ||
this.requires = new utils.RequiresMap(ctx); | ||
this.implemented = []; | ||
this.included = []; | ||
this.mixins = []; | ||
@@ -391,20 +390,8 @@ this.operations = new Map(); | ||
} | ||
throw new Error(`${source} interface not found (implemented by ${this.name})`); | ||
throw new Error(`${source} interface not found (used as a mixin for ${this.name})`); | ||
} | ||
this.implemented.push(source); | ||
this.mixins.push(source); | ||
} | ||
includes(source) { | ||
const mixin = this.ctx.interfaceMixins.get(source); | ||
if (!mixin) { | ||
if (this.ctx.options.suppressErrors) { | ||
return; | ||
} | ||
throw new Error(`${source} interface mixin not found (included in ${this.name})`); | ||
} | ||
this.included.push(source); | ||
} | ||
generateIterator() { | ||
@@ -457,8 +444,8 @@ if (this.iterable && this.iterable.isPair) { | ||
* consequentialInterfaces(seen = new Set([this.name]), root = this.name) { | ||
for (const iface of this.implemented) { | ||
if (seen.has(iface)) { | ||
for (const mixin of this.mixins) { | ||
if (seen.has(mixin)) { | ||
throw new Error(`${root} has a dependency cycle`); | ||
} | ||
seen.add(iface); | ||
yield* this.ctx.interfaces.get(iface).allInterfaces(seen); | ||
seen.add(mixin); | ||
yield* this.ctx.interfaces.get(mixin).allInterfaces(seen); | ||
} | ||
@@ -484,8 +471,5 @@ } | ||
yield* this.idl.members; | ||
for (const mixin of this.included) { | ||
yield* this.ctx.interfaceMixins.get(mixin).idl.members; | ||
for (const mixin of this.consequentialInterfaces(seen, root)) { | ||
yield* this.ctx.interfaces.get(mixin).idl.members; | ||
} | ||
for (const iface of this.consequentialInterfaces(seen, root)) { | ||
yield* this.ctx.interfaces.get(iface).idl.members; | ||
} | ||
} | ||
@@ -505,5 +489,2 @@ | ||
* allMembers(seen = new Set([this.name]), root = this.name) { | ||
for (const mixin of this.included) { | ||
yield* this.ctx.interfaceMixins.get(mixin).idl.members; | ||
} | ||
for (const iface of this.allInterfaces(seen, root)) { | ||
@@ -521,4 +502,4 @@ yield* this.ctx.interfaces.get(iface).idl.members; | ||
for (const iface of this.consequentialInterfaces()) { | ||
this.requires.add(iface); | ||
for (const mixin of this.consequentialInterfaces()) { | ||
this.requires.add(mixin); | ||
} | ||
@@ -534,5 +515,5 @@ | ||
generateMixins() { | ||
for (const iface of this.consequentialInterfaces()) { | ||
for (const mixin of this.consequentialInterfaces()) { | ||
this.str += ` | ||
${iface}._mixedIntoPredicates.push(module.exports.is); | ||
${mixin}._mixedIntoPredicates.push(module.exports.is); | ||
`; | ||
@@ -539,0 +520,0 @@ } |
@@ -23,3 +23,2 @@ "use strict"; | ||
this.interfaces = new Map(); | ||
this.interfaceMixins = new Map(); | ||
this.dictionaries = new Map(); | ||
@@ -26,0 +25,0 @@ this.enumerations = new Map(); |
@@ -13,3 +13,2 @@ "use strict"; | ||
const Interface = require("./constructs/interface"); | ||
const InterfaceMixin = require("./constructs/interface-mixin"); | ||
const Dictionary = require("./constructs/dictionary"); | ||
@@ -85,3 +84,3 @@ const Enumeration = require("./constructs/enumeration"); | ||
this.ctx.initialize(); | ||
const { interfaces, interfaceMixins, dictionaries, enumerations, typedefs } = this.ctx; | ||
const { interfaces, dictionaries, enumerations, typedefs } = this.ctx; | ||
@@ -103,12 +102,3 @@ // first we're gathering all full interfaces and ignore partial ones | ||
break; | ||
case "interface mixin": | ||
if (instruction.partial) { | ||
break; | ||
} | ||
obj = new InterfaceMixin(this.ctx, instruction); | ||
interfaceMixins.set(obj.name, obj); | ||
break; | ||
case "implements": | ||
case "includes": | ||
break; // handled later | ||
@@ -139,3 +129,3 @@ case "dictionary": | ||
// second we add all partial members and handle implements/includes | ||
// second we add all partial members and handle implements | ||
for (const file of parsed) { | ||
@@ -159,15 +149,2 @@ for (const instruction of file.idl) { | ||
break; | ||
case "interface mixin": | ||
if (!instruction.partial) { | ||
break; | ||
} | ||
if (this.ctx.options.suppressErrors && !interfaceMixins.has(instruction.name)) { | ||
break; | ||
} | ||
oldMembers = interfaceMixins.get(instruction.name).idl.members; | ||
oldMembers.push(...instruction.members); | ||
extAttrs = interfaceMixins.get(instruction.name).idl.extAttrs; | ||
extAttrs.push(...instruction.extAttrs); | ||
break; | ||
case "dictionary": | ||
@@ -191,8 +168,2 @@ if (!instruction.partial) { | ||
break; | ||
case "includes": | ||
if (this.ctx.options.suppressErrors && !interfaces.has(instruction.target)) { | ||
break; | ||
} | ||
interfaces.get(instruction.target).includes(instruction.includes); | ||
break; | ||
} | ||
@@ -199,0 +170,0 @@ } |
{ | ||
"name": "webidl2js", | ||
"version": "9.1.0", | ||
"version": "9.1.1", | ||
"description": "Auto-generates class structures for WebIDL specifications", | ||
@@ -12,3 +12,3 @@ "main": "lib/transformer.js", | ||
"webidl-conversions": "^4.0.0", | ||
"webidl2": "^10.3.1" | ||
"webidl2": "^9.0.0" | ||
}, | ||
@@ -15,0 +15,0 @@ "devDependencies": { |
@@ -342,5 +342,4 @@ # JavaScript bindings generator for Web IDL | ||
- Partial interfaces and dictionaries | ||
- Interface mixins | ||
- Basic types (via [webidl-conversions][]) | ||
- Old-style mixins, i.e. `implements` | ||
- Mixins, i.e. `implements` | ||
- Overload resolution (although [tricky cases are not easy on the implementation class](#overloaded-operations)) | ||
@@ -347,0 +346,0 @@ - Variadic arguments |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
138845
19
3336
402
+ Addedwebidl2@9.0.0(transitive)
- Removedwebidl2@10.3.3(transitive)
Updatedwebidl2@^9.0.0