@@ -413,7 +413,7 @@ class Interface {
413413 value: function next() {
414414 const internal = this[utils.iterInternalSymbol];
415415 const { target, kind, index } = internal;
416- const values = Array.from(target[impl ]);
416+ const values = Array.from(target[implSymbol ]);
417417 const len = values.length;
418418 if (index >= len) {
419419 return { value: undefined, done: true };
@@ -492,8 +492,7 @@ class Interface {
492492 }
493493
494494 generateRequires ( ) {
495- this . requires . addRaw ( "impl" , "utils.implSymbol" ) ;
496- this . requires . addRaw ( "ctorRegistry" , "utils.ctorRegistrySymbol" ) ;
495+ this . requires . addRaw ( `{ implSymbol, ctorRegistrySymbol }` , "utils" ) ;
497496
498497 if ( this . idl . inheritance !== null ) {
499498 this . requires . add ( this . idl . inheritance ) ;
@@ -509,7 +508,7 @@ class Interface {
509508 generateExport ( ) {
510509 this . str += `
511510 exports.is = function is(obj) {
512- return utils.isObject(obj) && utils.hasOwn(obj, impl) && obj[impl ] instanceof Impl.implementation;
511+ return utils.isObject(obj) && utils.hasOwn(obj, impl) && obj[implSymbol ] instanceof Impl.implementation;
513512 };
514513 exports.isImpl = function isImpl(obj) {
515514 return utils.isObject(obj) && obj instanceof Impl.implementation;
@@ -549,10 +548,10 @@ class Interface {
549548 }
550549 if ( unsupportedValue ) {
551550 const func = this . indexedGetter . name ? `.${ this . indexedGetter . name } ` : "[utils.indexedGet]" ;
552- const value = indexedValue || `${ O } [impl ]${ func } (${ index } )` ;
551+ const value = indexedValue || `${ O } [implSymbol ]${ func } (${ index } )` ;
553552 return `${ value } !== ${ unsupportedValue } ` ;
554553 }
555- return `${ O } [impl ][utils.supportsPropertyIndex](${ index } )` ;
554+ return `${ O } [implSymbol ][utils.supportsPropertyIndex](${ index } )` ;
556555 } ;
557556
558557 const supportsPropertyName = ( O , P , namedValue ) => {
@@ -562,10 +561,10 @@ class Interface {
562561 }
563562 if ( unsupportedValue ) {
564563 const func = this . namedGetter . name ? `.${ this . namedGetter . name } ` : "[utils.namedGet]" ;
565- const value = namedValue || `${ O } [impl ]${ func } (${ P } )` ;
564+ const value = namedValue || `${ O } [implSymbol ]${ func } (${ P } )` ;
566565 return `${ value } !== ${ unsupportedValue } ` ;
567566 }
568- return `${ O } [impl ][utils.supportsPropertyName](${ P } )` ;
567+ return `${ O } [implSymbol ][utils.supportsPropertyName](${ P } )` ;
569568 } ;
570569
571570 // "named property visibility algorithm"
@@ -603,14 +602,14 @@ class Interface {
603602 invocation = `
604603 const creating = !(${ supportsPropertyIndex ( O , "index" ) } );
605604 if (creating) {
606- ${ O } [impl ][utils.indexedSetNew](index, indexedValue);
605+ ${ O } [implSymbol ][utils.indexedSetNew](index, indexedValue);
607606 } else {
608- ${ O } [impl ][utils.indexedSetExisting](index, indexedValue);
607+ ${ O } [implSymbol ][utils.indexedSetExisting](index, indexedValue);
609608 }
610609 ` ;
611610 } else {
612611 invocation = `
613- ${ O } [impl ].${ this . indexedSetter . name } (index, indexedValue);
612+ ${ O } [implSymbol ].${ this . indexedSetter . name } (index, indexedValue);
614613 ` ;
615614 }
616615
@@ -641,14 +640,14 @@ class Interface {
641640 invocation = `
642641 const creating = !(${ supportsPropertyName ( O , P ) } );
643642 if (creating) {
644- ${ O } [impl ][utils.namedSetNew](${ P } , namedValue);
643+ ${ O } [implSymbol ][utils.namedSetNew](${ P } , namedValue);
645644 } else {
646- ${ O } [impl ][utils.namedSetExisting](${ P } , namedValue);
645+ ${ O } [implSymbol ][utils.namedSetExisting](${ P } , namedValue);
647646 }
648647 ` ;
649648 } else {
650649 invocation = `
651- ${ O } [impl ].${ this . namedSetter . name } (${ P } , namedValue);
650+ ${ O } [implSymbol ].${ this . namedSetter . name } (${ P } , namedValue);
652651 ` ;
653652 }
654653
@@ -729,14 +728,14 @@ class Interface {
729728 ` ;
730729 if ( this . supportsIndexedProperties ) {
731730 this . str += `
732- for (const key of target[impl ][utils.supportedPropertyIndices]) {
731+ for (const key of target[implSymbol ][utils.supportedPropertyIndices]) {
733732 keys.add(\`\${key}\`);
734733 }
735734 ` ;
736735 }
737736 if ( this . supportsNamedProperties ) {
738737 this . str += `
739- for (const key of target[impl ][utils.supportedPropertyNames]) {
738+ for (const key of target[implSymbol ][utils.supportedPropertyNames]) {
740739 if (${ namedPropertyVisible ( "key" , "target" , true ) } ) {
741740 keys.add(\`\${key}\`);
742741 }
@@ -769,10 +768,10 @@ class Interface {
769768 let preamble = "" ;
770769 let condition ;
771770 if ( utils . getExtAttr ( this . indexedGetter . extAttrs , "WebIDL2JSValueAsUnsupported" ) ) {
772- this . str += `const indexedValue = target[impl ]${ func } (index);` ;
771+ this . str += `const indexedValue = target[implSymbol ]${ func } (index);` ;
773772 condition = supportsPropertyIndex ( "target" , "index" , "indexedValue" ) ;
774773 } else {
775- preamble = `const indexedValue = target[impl ]${ func } (index);` ;
774+ preamble = `const indexedValue = target[implSymbol ]${ func } (index);` ;
776775 condition = supportsPropertyIndex ( "target" , "index" ) ;
777776 }
778777
@@ -797,13 +796,13 @@ class Interface {
797796 const conditions = [ ] ;
798797 if ( utils . getExtAttr ( this . namedGetter . extAttrs , "WebIDL2JSValueAsUnsupported" ) ) {
799798 this . str += `
800- const namedValue = target[impl ]${ func } (P);
799+ const namedValue = target[implSymbol ]${ func } (P);
801800 ` ;
802801 conditions . push ( supportsPropertyName ( "target" , "index" , "namedValue" ) ) ;
803802 conditions . push ( namedPropertyVisible ( "P" , "target" , true ) ) ;
804803 } else {
805804 preamble = `
806- const namedValue = target[impl ]${ func } (P);
805+ const namedValue = target[implSymbol ]${ func } (P);
807806 ` ;
808807 conditions . push ( namedPropertyVisible ( "P" , "target" , false ) ) ;
809808 }
@@ -885,10 +884,10 @@ class Interface {
885884 let preamble = "" ;
886885 let condition ;
887886 if ( utils . getExtAttr ( this . indexedGetter . extAttrs , "WebIDL2JSValueAsUnsupported" ) ) {
888- this . str += `const indexedValue = target[impl ]${ func } (index);` ;
887+ this . str += `const indexedValue = target[implSymbol ]${ func } (index);` ;
889888 condition = supportsPropertyIndex ( "target" , "index" , "indexedValue" ) ;
890889 } else {
891- preamble = `const indexedValue = target[impl ]${ func } (index);` ;
890+ preamble = `const indexedValue = target[implSymbol ]${ func } (index);` ;
892891 condition = supportsPropertyIndex ( "target" , "index" ) ;
893892 }
894893
@@ -1070,11 +1069,11 @@ class Interface {
10701069
10711070 if ( this . namedDeleter . idlType . idlType === "bool" ) {
10721071 invocation = `
1073- return target[impl ]${ func } (P);
1072+ return target[implSymbol ]${ func } (P);
10741073 ` ;
10751074 } else {
10761075 invocation = `
1077- target[impl ]${ func } (P);
1076+ target[implSymbol ]${ func } (P);
10781077 return true;
10791078 ` ;
10801079 }
@@ -1111,11 +1110,11 @@ class Interface {
11111110 generateIface ( ) {
11121111 this . str += `
11131112 exports.create = function create(globalObject, constructorArgs, privateData) {
1114- if (globalObject[ctorRegistry ] === undefined) {
1113+ if (globalObject[ctorRegistrySymbol ] === undefined) {
11151114 throw new Error('Internal error: invalid global object');
11161115 }
11171116
1118- const ctor = globalObject[ctorRegistry ]["${ this . name } "];
1117+ const ctor = globalObject[ctorRegistrySymbol ]["${ this . name } "];
11191118 if (ctor === undefined) {
11201119 throw new Error('Internal error: constructor ${ this . name } is not installed on the passed global object');
11211120 }
@@ -1171,9 +1170,9 @@ class Interface {
11711170 }
11721171
11731172 this . str += `
1174- obj[impl ][utils.wrapperSymbol] = obj;
1173+ obj[implSymbol ][utils.wrapperSymbol] = obj;
11751174 if (Impl.init) {
1176- Impl.init(obj[impl ], privateData);
1175+ Impl.init(obj[implSymbol ], privateData);
11771176 }
11781177 return obj;
11791178 };
@@ -1467,10 +1466,10 @@ class Interface {
14671466 this . generateOffInstanceAfterClass ( ) ;
14681467
14691468 this . str += `
1470- if (globalObject[ctorRegistry ] === undefined) {
1471- globalObject[ctorRegistry ] = Object.create(null);
1469+ if (globalObject[ctorRegistrySymbol ] === undefined) {
1470+ globalObject[ctorRegistrySymbol ] = Object.create(null);
14721471 }
1473- globalObject[ctorRegistry ][interfaceName] = ${ name } ;
1472+ globalObject[ctorRegistrySymbol ][interfaceName] = ${ name } ;
14741473
14751474 Object.defineProperty(globalObject, interfaceName, {
14761475 configurable: true,
0 commit comments