Skip to content

Commit

Permalink
fix: review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Sep 13, 2022
1 parent cf7047d commit a4f6fe0
Show file tree
Hide file tree
Showing 7 changed files with 337 additions and 235 deletions.
12 changes: 7 additions & 5 deletions packages/captp/src/captp.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ export const makeCapTP = (
// TODO Temporary hack.
// See https://github.com/Agoric/agoric-sdk/issues/2780
errorIdNum: 20000,
// captp not yet compat with smallcaps
// TODO: fix captp and remove this flag.
useSmallcaps: false,
},
);

Expand Down Expand Up @@ -611,10 +614,11 @@ export const makeCapTP = (
assert.fail(X`Trap(${target}) target cannot be a promise`);

const slot = valToSlot.get(target);
(slot && slot[1] === '-') ||
if (!(slot && slot[1] === '-')) {
// TypeScript confused about `||` control flow so use `if` instead
// https://github.com/microsoft/TypeScript/issues/50739
assert.fail(X`Trap(${target}) target was not imported`);
// @ts-expect-error TS apparently confused about `||` control flow
// https://github.com/microsoft/TypeScript/issues/50739
}
slot[0] === 't' ||
assert.fail(
X`Trap(${target}) imported target was not created with makeTrapHandler`,
Expand Down Expand Up @@ -651,8 +655,6 @@ export const makeCapTP = (
// messages over the current CapTP data channel.
const [isException, serialized] = trapGuest({
trapMethod: implMethod,
// @ts-expect-error TS apparently confused about `||` control flow
// https://github.com/microsoft/TypeScript/issues/50739
slot,
trapArgs: implArgs,
startTrap: () => {
Expand Down
Loading

0 comments on commit a4f6fe0

Please sign in to comment.