Skip to content

Commit

Permalink
Fixed a typo causing compile error. Added logic to fail if there isn'…
Browse files Browse the repository at this point in the history
…t a main function or a system.
cogiton committed Apr 16, 2024

Verified

This commit was signed with the committer’s verified signature.
1 parent 4a226d1 commit 419153c
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 0 additions & 1 deletion framec/src/frame_c/compiler.rs
Original file line number Diff line number Diff line change
@@ -168,7 +168,6 @@ impl Exe {
{
let mut syntactic_parser = Parser::new(&tokens, &mut comments, true, arcanum);


panic::set_hook(Box::new(|_info| {
// prevent std output from panics.
}));
16 changes: 12 additions & 4 deletions framec/src/frame_c/parser.rs
Original file line number Diff line number Diff line change
@@ -211,10 +211,18 @@ impl<'a> Parser<'a> {
} else {
// TODO: For now we always need to have one (and only one) system.
let module = match module_elements_opt {
Some(module_elements) => Module { module_elements },
None => Module {
module_elements: vec![],
},
Some(module_elements) => {
if module_elements.len() == 0 {
self.error_at_current("Program must have a main function or system.");
}
Module { module_elements }
}
None => {
self.error_at_current("Program must have a main function or system.");
Module {
module_elements: vec![],
}
}
};

let line = if self.current == 0 {
2 changes: 1 addition & 1 deletion framec/src/frame_c/utils.rs
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ pub(crate) mod frame_exitcode {
}

pub struct RunError {
pub code: frame_exitcode::FrameExitCeode,
pub code: frame_exitcode::FrameExitCode,
pub error: String,
}

0 comments on commit 419153c

Please sign in to comment.