mirror of
https://github.com/Dummi26/mers.git
synced 2025-12-19 13:36:32 +01:00
add warning to if-statement in check mode
warning is shown if the condition of an if statement can never be true or false, and the user used the check command. warnings are not shown when you use `mers run`.
This commit is contained in:
@@ -97,6 +97,8 @@ pub enum EColor {
|
||||
MaximumRuntimeExceeded,
|
||||
|
||||
InCodePositionLine,
|
||||
|
||||
Warning,
|
||||
}
|
||||
|
||||
pub trait ETheme: ThemeGen<C = EColor, T = String> {}
|
||||
|
||||
@@ -42,6 +42,10 @@ pub fn default_theme<C>(
|
||||
_ => return None,
|
||||
});
|
||||
}
|
||||
if let Warning = color {
|
||||
// same color as runtime errors, because warnings are only displayed in `check` mode, where the program won't run.
|
||||
return Some(yellow);
|
||||
}
|
||||
let hard_err = red;
|
||||
let type_right = blue;
|
||||
let type_wrong = magenta;
|
||||
@@ -56,7 +60,7 @@ pub fn default_theme<C>(
|
||||
drop(cyan_bright);
|
||||
use EColor::*;
|
||||
Some(match color {
|
||||
Indent(_) => unreachable!(),
|
||||
Indent(_) | Warning => unreachable!(),
|
||||
|
||||
// macros (#...)
|
||||
WhitespaceAfterHashtag
|
||||
|
||||
Reference in New Issue
Block a user