Skip to content

Commit d292967

Browse files
authored
Merge pull request #119 from Tcode-Motion/code-health-refactor-dsl-registry-3064735118577765029
🧹 [refactor] Break down excessively long build_dsl_registry function
2 parents b339d84 + f9e31c6 commit d292967

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎compiler/semantic/src/dsl_schema.rs‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ impl DSLSchema {
3333
}
3434
}
3535

36-
pub fn build_dsl_registry() -> HashMap<String, DSLSchema> {
37-
let mut reg = HashMap::new();
38-
36+
fn register_web_schemas(reg: &mut HashMap<String, DSLSchema>) {
3937
// Web module schemas ──────────────────────────────────────────────
4038
reg.insert(
4139
"website".to_string(),
@@ -298,7 +296,9 @@ pub fn build_dsl_registry() -> HashMap<String, DSLSchema> {
298296
vec![],
299297
),
300298
);
299+
}
301300

301+
fn register_canvas_schemas(reg: &mut HashMap<String, DSLSchema>) {
302302
// Canvas module schemas ──────────────────────────────────────────
303303
reg.insert(
304304
"logo".to_string(),
@@ -485,7 +485,9 @@ pub fn build_dsl_registry() -> HashMap<String, DSLSchema> {
485485
vec![],
486486
),
487487
);
488+
}
488489

490+
fn register_generic_schemas(reg: &mut HashMap<String, DSLSchema>) {
489491
// Generic DSL blocks ────────────────────────────────────────────
490492
reg.insert(
491493
"window".to_string(),
@@ -530,6 +532,12 @@ pub fn build_dsl_registry() -> HashMap<String, DSLSchema> {
530532
vec!["link".into(), "button".into()],
531533
),
532534
);
535+
}
533536

537+
pub fn build_dsl_registry() -> HashMap<String, DSLSchema> {
538+
let mut reg = HashMap::new();
539+
register_web_schemas(&mut reg);
540+
register_canvas_schemas(&mut reg);
541+
register_generic_schemas(&mut reg);
534542
reg
535543
}

0 commit comments

Comments
 (0)