Skip to content

Commit

Permalink
fix: tolerate symbols as property names (#2094)
Browse files Browse the repository at this point in the history
  • Loading branch information
erights authored Dec 17, 2020
1 parent 83c6c33 commit 15022fe
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/SwingSet/src/kernel/deviceSlots.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ export function makeDeviceSlots(
function PresenceHandler(importSlot) {
return {
get(target, prop) {
lsdebug(`PreH proxy.get(${prop})`);
if (prop !== `${prop}`) {
lsdebug(`PreH proxy.get(${String(prop)})`);
if (typeof prop !== 'string' && typeof prop !== 'symbol') {
return undefined;
}
const p = (...args) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/kernel/kdebug.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function legibilizeValue(val, slots) {
if (result.length !== 1) {
result += ', ';
}
result += `${prop}: ${legibilizeValue(val[prop], slots)}`;
result += `${String(prop)}: ${legibilizeValue(val[prop], slots)}`;
}
result += '}';
return result;
Expand Down
6 changes: 4 additions & 2 deletions packages/SwingSet/src/kernel/liveSlots.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ function build(syscall, forVatID, cacheSize, vatPowers, vatParameters) {
const p = makeImportedPromise(resultVPID);

lsdebug(
`ls.qm send(${JSON.stringify(targetSlot)}, ${prop}) -> ${resultVPID}`,
`ls.qm send(${JSON.stringify(targetSlot)}, ${String(
prop,
)}) -> ${resultVPID}`,
);
syscall.send(targetSlot, prop, serArgs, resultVPID);

Expand Down Expand Up @@ -342,7 +344,7 @@ function build(syscall, forVatID, cacheSize, vatPowers, vatParameters) {
function DeviceHandler(slot) {
return {
get(target, prop) {
if (prop !== `${prop}`) {
if (typeof prop !== 'string' && typeof prop !== 'symbol') {
return undefined;
}
return (...args) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/kernel/virtualObjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ export function makeVirtualObjectManager(
try {
rawData[prop] = m.serialize(initialData[prop]);
} catch (e) {
console.error(`state property ${prop} is not serializable`);
console.error(`state property ${String(prop)} is not serializable`);
throw e;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/swingset-runner/src/slogulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export function main() {
if (result.length !== 1) {
result += ', ';
}
result += `${prop}: ${legibilizeValue(val[prop], slots)}`;
result += `${String(prop)}: ${legibilizeValue(val[prop], slots)}`;
}
result += '}';
}
Expand Down

0 comments on commit 15022fe

Please sign in to comment.