mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
remove enumUtilsExist defines (#21309)
This commit is contained in:
@@ -130,20 +130,7 @@ const
|
||||
wFor, wIf, wReturn, wStatic, wTemplate, wTry, wWhile, wUsing}
|
||||
|
||||
|
||||
const enumUtilsExist = compiles:
|
||||
import std/enumutils
|
||||
|
||||
when enumUtilsExist:
|
||||
from std/enumutils import genEnumCaseStmt
|
||||
from strutils import normalize
|
||||
proc findStr*[T: enum](a, b: static[T], s: string, default: T): T =
|
||||
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
|
||||
from std/enumutils import genEnumCaseStmt
|
||||
from strutils import normalize
|
||||
proc findStr*[T: enum](a, b: static[T], s: string, default: T): T =
|
||||
genEnumCaseStmt(T, s, default, ord(a), ord(b), normalize)
|
||||
|
||||
Reference in New Issue
Block a user