Skip to content

Commit

Permalink
fix: missing Far on some iterables
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Jan 7, 2022
1 parent 1ad7b2e commit 7692d0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/store/src/keys/copyMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import {
assertChecker,
Far,
getTag,
makeTagged,
passStyleOf,
Expand Down Expand Up @@ -95,10 +96,10 @@ export const getCopyMapEntries = m => {
payload: { keys, values },
} = m;
const { length } = keys;
return harden({
return Far('CopyMap entries iterable', {
[Symbol.iterator]: () => {
let i = 0;
return harden({
return Far('CopyMap entries iterator', {
next: () => {
/** @type {IteratorResult<[K,V],void>} */
let result;
Expand Down
6 changes: 4 additions & 2 deletions packages/store/src/stores/store-utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// @ts-check

import { Far } from '@agoric/marshal';

const { details: X, quote: q } = assert;

/**
Expand Down Expand Up @@ -54,13 +56,13 @@ export const makeCurrentKeysKit = (
return sortedKeysMemo;
};

const iterableKeys = harden({
const iterableKeys = Far('Iterable of keys', {
[Symbol.iterator]: () => {
const generation = updateCount;
getSortedKeys();
const len = sortedKeysMemo.length;
let i = 0;
return harden({
return Far('Iterator of keys', {
next: () => {
assert.equal(
generation,
Expand Down

0 comments on commit 7692d0b

Please sign in to comment.