Home / Function/ get_function_label() — svelte Function Reference

get_function_label() — svelte Function Reference

Architecture documentation for the get_function_label() function in CallExpression.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  ca7db9cf_859c_1d3d_3d4c_6d342a890f75["get_function_label()"]
  3f0209c9_7af2_542f_1c9c_3be0eb046971["CallExpression.js"]
  ca7db9cf_859c_1d3d_3d4c_6d342a890f75 -->|defined in| 3f0209c9_7af2_542f_1c9c_3be0eb046971
  f847bd70_7e16_ed37_5fde_c34cd0ce1d43["CallExpression()"]
  f847bd70_7e16_ed37_5fde_c34cd0ce1d43 -->|calls| ca7db9cf_859c_1d3d_3d4c_6d342a890f75
  style ca7db9cf_859c_1d3d_3d4c_6d342a890f75 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js lines 279–302

function get_function_label(nodes) {
	const fn = /** @type {FunctionExpression | FunctionDeclaration | ArrowFunctionExpression} */ (
		nodes.at(-1)
	);

	if ((fn.type === 'FunctionDeclaration' || fn.type === 'FunctionExpression') && fn.id != null) {
		return fn.id.name;
	}

	const parent = nodes.at(-2);
	if (!parent) return;

	if (parent.type === 'CallExpression') {
		return source.slice(parent.callee.start, parent.callee.end) + '(...)';
	}

	if (parent.type === 'Property' && !parent.computed) {
		return /** @type {Identifier} */ (parent.key).name;
	}

	if (parent.type === 'VariableDeclarator' && parent.id.type === 'Identifier') {
		return parent.id.name;
	}
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does get_function_label() do?
get_function_label() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js.
Where is get_function_label() defined?
get_function_label() is defined in packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js at line 279.
What calls get_function_label()?
get_function_label() is called by 1 function(s): CallExpression.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free