Home / Function/ build_fallback() — svelte Function Reference

build_fallback() — svelte Function Reference

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

Function javascript Compiler Migrator calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  84572b9b_9a21_09af_15ac_85b59b114603["build_fallback()"]
  0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c["ast.js"]
  84572b9b_9a21_09af_15ac_85b59b114603 -->|defined in| 0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c
  007c3954_38c0_485d_f93d_2da7aa34f6bc["VariableDeclaration()"]
  007c3954_38c0_485d_f93d_2da7aa34f6bc -->|calls| 84572b9b_9a21_09af_15ac_85b59b114603
  27987cb0_7747_fd10_c20f_fd6c1f1c37e2["_extract_paths()"]
  27987cb0_7747_fd10_c20f_fd6c1f1c37e2 -->|calls| 84572b9b_9a21_09af_15ac_85b59b114603
  0eb6598b_73c2_c88f_86a0_12cef2210ad8["is_simple_expression()"]
  84572b9b_9a21_09af_15ac_85b59b114603 -->|calls| 0eb6598b_73c2_c88f_86a0_12cef2210ad8
  bdb5b0f7_5673_570b_155a_0bd0f9f8169a["is_expression_async()"]
  84572b9b_9a21_09af_15ac_85b59b114603 -->|calls| bdb5b0f7_5673_570b_155a_0bd0f9f8169a
  style 84572b9b_9a21_09af_15ac_85b59b114603 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/utils/ast.js lines 585–597

export function build_fallback(expression, fallback) {
	if (is_simple_expression(fallback)) {
		return b.call('$.fallback', expression, fallback);
	}

	if (fallback.type === 'AwaitExpression' && is_simple_expression(fallback.argument)) {
		return b.await(b.call('$.fallback', expression, fallback.argument));
	}

	return is_expression_async(fallback)
		? b.await(b.call('$.fallback', expression, b.thunk(fallback, true), b.true))
		: b.call('$.fallback', expression, b.thunk(fallback), b.true);
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free