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

Method manipulate

package/svelte/compiler.js:15579–15755  ·  view source on GitHub ↗
(block, ctx)

Source from the content-addressed store, hash-verified

15577 });
15578 }
15579 manipulate(block, ctx) {
15580 if (this.manipulated)
15581 return this.manipulated;
15582 const { component, declarations, scope_map: map, template_scope, owner } = this;
15583 let scope2 = this.scope;
15584 let function_expression;
15585 let dependencies;
15586 let contextual_dependencies;
15587 const node2 = walk(this.node, {
15588 enter(node3, parent) {
15589 if (node3.type === "Property" && node3.shorthand) {
15590 node3.value = clone(node3.value);
15591 node3.shorthand = false;
15592 }
15593 if (map.has(node3)) {
15594 scope2 = map.get(node3);
15595 }
15596 if (node3.type === "Identifier" && is_reference(node3, parent)) {
15597 const { name } = flatten_reference(node3);
15598 if (scope2.has(name))
15599 return;
15600 if (function_expression) {
15601 if (template_scope.names.has(name)) {
15602 contextual_dependencies.add(name);
15603 template_scope.dependencies_for_name.get(name).forEach((dependency) => {
15604 dependencies.add(dependency);
15605 });
15606 } else {
15607 dependencies.add(name);
15608 component.add_reference(node3, name);
15609 }
15610 } else if (is_contextual(component, template_scope, name)) {
15611 const reference = block.renderer.reference(node3, ctx);
15612 this.replace(reference);
15613 }
15614 this.skip();
15615 }
15616 if (!function_expression) {
15617 if (node3.type === "AssignmentExpression")
15618 ;
15619 if (node3.type === "FunctionExpression" || node3.type === "ArrowFunctionExpression") {
15620 function_expression = node3;
15621 dependencies = /* @__PURE__ */ new Set();
15622 contextual_dependencies = /* @__PURE__ */ new Set();
15623 }
15624 }
15625 },
15626 leave(node3, parent) {
15627 if (map.has(node3))
15628 scope2 = scope2.parent;
15629 if (node3 === function_expression) {
15630 const id2 = component.get_unique_name(sanitize(get_function_name(node3, owner)));
15631 const declaration = b`const ${id2} = ${node3}`;
15632 if (owner.type === "ConstTag") {
15633 let child_scope = scope2;
15634 walk(node3, {
15635 enter(node4, parent2) {
15636 if (map.has(node4))

Callers 15

get_valueMethod · 0.80
add_const_tagsFunction · 0.80
renderMethod · 0.80
get_snippetMethod · 0.80
add_actionFunction · 0.80
render_keyedMethod · 0.80
render_chunksMethod · 0.80
stringifyMethod · 0.80
constructorMethod · 0.80
rename_this_methodMethod · 0.80
get_render_statementMethod · 0.80

Calls 2

walkFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected