Home / Function/ extract_identifiers_from_destructuring() — svelte Function Reference

extract_identifiers_from_destructuring() — svelte Function Reference

Architecture documentation for the extract_identifiers_from_destructuring() function in ast.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  4d1d8bf4_9585_c879_52f8_3662d884f69c["extract_identifiers_from_destructuring()"]
  0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c["ast.js"]
  4d1d8bf4_9585_c879_52f8_3662d884f69c -->|defined in| 0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c
  c531899f_2ddc_b054_bfe1_2cfdfd2b1c7f["create_scopes()"]
  c531899f_2ddc_b054_bfe1_2cfdfd2b1c7f -->|calls| 4d1d8bf4_9585_c879_52f8_3662d884f69c
  style 4d1d8bf4_9585_c879_52f8_3662d884f69c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/utils/ast.js lines 193–220

export function extract_identifiers_from_destructuring(node, nodes = []) {
	// TODO This isn't complete, but it should be enough for our purposes
	switch (node.type) {
		case 'Identifier':
			nodes.push(node);
			break;

		case 'ObjectExpression':
			for (const prop of node.properties) {
				if (prop.type === 'Property') {
					extract_identifiers_from_destructuring(/** @type {any} */ (prop.value), nodes);
				} else {
					extract_identifiers_from_destructuring(/** @type {any} */ (prop.argument), nodes);
				}
			}

			break;

		case 'ArrayExpression':
			for (const element of node.elements) {
				if (element) extract_identifiers_from_destructuring(/** @type {any} */ (element), nodes);
			}

			break;
	}

	return nodes;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does extract_identifiers_from_destructuring() do?
extract_identifiers_from_destructuring() is a function in the svelte codebase, defined in packages/svelte/src/compiler/utils/ast.js.
Where is extract_identifiers_from_destructuring() defined?
extract_identifiers_from_destructuring() is defined in packages/svelte/src/compiler/utils/ast.js at line 193.
What calls extract_identifiers_from_destructuring()?
extract_identifiers_from_destructuring() is called by 1 function(s): create_scopes.

Analyze Your Own Codebase

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

Try Supermodel Free