ClassDeclaration.js — svelte Source File
Architecture documentation for ClassDeclaration.js, a javascript file in the svelte codebase. 4 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 9c8c3898_c88a_e729_415d_3dfa25f39aa1["ClassDeclaration.js"] 56a689f9_11c0_cc76_bd60_41bb6dc96475["warnings.js"] 9c8c3898_c88a_e729_415d_3dfa25f39aa1 --> 56a689f9_11c0_cc76_bd60_41bb6dc96475 3246e0bc_b9fc_f638_5e35_41e8c39a2408["w"] 9c8c3898_c88a_e729_415d_3dfa25f39aa1 --> 3246e0bc_b9fc_f638_5e35_41e8c39a2408 bf0d8f1b_17da_970d_bf44_fbcf099d5371["utils.js"] 9c8c3898_c88a_e729_415d_3dfa25f39aa1 --> bf0d8f1b_17da_970d_bf44_fbcf099d5371 962a9e38_f393_8bb8_8642_fd23c4e768e6["validate_identifier_name"] 9c8c3898_c88a_e729_415d_3dfa25f39aa1 --> 962a9e38_f393_8bb8_8642_fd23c4e768e6 4aa8a188_84d4_0274_ed83_cac0ab1d3572["index.js"] 4aa8a188_84d4_0274_ed83_cac0ab1d3572 --> 9c8c3898_c88a_e729_415d_3dfa25f39aa1 style 9c8c3898_c88a_e729_415d_3dfa25f39aa1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { ClassDeclaration } from 'estree' */
/** @import { Context } from '../types' */
import * as w from '../../../warnings.js';
import { validate_identifier_name } from './shared/utils.js';
/**
* @param {ClassDeclaration} node
* @param {Context} context
*/
export function ClassDeclaration(node, context) {
if (context.state.analysis.runes && node.id !== null) {
validate_identifier_name(context.state.scope.get(node.id.name));
}
// In modules, we allow top-level module scope only, in components, we allow the component scope,
// which is function_depth of 1. With the exception of `new class` which is also not allowed at
// component scope level either.
const allowed_depth = context.state.ast_type === 'module' ? 0 : 1;
if (context.state.scope.function_depth > allowed_depth) {
w.perf_avoid_nested_class(node);
}
context.next();
}
Domain
Subdomains
Functions
Dependencies
Source
Frequently Asked Questions
What does ClassDeclaration.js do?
ClassDeclaration.js is a source file in the svelte codebase, written in javascript. It belongs to the Compiler domain, Transformer subdomain.
What functions are defined in ClassDeclaration.js?
ClassDeclaration.js defines 1 function(s): ClassDeclaration.
What does ClassDeclaration.js depend on?
ClassDeclaration.js imports 4 module(s): utils.js, validate_identifier_name, w, warnings.js.
What files import ClassDeclaration.js?
ClassDeclaration.js is imported by 1 file(s): index.js.
Where is ClassDeclaration.js in the architecture?
ClassDeclaration.js is located at packages/svelte/src/compiler/phases/2-analyze/visitors/ClassDeclaration.js (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler/phases/2-analyze/visitors).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free