remove enumUtilsExist defines (#21309)

This commit is contained in:
ringabout 2023-01-29 22:11:24 +08:00 • committed by GitHub
commit 4459c272ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -130,20 +130,7 @@ const
wFor, wIf, wReturn, wStatic, wTemplate, wTry, wWhile, wUsing} wFor, wIf, wReturn, wStatic, wTemplate, wTry, wWhile, wUsing}
const enumUtilsExist = compiles:
import std/enumutils
when enumUtilsExist:
from std/enumutils import genEnumCaseStmt from std/enumutils import genEnumCaseStmt
from strutils import normalize from strutils import normalize
proc findStr*[T: enum](a, b: static[T], s: string, default: T): T = proc findStr*[T: enum](a, b: static[T], s: string, default: T): T =
genEnumCaseStmt(T, s, default, ord(a), ord(b), normalize) genEnumCaseStmt(T, s, default, ord(a), ord(b), normalize)
else:
from strutils import cmpIgnoreStyle
proc findStr*[T: enum](a, b: static[T], s: string, default: T): T {.deprecated.} =
# used for compiler bootstrapping only
for i in a..b:
if cmpIgnoreStyle($i, s) == 0:
return i
result = default