diff --git a/packages/marshal/src/marshal.js b/packages/marshal/src/marshal.js index b9f7e03ddad..69feb82380f 100644 --- a/packages/marshal/src/marshal.js +++ b/packages/marshal/src/marshal.js @@ -274,6 +274,13 @@ function isPassByCopyRecord(val) { ); } + if (descKeys.length === 1) { + if (ignorePassStyle(descKeys[0])) { + // the only key is the Data() marker, therefore this is pass-by-data + return true; + } + } + for (const descKey of descKeys) { // we tolerate and ignore a non-enumerable PASS_STYLE symbol-named key, the Data marker if (ignorePassStyle(descKey)) { diff --git a/packages/marshal/test/test-marshal.js b/packages/marshal/test/test-marshal.js index 0fdd22149d5..4e6aa5cd614 100644 --- a/packages/marshal/test/test-marshal.js +++ b/packages/marshal/test/test-marshal.js @@ -429,7 +429,7 @@ test('records', t => { }), slots: ['slot'], }; - // const emptyData = { body: JSON.stringify({}), slots: [] }; + const emptyData = { body: JSON.stringify({}), slots: [] }; // For objects with Symbol-named properties const symEnumData = Symbol.for('symEnumData'); @@ -532,7 +532,7 @@ test('records', t => { // interim1: pass-by-copy without warning // interim2: pass-by-copy without warning // final: not applicable, Data() removed - // t.deepEqual(build('data'), emptyData); // interim 1+2 + t.deepEqual(ser(build('data')), emptyData); // interim 1+2 // Far('iface', {}) // all cases: pass-by-ref