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 {V} value
* @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) {
if (DEV) {
return {
// 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
/** @type {import('../types.js').ComputationSignal<V>} */
const signal = {
b: block,
// consumers
c: null,
// destroy
d: null,
// equals
e: null,
// flags
f: flags,
// level
l: 0,
// init
i: null,
// 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
};
if (DEV) {
// @ts-expect-error
signal.inspect = new Set();
}
return signal;
}
/**

Loading…
Cancel
Save