1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: only allow != and == for enum (#7985)

This commit is contained in:
Swastik Baranwal
2021-01-10 15:56:31 +05:30
committed by GitHub
parent 1f5255c2bb
commit 0081e5740d
7 changed files with 34 additions and 8 deletions

View File

@ -128,7 +128,7 @@ fn (mut l Log) send_output(s &string, level Level) {
// fatal logs line `s` via `send_output` if `Log.level` is greater than or equal to the `Level.fatal` category.
pub fn (mut l Log) fatal(s string) {
if l.level < .fatal {
if int(l.level) < int(Level.fatal) {
return
}
l.send_output(s, .fatal)
@ -138,7 +138,7 @@ pub fn (mut l Log) fatal(s string) {
// error logs line `s` via `send_output` if `Log.level` is greater than or equal to the `Level.error` category.
pub fn (mut l Log) error(s string) {
if l.level < .error {
if int(l.level) < int(Level.error) {
return
}
l.send_output(s, .error)
@ -146,7 +146,7 @@ pub fn (mut l Log) error(s string) {
// warn logs line `s` via `send_output` if `Log.level` is greater than or equal to the `Level.warn` category.
pub fn (mut l Log) warn(s string) {
if l.level < .warn {
if int(l.level) < int(Level.warn) {
return
}
l.send_output(s, .warn)
@ -154,7 +154,7 @@ pub fn (mut l Log) warn(s string) {
// info logs line `s` via `send_output` if `Log.level` is greater than or equal to the `Level.info` category.
pub fn (mut l Log) info(s string) {
if l.level < .info {
if int(l.level) < int(Level.info) {
return
}
l.send_output(s, .info)
@ -162,7 +162,7 @@ pub fn (mut l Log) info(s string) {
// debug logs line `s` via `send_output` if `Log.level` is greater than or equal to the `Level.debug` category.
pub fn (mut l Log) debug(s string) {
if l.level < .debug {
if int(l.level) < int(Level.debug) {
return
}
l.send_output(s, .debug)