@@ -21,6 +21,7 @@ impl Compiler {
2121 pub fn new ( ) -> Self { Compiler }
2222
2323 /// Back-compat: default to running semantic analysis.
24+ #[ allow( dead_code) ]
2425 pub fn compile ( & self , code : & str , output_file : & str ) -> Result < ( ) , CoreError > {
2526 self . compile_with ( code, output_file, true )
2627 }
@@ -66,9 +67,9 @@ impl Compiler {
6667
6768 // 6) Write file
6869 let mut file = File :: create ( output_file)
69- . map_err ( |e| CoreError :: general_error ( & format ! ( "Failed to create output file: {}" , e) ) ) ?;
70+ . map_err ( |e| CoreError :: io_error ( & format ! ( "Failed to create output file: {}" , e) ) ) ?;
7071 file. write_all ( output_code. as_bytes ( ) )
71- . map_err ( |e| CoreError :: general_error ( & format ! ( "Failed to write to output file: {}" , e) ) ) ?;
72+ . map_err ( |e| CoreError :: io_error ( & format ! ( "Failed to write to output file: {}" , e) ) ) ?;
7273
7374 println ! ( "Compilation successful. Output written to '{}'." , output_file) ;
7475 Ok ( ( ) )
@@ -77,7 +78,7 @@ impl Compiler {
7778 /// Validates code before compilation
7879 pub fn validate_and_summarize ( & self , code : & str ) -> Result < String , CoreError > {
7980 if code. trim ( ) . is_empty ( ) {
80- return Err ( CoreError :: general_error ( "Code is empty. Nothing to compile. ") ) ;
81+ return Err ( CoreError :: invalid_operation ( "No source code provided ") ) ;
8182 }
8283 let lines = code. lines ( ) . count ( ) ;
8384 let chars = code. chars ( ) . count ( ) ;
0 commit comments