move util into utils file

proxied-state-each-blocks
Rich Harris 9 months ago committed by Dominic Gannaway
parent 0e1cdd9e52
commit 358c93853f

@ -378,3 +378,17 @@ export function create_state_declarators(declarator, scope, value) {
})
];
}
/** @param {import('estree').Expression} node */
export function should_proxy(node) {
if (
!node ||
node.type === 'Literal' ||
node.type === 'ArrowFunctionExpression' ||
node.type === 'FunctionExpression'
) {
return false;
}
return true;
}

@ -2,22 +2,9 @@ import { get_rune } from '../../../scope.js';
import { is_hoistable_function } from '../../utils.js';
import * as b from '../../../../utils/builders.js';
import * as assert from '../../../../utils/assert.js';
import { create_state_declarators, get_props_method } from '../utils.js';
import { create_state_declarators, get_props_method, should_proxy } from '../utils.js';
import { unwrap_ts_expression } from '../../../../utils/ast.js';
/** @param {import('estree').Expression} node */
function should_proxy(node) {
if (
node.type === 'Literal' ||
node.type === 'ArrowFunctionExpression' ||
node.type === 'FunctionExpression'
) {
return false;
}
return true;
}
/** @type {import('../types.js').ComponentVisitors} */
export const javascript_visitors_runes = {
ClassBody(node, { state, visit }) {

Loading…
Cancel
Save