MCPcopy
hub / github.com/vuejs/core / processDefineSlots

Function processDefineSlots

packages/compiler-sfc/src/script/defineSlots.ts:7–33  ·  view source on GitHub ↗
(
  ctx: ScriptCompileContext,
  node: Node,
  declId?: LVal,
)

Source from the content-addressed store, hash-verified

5export const DEFINE_SLOTS = 'defineSlots'
6
7export 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}

Callers 1

compileScriptFunction · 0.90

Calls 3

isCallOfFunction · 0.90
errorMethod · 0.80
helperMethod · 0.65

Tested by

no test coverage detected