Tighten
This commit is contained in:
parent
f8e6fc4ab6
commit
3d4a6b9bb6
16
actor.ts
16
actor.ts
|
@ -84,7 +84,12 @@ export class Turn {
|
||||||
|
|
||||||
spawn(bootProc: (t: Turn) => void, initialAssertions = new IdentitySet<Handle>()): void {
|
spawn(bootProc: (t: Turn) => void, initialAssertions = new IdentitySet<Handle>()): void {
|
||||||
this.tasks.push(() => {
|
this.tasks.push(() => {
|
||||||
const child = new Actor(extractFromMap(this.actor.outbound, initialAssertions));
|
const newOutbound: OutboundMap = new Map();
|
||||||
|
initialAssertions.forEach(key => {
|
||||||
|
newOutbound.set(key, this.actor.outbound.get(key)!); // we trust initialAssertions
|
||||||
|
this.actor.outbound.delete(key);
|
||||||
|
});
|
||||||
|
const child = new Actor(newOutbound);
|
||||||
child.execute(() => Turn.for(child, bootProc));
|
child.execute(() => Turn.for(child, bootProc));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -137,12 +142,3 @@ export class Turn {
|
||||||
this.tasks.length && queueMicrotask(() => this.tasks.forEach(f => Turn.for(this.actor, f)));
|
this.tasks.length && queueMicrotask(() => this.tasks.forEach(f => Turn.for(this.actor, f)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractFromMap<K, V>(map: Map<K, V>, keys: IdentitySet<K>): Map<K, V> {
|
|
||||||
const result: Map<K, V> = new Map();
|
|
||||||
keys.forEach(key => {
|
|
||||||
if (map.has(key)) result.set(key, map.get(key)!);
|
|
||||||
map.delete(key);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue