From 31f1b9f405c5d19eedc1c4b07d6a54d1e0303cac Mon Sep 17 00:00:00 2001 From: Dima Granetchi Date: Thu, 2 Feb 2017 17:44:45 +0300 Subject: [PATCH] override operators for WarnPriority --- src/bindx/macro/GenericError.hx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bindx/macro/GenericError.hx b/src/bindx/macro/GenericError.hx index 573d5f3..a7373f6 100644 --- a/src/bindx/macro/GenericError.hx +++ b/src/bindx/macro/GenericError.hx @@ -7,6 +7,11 @@ import haxe.macro.Expr.Position; var ALL = 2; var INFO = 1; var LOW = 0; + + @:op(a >= b) static function ge(a:WarnPriority, b:WarnPriority) return (a: Int) >= (b: Int); + @:op(a > b) static function g(a:WarnPriority, b:WarnPriority) return (a: Int) > (b: Int); + @:op(a < b) static function l(a:WarnPriority, b:WarnPriority) return (a: Int) < (b: Int); + @:op(a <= b) static function le(a:WarnPriority, b:WarnPriority) return (a: Int) <= (b: Int); } class Warn { @@ -20,7 +25,7 @@ class Warn { } public static function w(msg:String, pos:Position, level:WarnPriority) { - if ((Warn.level : Int) >= (level : Int)) + if (Warn.level >= level) Context.warning(msg, pos); } }