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

Function VariableDeclaration

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

Source from the content-addressed store, hash-verified

1194 },
1195
1196 VariableDeclaration(node, { state, path, next }) {
1197 const is_parent_const_tag = path.at(-1)?.type === 'ConstTag';
1198 for (const declarator of node.declarations) {
1199 /** @type {Binding[]} */
1200 const bindings = [];
1201
1202 state.scope.declarators.set(declarator, bindings);
1203
1204 for (const id of extract_identifiers(declarator.id)) {
1205 const binding = state.scope.declare(
1206 id,
1207 is_parent_const_tag ? 'template' : 'normal',
1208 node.kind,
1209 declarator.init
1210 );
1211 binding.metadata = { is_template_declaration: true };
1212 bindings.push(binding);
1213 }
1214 }
1215
1216 next();
1217 },
1218
1219 CatchClause(node, { state, next }) {
1220 if (node.param) {

Callers

nothing calls this directly

Calls 5

extract_identifiersFunction · 0.90
declareMethod · 0.80
pushMethod · 0.80
setMethod · 0.65
nextFunction · 0.50

Tested by

no test coverage detected