MCPcopy
hub / github.com/sveltejs/svelte / LabeledStatement

Function LabeledStatement

packages/svelte/src/compiler/phases/scope.js:1063–1083  ·  view source on GitHub ↗
(node, { path, next })

Source from the content-addressed store, hash-verified

1061 }
1062 },
1063 LabeledStatement(node, { path, next }) {
1064 if (path.length > 1 || !allow_reactive_declarations) return next();
1065 if (node.label.name !== '$') return next();
1066
1067 // create a scope for the $: block
1068 const scope = state.scope.child();
1069 scopes.set(node, scope);
1070
1071 if (
1072 node.body.type === 'ExpressionStatement' &&
1073 node.body.expression.type === 'AssignmentExpression'
1074 ) {
1075 for (const id of extract_identifiers(node.body.expression.left)) {
1076 if (!id.name.startsWith('$')) {
1077 possible_implicit_declarations.push(id);
1078 }
1079 }
1080 }
1081
1082 next({ scope });
1083 },
1084
1085 SvelteFragment,
1086 SlotElement: SvelteFragment,

Callers

nothing calls this directly

Calls 5

extract_identifiersFunction · 0.90
pushMethod · 0.80
setMethod · 0.65
nextFunction · 0.50
childMethod · 0.45

Tested by

no test coverage detected