pull/10582/head
Rich Harris 2 years ago
parent d95b6e7e5c
commit de366a8f3a

@ -24,66 +24,30 @@ import { default_equals, safe_equal } from './equality.js';
* @param {import('../types.js').SignalFlags} flags * @param {import('../types.js').SignalFlags} flags
* @param {V} value * @param {V} value
* @param {import('../types.js').Block | null} block * @param {import('../types.js').Block | null} block
* @returns {import('../types.js').ComputationSignal<V> | import('../types.js').ComputationSignal<V> & import('../types.js').SourceSignalDebug}
*/ */
function create_computation_signal(flags, value, block) { function create_computation_signal(flags, value, block) {
if (DEV) { /** @type {import('../types.js').ComputationSignal<V>} */
return { const signal = {
// block
b: block,
// consumers
c: null,
// destroy
d: null,
// equals
e: null,
// flags
f: flags,
// init
i: null,
// level
l: 0,
// references
r: null,
// value
v: value,
// write version
w: 0,
// context: We can remove this if we get rid of beforeUpdate/afterUpdate
x: null,
// destroy
y: null,
// this is for DEV only
inspect: new Set()
};
}
return {
// block
b: block, b: block,
// consumers
c: null, c: null,
// destroy
d: null, d: null,
// equals
e: null, e: null,
// flags
f: flags, f: flags,
// level
l: 0, l: 0,
// init
i: null, i: null,
// references
r: null, r: null,
// value
v: value, v: value,
// write version
w: 0, w: 0,
// context: We can remove this if we get rid of beforeUpdate/afterUpdate
x: null, x: null,
// destroy
y: null y: null
}; };
if (DEV) {
// @ts-expect-error
signal.inspect = new Set();
}
return signal;
} }
/** /**

Loading…
Cancel
Save