Home / Function/ AwaitExpression() — svelte Function Reference

AwaitExpression() — svelte Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  13220c35_582a_d269_070f_1e0ab744c277["AwaitExpression()"]
  41443d2c_586c_ba32_7f9a_14406e203032["AwaitExpression.js"]
  13220c35_582a_d269_070f_1e0ab744c277 -->|defined in| 41443d2c_586c_ba32_7f9a_14406e203032
  a5d434ec_3ca3_7fe0_cea3_58f60f017b7b["save()"]
  13220c35_582a_d269_070f_1e0ab744c277 -->|calls| a5d434ec_3ca3_7fe0_cea3_58f60f017b7b
  style 13220c35_582a_d269_070f_1e0ab744c277 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/3-transform/server/visitors/AwaitExpression.js lines 9–40

export function AwaitExpression(node, context) {
	const argument = /** @type {Expression} */ (context.visit(node.argument));

	if (context.state.analysis.pickled_awaits.has(node)) {
		return save(argument);
	}

	// we also need to restore context after block expressions
	let i = context.path.length;
	while (i--) {
		const parent = context.path[i];

		if (
			parent.type === 'ArrowFunctionExpression' ||
			parent.type === 'FunctionExpression' ||
			parent.type === 'FunctionDeclaration'
		) {
			break;
		}

		// @ts-ignore
		if (parent.metadata) {
			if (parent.type !== 'ExpressionTag' && parent.type !== 'Fragment') {
				return save(argument);
			}

			break;
		}
	}

	return argument === node.argument ? node : { ...node, argument };
}

Domain

Subdomains

Calls

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free