RenderTag() — svelte Function Reference
Architecture documentation for the RenderTag() function in RenderTag.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD a30b3d9e_0c0a_827e_19b7_68d435ab959b["RenderTag()"] 7dee3da2_976f_9ebe_d9d5_50ad37d6c6e1["RenderTag.js"] a30b3d9e_0c0a_827e_19b7_68d435ab959b -->|defined in| 7dee3da2_976f_9ebe_d9d5_50ad37d6c6e1 7148e639_69d8_a03d_3f08_bd23f41e718a["validate_opening_tag()"] a30b3d9e_0c0a_827e_19b7_68d435ab959b -->|calls| 7148e639_69d8_a03d_3f08_bd23f41e718a 9bcad0f1_2e1e_1fe2_1a87_0967adb89be8["unwrap_optional()"] a30b3d9e_0c0a_827e_19b7_68d435ab959b -->|calls| 9bcad0f1_2e1e_1fe2_1a87_0967adb89be8 e0e99a00_6e05_14b1_3821_80dbb3341928["is_resolved_snippet()"] a30b3d9e_0c0a_827e_19b7_68d435ab959b -->|calls| e0e99a00_6e05_14b1_3821_80dbb3341928 99d9725c_450d_d2b1_e671_532f75c42236["render_tag_invalid_spread_argument()"] a30b3d9e_0c0a_827e_19b7_68d435ab959b -->|calls| 99d9725c_450d_d2b1_e671_532f75c42236 c233f4d8_3094_f781_8737_f23485c3edd0["render_tag_invalid_call_expression()"] a30b3d9e_0c0a_827e_19b7_68d435ab959b -->|calls| c233f4d8_3094_f781_8737_f23485c3edd0 313d2a82_30ea_3161_3aad_0cc2094979aa["mark_subtree_dynamic()"] a30b3d9e_0c0a_827e_19b7_68d435ab959b -->|calls| 313d2a82_30ea_3161_3aad_0cc2094979aa style a30b3d9e_0c0a_827e_19b7_68d435ab959b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/2-analyze/visitors/RenderTag.js lines 14–68
export function RenderTag(node, context) {
validate_opening_tag(node, context.state, '@');
node.metadata.path = [...context.path];
const expression = unwrap_optional(node.expression);
const callee = expression.callee;
const binding = callee.type === 'Identifier' ? context.state.scope.get(callee.name) : null;
node.metadata.dynamic = binding?.kind !== 'normal';
/**
* If we can't unambiguously resolve this to a declaration, we
* must assume the worst and link the render tag to every snippet
*/
let resolved = callee.type === 'Identifier' && is_resolved_snippet(binding);
if (binding?.initial?.type === 'SnippetBlock') {
// if this render tag unambiguously references a local snippet, our job is easy
node.metadata.snippets.add(binding.initial);
}
context.state.analysis.snippet_renderers.set(node, resolved);
context.state.analysis.uses_render_tags = true;
const raw_args = unwrap_optional(node.expression).arguments;
for (const arg of raw_args) {
if (arg.type === 'SpreadElement') {
e.render_tag_invalid_spread_argument(arg);
}
}
if (
callee.type === 'MemberExpression' &&
callee.property.type === 'Identifier' &&
['bind', 'apply', 'call'].includes(callee.property.name)
) {
e.render_tag_invalid_call_expression(node);
}
mark_subtree_dynamic(context.path);
context.visit(callee, { ...context.state, expression: node.metadata.expression });
for (const arg of expression.arguments) {
const metadata = new ExpressionMetadata();
node.metadata.arguments.push(metadata);
context.visit(arg, {
...context.state,
expression: metadata
});
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does RenderTag() do?
RenderTag() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/visitors/RenderTag.js.
Where is RenderTag() defined?
RenderTag() is defined in packages/svelte/src/compiler/phases/2-analyze/visitors/RenderTag.js at line 14.
What does RenderTag() call?
RenderTag() calls 6 function(s): is_resolved_snippet, mark_subtree_dynamic, render_tag_invalid_call_expression, render_tag_invalid_spread_argument, unwrap_optional, validate_opening_tag.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free