Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: retire deprecated "@@asyncIterator" sending only #1187

Merged
merged 1 commit into from
May 20, 2022
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
3 changes: 2 additions & 1 deletion packages/marshal/src/marshal-justin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)})`);
}
Expand Down
9 changes: 0 additions & 9 deletions packages/marshal/src/marshal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/marshal/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions packages/marshal/test/test-marshal-justin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")'],

Expand Down
3 changes: 1 addition & 2 deletions packages/marshal/test/test-marshal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' }],
Expand Down