From 40fa23c712b931071ca16453fbf02f8e7799cac9 Mon Sep 17 00:00:00 2001 From: Francois Daoust Date: Fri, 14 Apr 2023 15:01:16 +0200 Subject: [PATCH] Drop check on exposure for members See https://github.com/w3c/strudy/pull/347#discussion_r1166448789 for context Update also improves readability of `selfCheck` and fixes check on mixins' length. --- src/lib/study-webidl.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/lib/study-webidl.js b/src/lib/study-webidl.js index d56247ce..d18bd84c 100644 --- a/src/lib/study-webidl.js +++ b/src/lib/study-webidl.js @@ -31,7 +31,6 @@ const WebIDL2 = require("webidl2"); const getSpecs = list => [...new Set(list.map(({spec}) => spec))]; const specName = spec => spec.shortname ?? spec.url; const dfnName = dfn => `${dfn.idl.partial ? 'partial ' : ''}${dfn.idl.type} "${dfn.idl.name}"`; -const getExtAttr = (node, name) => node.extAttrs && node.extAttrs.find((attr) => attr.name === name); const possibleAnomalies = [ "incompatiblePartialIdlExposure", @@ -345,8 +344,8 @@ async function studyWebIdl(edResults, curatedResults) { } function checkMembers(target, source) { - const selfCheck = !source; source = source ?? target; + const selfCheck = source === target; const knownDuplicates = []; if (!target.idl.members || !source.idl.members) { return; @@ -397,13 +396,6 @@ async function studyWebIdl(edResults, curatedResults) { break; } - // Non-overlapping exposure sets are OK. Assume it's OK if either - // member has an [Exposed] extended attribute. - // TODO: check and compare actual Exposed values - if (getExtAttr(targetMember, 'Exposed') || getExtAttr(sourceMember, 'Exposed')) { - continue; - } - // A static operation that has the same identifier as a regular one is OK if (isAllowedOperationWithSameIdentifier(targetMember, sourceMember)) { continue; @@ -661,7 +653,7 @@ async function studyWebIdl(edResults, curatedResults) { Object.keys(includesStatements) .filter(key => key.startsWith(`${name} includes `)) .map(key => dfns[includesStatements[key].idl.includes]?.filter(({idl}) => idl.type === 'interface mixin')) - .filter(mixins => !!mixins && mixins.length > 0) + .filter(mixins => mixins?.length > 0) .flat(); // Compare members of partials, mixins and main dfn separately to be able // to report more fine-grained anomalies