Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 47x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 6x 6x 6x | /** @import { Expression, PropertyDefinition } from 'estree' */ /** @import { Context } from '../types.js' */ import * as b from '../../../../utils/builders.js'; import { get_rune } from '../../../scope.js'; /** * @param {PropertyDefinition} node * @param {Context} context */ export function PropertyDefinition(node, context) { if (context.state.analysis.runes && node.value != null && node.value.type === 'CallExpression') { const rune = get_rune(node.value, context.state.scope); if (rune === '$state' || rune === '$state.frozen' || rune === '$derived') { return { ...node, value: node.value.arguments.length === 0 ? null : /** @type {Expression} */ (context.visit(node.value.arguments[0])) }; } if (rune === '$derived.by') { return { ...node, value: node.value.arguments.length === 0 ? null : b.call(/** @type {Expression} */ (context.visit(node.value.arguments[0]))) }; } } context.next(); } |