fix: retire deprecated sending only
MODIFY
packages/marshal/src/marshal-justin.js
packages/marshal/src/marshal-justin.js
@@ -341,7 +341,8 @@ const decodeToJustin = (encoding, shouldIndent = false) => {
assert(match !== null);
const suffix = match[1];
assert(Symbol[suffix] === sym);
- return out.next(`Symbol[${quote(suffix)}]`);
+ assert(identPattern.test(suffix));
+ return out.next(`Symbol.${suffix}`);
}
return out.next(`Symbol.for(${quote(registeredName)})`);
}

MODIFY
packages/marshal/src/marshal.js
packages/marshal/src/marshal.js
@@ -212,15 +212,6 @@ export const makeMarshal = (
case 'symbol': {
assertPassableSymbol(val);
const name = /** @type {string} */ (nameForPassableSymbol(val));
- if (name === '@@asyncIterator') {
- // Deprectated qclass. TODO make conditional
- // on environment variable. Eventually remove, but only after
- // confident that all supported receivers understand
- // `[QCLASS]: 'symbol'`.
- return harden({
- [QCLASS]: '@@asyncIterator',
- });
- }
return harden({
[QCLASS]: 'symbol',
name,

MODIFY
packages/marshal/src/types.js
packages/marshal/src/types.js
@@ -140,6 +140,8 @@ export {};
* payload: Encoding
* }
* } EncodingUnion
+ * Note that the '@@asyncIterator' encoding is deprecated. Use 'symbol' instead.
+ *
* @typedef {{ [index: string]: Encoding,
* '@qclass'?: undefined
* }} EncodingRecord

MODIFY
packages/marshal/test/test-marshal-justin.js
packages/marshal/test/test-marshal-justin.js
@@ -32,9 +32,8 @@ export const jsonPairs = harden([
['{"@qclass":"-Infinity"}', '-Infinity'],
['{"@qclass":"bigint","digits":"4"}', '4n'],
['{"@qclass":"bigint","digits":"9007199254740993"}', '9007199254740993n'],
- ['{"@qclass":"@@asyncIterator"}', 'Symbol.asyncIterator'],
- // ['{"@qclass":"symbol","name":"@@asyncIterator"}', 'Symbol.asyncIterator'],
- ['{"@qclass":"symbol","name":"@@match"}', 'Symbol["match"]'],
+ ['{"@qclass":"symbol","name":"@@asyncIterator"}', 'Symbol.asyncIterator'],
+ ['{"@qclass":"symbol","name":"@@match"}', 'Symbol.match'],
['{"@qclass":"symbol","name":"foo"}', 'Symbol.for("foo")'],
['{"@qclass":"symbol","name":"@@@@foo"}', 'Symbol.for("@@foo")'],

MODIFY
packages/marshal/test/test-marshal.js
packages/marshal/test/test-marshal.js
@@ -46,9 +46,8 @@ export const roundTripPairs = harden([
// Does not fit into a number
[9007199254740993n, { '@qclass': 'bigint', digits: '9007199254740993' }],
- // Well known symbols, deprecated encoding
- [Symbol.asyncIterator, { '@qclass': '@@asyncIterator' }],
// Well known symbols
+ [Symbol.asyncIterator, { '@qclass': 'symbol', name: '@@asyncIterator' }],
[Symbol.match, { '@qclass': 'symbol', name: '@@match' }],
// Registered symbols
[Symbol.for('foo'), { '@qclass': 'symbol', name: 'foo' }],

fix: retire deprecated sending only (#1187)