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

Function check_rune_binding

packages/svelte/src/compiler/migrate/index.js:277–284  ·  view source on GitHub ↗

* @param {"derived"|"props"|"bindable"} rune

(rune)

Source from the content-addressed store, hash-verified

275 * @param {"derived"|"props"|"bindable"} rune
276 */
277 function check_rune_binding(rune) {
278 const has_rune_binding = !!state.scope.get(rune);
279 if (has_rune_binding) {
280 throw new MigrationError(
281 `migrating this component would require adding a \`$${rune}\` rune but there's already a variable named ${rune}.\n Rename the variable and try again or migrate by hand.`
282 );
283 }
284 }
285
286 if (state.props.length > 0 || analysis.uses_rest_props || analysis.uses_props) {
287 const has_many_props = state.props.length > 3;

Callers 3

migrateFunction · 0.85
VariableDeclarationFunction · 0.85
LabeledStatementFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected