reuse helper

pull/15820/head
Rich Harris 4 months ago
parent c7e8422ceb
commit 1a78e279d6

@ -4,6 +4,7 @@
import { get_rune } from '../../scope.js'; import { get_rune } from '../../scope.js';
import * as e from '../../../errors.js'; import * as e from '../../../errors.js';
import { is_state_creation_rune } from '../../../../utils.js'; import { is_state_creation_rune } from '../../../../utils.js';
import { get_name } from '../../nodes.js';
/** /**
* @param {ClassBody} node * @param {ClassBody} node
@ -32,12 +33,8 @@ export function ClassBody(node, context) {
* @param {Expression | null | undefined} value * @param {Expression | null | undefined} value
*/ */
function handle(node, key, value) { function handle(node, key, value) {
const name = const name = get_name(key);
(key.type === 'Literal' && String(key.value)) || if (name === null) return;
(key.type === 'PrivateIdentifier' && '#' + key.name) ||
(key.type === 'Identifier' && key.name);
if (!name) return;
const rune = get_rune(value, context.state.scope); const rune = get_rune(value, context.state.scope);

Loading…
Cancel
Save