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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 86x 81x 15x 15x 15x 15x 15x 15x 15x 81x 66x 66x 66x 66x 66x 66x 66x 66x 66x 66x 66x 47x 47x 23x 23x 66x 19x 19x 19x 19x 19x 66x 81x 5x 5x 86x 2x 2x 2x 2x 2x 2x 2x 5x 5x 5x 5x 5x 5x 5x 5x | /** @import { ExportSpecifier, Node } from 'estree' */ /** @import { Binding } from '#compiler' */ /** @import { Context } from '../types' */ /** @import { Scope } from '../../scope' */ import * as e from '../../../errors.js'; /** * @param {ExportSpecifier} node * @param {Context} context */ export function ExportSpecifier(node, context) { if (context.state.ast_type === 'instance') { if (context.state.analysis.runes) { context.state.analysis.exports.push({ name: node.local.name, alias: node.exported.name }); const binding = context.state.scope.get(node.local.name); if (binding) binding.reassigned = true; } else { context.state.analysis.needs_props = true; const binding = /** @type {Binding} */ (context.state.scope.get(node.local.name)); if ( binding !== null && (binding.kind === 'state' || binding.kind === 'frozen_state' || (binding.kind === 'normal' && (binding.declaration_kind === 'let' || binding.declaration_kind === 'var'))) ) { binding.kind = 'bindable_prop'; if (node.exported.name !== node.local.name) { binding.prop_alias = node.exported.name; } } else { context.state.analysis.exports.push({ name: node.local.name, alias: node.exported.name }); } } } else { validate_export(node, context.state.scope, node.local.name); } } /** * * @param {Node} node * @param {Scope} scope * @param {string} name */ function validate_export(node, scope, name) { const binding = scope.get(name); if (!binding) return; if (binding.kind === 'derived') { e.derived_invalid_export(node); } if ((binding.kind === 'state' || binding.kind === 'frozen_state') && binding.reassigned) { e.state_invalid_export(node); } } |