get_prop_source() — svelte Function Reference
Architecture documentation for the get_prop_source() function in utils.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 5f0f3809_9fa1_84c1_24be_92d8863f2fb1["get_prop_source()"] c518b20b_2355_7b11_4ac2_2d9bb5dcfb43["utils.js"] 5f0f3809_9fa1_84c1_24be_92d8863f2fb1 -->|defined in| c518b20b_2355_7b11_4ac2_2d9bb5dcfb43 dbadea0c_9bb0_dd96_41bd_09a33169352f["VariableDeclaration()"] dbadea0c_9bb0_dd96_41bd_09a33169352f -->|calls| 5f0f3809_9fa1_84c1_24be_92d8863f2fb1 0eb6598b_73c2_c88f_86a0_12cef2210ad8["is_simple_expression()"] 5f0f3809_9fa1_84c1_24be_92d8863f2fb1 -->|calls| 0eb6598b_73c2_c88f_86a0_12cef2210ad8 style 5f0f3809_9fa1_84c1_24be_92d8863f2fb1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/3-transform/client/utils.js lines 53–108
export function get_prop_source(binding, state, name, initial) {
/** @type {Expression[]} */
const args = [b.id('$$props'), b.literal(name)];
let flags = 0;
if (binding.kind === 'bindable_prop') {
flags |= PROPS_IS_BINDABLE;
}
if (state.analysis.immutable) {
flags |= PROPS_IS_IMMUTABLE;
}
if (state.analysis.runes) {
flags |= PROPS_IS_RUNES;
}
if (
state.analysis.accessors ||
(state.analysis.immutable
? binding.reassigned || (state.analysis.runes && binding.mutated)
: binding.updated)
) {
flags |= PROPS_IS_UPDATED;
}
/** @type {Expression | undefined} */
let arg;
if (initial) {
// To avoid eagerly evaluating the right-hand-side, we wrap it in a thunk if necessary
if (is_simple_expression(initial)) {
arg = initial;
} else {
if (
initial.type === 'CallExpression' &&
initial.callee.type === 'Identifier' &&
initial.arguments.length === 0
) {
arg = initial.callee;
} else {
arg = b.thunk(initial);
}
flags |= PROPS_IS_LAZY_INITIAL;
}
}
if (flags || arg) {
args.push(b.literal(flags));
if (arg) args.push(arg);
}
return b.call('$.prop', ...args);
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does get_prop_source() do?
get_prop_source() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/3-transform/client/utils.js.
Where is get_prop_source() defined?
get_prop_source() is defined in packages/svelte/src/compiler/phases/3-transform/client/utils.js at line 53.
What does get_prop_source() call?
get_prop_source() calls 1 function(s): is_simple_expression.
What calls get_prop_source()?
get_prop_source() is called by 1 function(s): VariableDeclaration.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free