( ctx: ScriptCompileContext, node: Node, declId?: LVal, )
| 5 | export const DEFINE_SLOTS = 'defineSlots' |
| 6 | |
| 7 | export function processDefineSlots( |
| 8 | ctx: ScriptCompileContext, |
| 9 | node: Node, |
| 10 | declId?: LVal, |
| 11 | ): boolean { |
| 12 | if (!isCallOf(node, DEFINE_SLOTS)) { |
| 13 | return false |
| 14 | } |
| 15 | if (ctx.hasDefineSlotsCall) { |
| 16 | ctx.error(`duplicate ${DEFINE_SLOTS}() call`, node) |
| 17 | } |
| 18 | ctx.hasDefineSlotsCall = true |
| 19 | |
| 20 | if (node.arguments.length > 0) { |
| 21 | ctx.error(`${DEFINE_SLOTS}() cannot accept arguments`, node) |
| 22 | } |
| 23 | |
| 24 | if (declId) { |
| 25 | ctx.s.overwrite( |
| 26 | ctx.startOffset! + node.start!, |
| 27 | ctx.startOffset! + node.end!, |
| 28 | `${ctx.helper('useSlots')}()`, |
| 29 | ) |
| 30 | } |
| 31 | |
| 32 | return true |
| 33 | } |
no test coverage detected