From cb995975fa1ec63fd065255a87e62c59beaff93c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 15 Sep 2026 08:15:39 +0000 Subject: [PATCH] Refactor register_canvas_schemas by extracting helper functions The register_canvas_schemas function was overly long. This commit refactors it into three smaller helper functions based on domain grouping: - register_canvas_shape_schemas (for visual/shape elements) - register_canvas_text_schemas (for textual elements) - register_canvas_misc_schemas (for miscallaneous and animations) Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com> --- compiler/semantic/src/dsl_schema.rs | 76 ++++++++++++++++------------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/compiler/semantic/src/dsl_schema.rs b/compiler/semantic/src/dsl_schema.rs index b912d27c..d39e3c73 100644 --- a/compiler/semantic/src/dsl_schema.rs +++ b/compiler/semantic/src/dsl_schema.rs @@ -298,8 +298,7 @@ fn register_web_schemas(reg: &mut HashMap) { ); } -fn register_canvas_schemas(reg: &mut HashMap) { - // Canvas module schemas ────────────────────────────────────────── +fn register_canvas_shape_schemas(reg: &mut HashMap) { reg.insert( "logo".to_string(), DSLSchema::new( @@ -318,22 +317,6 @@ fn register_canvas_schemas(reg: &mut HashMap) { ), ); - reg.insert( - "rings".to_string(), - DSLSchema::new( - vec![ - "count".into(), - "color".into(), - "size".into(), - "thickness".into(), - "spacing".into(), - "rotation".into(), - ], - vec![], - vec![], - ), - ); - reg.insert( "emblem".to_string(), DSLSchema::new( @@ -365,7 +348,9 @@ fn register_canvas_schemas(reg: &mut HashMap) { vec![], ), ); +} +fn register_canvas_text_schemas(reg: &mut HashMap) { reg.insert( "letter".to_string(), DSLSchema::new( @@ -383,21 +368,6 @@ fn register_canvas_schemas(reg: &mut HashMap) { ), ); - reg.insert( - "circuits".to_string(), - DSLSchema::new( - vec![ - "color".into(), - "density".into(), - "width".into(), - "animated".into(), - "complexity".into(), - ], - vec![], - vec![], - ), - ); - reg.insert( "title".to_string(), DSLSchema::new( @@ -437,6 +407,39 @@ fn register_canvas_schemas(reg: &mut HashMap) { vec![], ), ); +} + +fn register_canvas_misc_schemas(reg: &mut HashMap) { + reg.insert( + "rings".to_string(), + DSLSchema::new( + vec![ + "count".into(), + "color".into(), + "size".into(), + "thickness".into(), + "spacing".into(), + "rotation".into(), + ], + vec![], + vec![], + ), + ); + + reg.insert( + "circuits".to_string(), + DSLSchema::new( + vec![ + "color".into(), + "density".into(), + "width".into(), + "animated".into(), + "complexity".into(), + ], + vec![], + vec![], + ), + ); reg.insert( "theme".to_string(), @@ -487,6 +490,13 @@ fn register_canvas_schemas(reg: &mut HashMap) { ); } +fn register_canvas_schemas(reg: &mut HashMap) { + // Canvas module schemas ────────────────────────────────────────── + register_canvas_shape_schemas(reg); + register_canvas_text_schemas(reg); + register_canvas_misc_schemas(reg); +} + fn register_generic_schemas(reg: &mut HashMap) { // Generic DSL blocks ──────────────────────────────────────────── reg.insert(