Home / Function/ BlockStatement() — svelte Function Reference

BlockStatement() — svelte Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  b555c552_6b1f_078c_a5da_1ef7d9983b25["BlockStatement()"]
  23a1c53f_df53_154c_a2d9_3e0efa9bef15["BlockStatement.js"]
  b555c552_6b1f_078c_a5da_1ef7d9983b25 -->|defined in| 23a1c53f_df53_154c_a2d9_3e0efa9bef15
  fb41e547_07c8_cc9a_e227_3f08aad6d1f5["add_state_transformers()"]
  b555c552_6b1f_078c_a5da_1ef7d9983b25 -->|calls| fb41e547_07c8_cc9a_e227_3f08aad6d1f5
  style b555c552_6b1f_078c_a5da_1ef7d9983b25 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/3-transform/client/visitors/BlockStatement.js lines 10–32

export function BlockStatement(node, context) {
	add_state_transformers(context);
	const tracing = context.state.scope.tracing;

	if (tracing !== null) {
		const parent =
			/** @type {ArrowFunctionExpression | FunctionDeclaration | FunctionExpression} */ (
				context.path.at(-1)
			);

		const is_async = parent.async;

		const call = b.call(
			'$.trace',
			/** @type {Expression} */ (tracing),
			b.thunk(b.block(node.body.map((n) => /** @type {Statement} */ (context.visit(n)))), is_async)
		);

		return b.block([b.return(is_async ? b.await(call) : call)]);
	}

	context.next();
}

Domain

Subdomains

Frequently Asked Questions

What does BlockStatement() do?
BlockStatement() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/3-transform/client/visitors/BlockStatement.js.
Where is BlockStatement() defined?
BlockStatement() is defined in packages/svelte/src/compiler/phases/3-transform/client/visitors/BlockStatement.js at line 10.
What does BlockStatement() call?
BlockStatement() calls 1 function(s): add_state_transformers.

Analyze Your Own Codebase

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

Try Supermodel Free