Home / Function/ is_simple_expression() — svelte Function Reference

is_simple_expression() — svelte Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0eb6598b_73c2_c88f_86a0_12cef2210ad8["is_simple_expression()"]
  0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c["ast.js"]
  0eb6598b_73c2_c88f_86a0_12cef2210ad8 -->|defined in| 0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c
  5f0f3809_9fa1_84c1_24be_92d8863f2fb1["get_prop_source()"]
  5f0f3809_9fa1_84c1_24be_92d8863f2fb1 -->|calls| 0eb6598b_73c2_c88f_86a0_12cef2210ad8
  84572b9b_9a21_09af_15ac_85b59b114603["build_fallback()"]
  84572b9b_9a21_09af_15ac_85b59b114603 -->|calls| 0eb6598b_73c2_c88f_86a0_12cef2210ad8
  style 0eb6598b_73c2_c88f_86a0_12cef2210ad8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/utils/ast.js lines 442–469

export function is_simple_expression(node) {
	if (
		node.type === 'Literal' ||
		node.type === 'Identifier' ||
		node.type === 'ArrowFunctionExpression' ||
		node.type === 'FunctionExpression'
	) {
		return true;
	}

	if (node.type === 'ConditionalExpression') {
		return (
			is_simple_expression(node.test) &&
			is_simple_expression(node.consequent) &&
			is_simple_expression(node.alternate)
		);
	}

	if (node.type === 'BinaryExpression' || node.type === 'LogicalExpression') {
		return (
			node.left.type !== 'PrivateIdentifier' &&
			is_simple_expression(node.left) &&
			is_simple_expression(node.right)
		);
	}

	return false;
}

Domain

Subdomains

Frequently Asked Questions

What does is_simple_expression() do?
is_simple_expression() is a function in the svelte codebase, defined in packages/svelte/src/compiler/utils/ast.js.
Where is is_simple_expression() defined?
is_simple_expression() is defined in packages/svelte/src/compiler/utils/ast.js at line 442.
What calls is_simple_expression()?
is_simple_expression() is called by 2 function(s): build_fallback, get_prop_source.

Analyze Your Own Codebase

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

Try Supermodel Free