From 06594d171ab9ff708ce25baf6191bd799d8debdd Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Tue, 30 Jul 2019 07:42:09 +0200 Subject: [PATCH] Inline logDataRead and logComputationRead --- src/S.ts | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/S.ts b/src/S.ts index c131107..4d74fb5 100644 --- a/src/S.ts +++ b/src/S.ts @@ -248,7 +248,7 @@ class DataNode { current() { if (Listener !== null) { - logDataRead(this); + logRead(this); } return this.value; } @@ -301,7 +301,7 @@ class ComputationNode { if (this.state === RUNNING) throw new Error("circular dependency"); else updateNode(this); // checks for state === STALE internally, so don't need to check here } - logComputationRead(this); + logRead(this); } return this.value; @@ -456,8 +456,11 @@ function recycleOrClaimNode(node : ComputationNode, fn : (v : T | undefined) return recycle; } -function logRead(from : Log) { - var to = Listener!, +function logRead(data : DataNode | ComputationNode) { + if (data.log === null) data.log = new Log(); + + var from = data.log, + to = Listener!, fromslot : number, toslot = to.source1 === null ? -1 : to.sources === null ? 0 : to.sources.length; @@ -487,16 +490,6 @@ function logRead(from : Log) { } } -function logDataRead(data : DataNode) { - if (data.log === null) data.log = new Log(); - logRead(data.log); -} - -function logComputationRead(node : ComputationNode) { - if (node.log === null) node.log = new Log(); - logRead(node.log); -} - function event() { // b/c we might be under a top level S.root(), have to preserve current root var owner = Owner;