Home / Function/ reference() — svelte Function Reference

reference() — svelte Function Reference

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

Function javascript Compiler Transformer calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  e5ba0f80_c4ba_4a9e_c19c_5b02f60481ca["reference()"]
  36ef071d_b929_6d90_0038_9f22de99efbe["Scope"]
  e5ba0f80_c4ba_4a9e_c19c_5b02f60481ca -->|defined in| 36ef071d_b929_6d90_0038_9f22de99efbe
  c531899f_2ddc_b054_bfe1_2cfdfd2b1c7f["create_scopes()"]
  c531899f_2ddc_b054_bfe1_2cfdfd2b1c7f -->|calls| e5ba0f80_c4ba_4a9e_c19c_5b02f60481ca
  627dc2f8_4dbc_5bb1_8f54_cee503e17098["get()"]
  e5ba0f80_c4ba_4a9e_c19c_5b02f60481ca -->|calls| 627dc2f8_4dbc_5bb1_8f54_cee503e17098
  style e5ba0f80_c4ba_4a9e_c19c_5b02f60481ca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/scope.js lines 759–777

	reference(node, path) {
		path = [...path]; // ensure that mutations to path afterwards don't affect this reference
		let references = this.references.get(node.name);

		if (!references) this.references.set(node.name, (references = []));

		references.push({ node, path });

		const binding = this.declarations.get(node.name);
		if (binding) {
			binding.references.push({ node, path });
		} else if (this.parent) {
			this.parent.reference(node, path);
		} else {
			// no binding was found, and this is the top level scope,
			// which means this is a global
			this.root.conflicts.add(node.name);
		}
	}

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does reference() do?
reference() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/scope.js.
Where is reference() defined?
reference() is defined in packages/svelte/src/compiler/phases/scope.js at line 759.
What does reference() call?
reference() calls 1 function(s): get.
What calls reference()?
reference() is called by 1 function(s): create_scopes.

Analyze Your Own Codebase

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

Try Supermodel Free