Home / Function/ get_parent() — svelte Function Reference

get_parent() — svelte Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  68a38b3b_6f0f_ed43_404f_3d00302677a2["get_parent()"]
  0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c["ast.js"]
  68a38b3b_6f0f_ed43_404f_3d00302677a2 -->|defined in| 0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c
  f847bd70_7e16_ed37_5fde_c34cd0ce1d43["CallExpression()"]
  f847bd70_7e16_ed37_5fde_c34cd0ce1d43 -->|calls| 68a38b3b_6f0f_ed43_404f_3d00302677a2
  af91dfb8_8408_6f01_ce5c_fb5099917fd1["is_variable_declaration()"]
  af91dfb8_8408_6f01_ce5c_fb5099917fd1 -->|calls| 68a38b3b_6f0f_ed43_404f_3d00302677a2
  212cc445_9365_40b4_e753_24b51dad0068["is_class_property_assignment_at_constructor_root()"]
  212cc445_9365_40b4_e753_24b51dad0068 -->|calls| 68a38b3b_6f0f_ed43_404f_3d00302677a2
  5ebdf508_43c0_4c5b_b633_950058ffd709["validate_assignment()"]
  5ebdf508_43c0_4c5b_b633_950058ffd709 -->|calls| 68a38b3b_6f0f_ed43_404f_3d00302677a2
  9659d62b_1d6a_1868_1943_0cbb31a2d5e4["ClassBody()"]
  9659d62b_1d6a_1868_1943_0cbb31a2d5e4 -->|calls| 68a38b3b_6f0f_ed43_404f_3d00302677a2
  style 68a38b3b_6f0f_ed43_404f_3d00302677a2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/utils/ast.js lines 425–432

export function get_parent(path, at) {
	let node = path.at(at);
	// @ts-expect-error
	if (node.type === 'TSNonNullExpression' || node.type === 'TSAsExpression') {
		return /** @type {T} */ (path.at(at < 0 ? at - 1 : at + 1));
	}
	return /** @type {T} */ (node);
}

Domain

Subdomains

Frequently Asked Questions

What does get_parent() do?
get_parent() is a function in the svelte codebase, defined in packages/svelte/src/compiler/utils/ast.js.
Where is get_parent() defined?
get_parent() is defined in packages/svelte/src/compiler/utils/ast.js at line 425.
What calls get_parent()?
get_parent() is called by 5 function(s): CallExpression, ClassBody, is_class_property_assignment_at_constructor_root, is_variable_declaration, validate_assignment.

Analyze Your Own Codebase

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

Try Supermodel Free