MCPcopy
hub / github.com/livebud/bud / enter

Method enter

package/svelte/compiler.js:15483–15558  ·  view source on GitHub ↗
(node2, parent, key)

Source from the content-addressed store, hash-verified

15481 let function_expression;
15482 walk(info, {
15483 enter(node2, parent, key) {
15484 if (key === "key" && parent.shorthand)
15485 return;
15486 if (node2.type === "MetaProperty")
15487 return this.skip();
15488 if (map.has(node2)) {
15489 scope2 = map.get(node2);
15490 }
15491 if (!function_expression && /FunctionExpression/.test(node2.type)) {
15492 function_expression = node2;
15493 }
15494 if (is_reference(node2, parent)) {
15495 const { name, nodes } = flatten_reference(node2);
15496 references.add(name);
15497 if (scope2.has(name))
15498 return;
15499 if (name[0] === "$") {
15500 const store_name = name.slice(1);
15501 if (template_scope.names.has(store_name) || scope2.has(store_name)) {
15502 return component.error(node2, compiler_errors.contextual_store);
15503 }
15504 }
15505 if (template_scope.is_let(name)) {
15506 if (!function_expression) {
15507 contextual_dependencies.add(name);
15508 dependencies.add(name);
15509 }
15510 } else if (template_scope.names.has(name)) {
15511 expression2.uses_context = true;
15512 contextual_dependencies.add(name);
15513 const owner2 = template_scope.get_owner(name);
15514 const is_index = owner2.type === "EachBlock" && owner2.key && name === owner2.index;
15515 if (!lazy || is_index) {
15516 template_scope.dependencies_for_name.get(name).forEach((name2) => dependencies.add(name2));
15517 }
15518 } else {
15519 if (!lazy) {
15520 dependencies.add(name);
15521 }
15522 component.add_reference(node2, name);
15523 component.warn_if_undefined(name, nodes[0], template_scope);
15524 }
15525 this.skip();
15526 }
15527 let names2;
15528 let deep = false;
15529 if (function_expression) {
15530 if (node2.type === "AssignmentExpression") {
15531 deep = node2.left.type === "MemberExpression";
15532 names2 = extract_names(deep ? get_object(node2.left) : node2.left);
15533 } else if (node2.type === "UpdateExpression") {
15534 names2 = extract_names(get_object(node2.argument));
15535 }
15536 }
15537 if (names2) {
15538 names2.forEach((name) => {
15539 if (template_scope.names.has(name)) {
15540 if (template_scope.is_const(name)) {

Callers

nothing calls this directly

Calls 15

is_referenceFunction · 0.85
flatten_referenceFunction · 0.85
extract_namesFunction · 0.85
get_objectFunction · 0.85
cloneFunction · 0.85
is_contextualFunction · 0.85
is_used_as_referenceFunction · 0.85
bFunction · 0.85
extract_identifiersFunction · 0.85
hasMethod · 0.80
getMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected