remove enumUtilsExist defines (#21309)
This commit is contained in:
parent
1431f90d8c
commit
4459c272ec
1 changed files with 4 additions and 17 deletions
|
|
@ -130,20 +130,7 @@ const
|
||||||
wFor, wIf, wReturn, wStatic, wTemplate, wTry, wWhile, wUsing}
|
wFor, wIf, wReturn, wStatic, wTemplate, wTry, wWhile, wUsing}
|
||||||
|
|
||||||
|
|
||||||
const enumUtilsExist = compiles:
|
from std/enumutils import genEnumCaseStmt
|
||||||
import std/enumutils
|
from strutils import normalize
|
||||||
|
proc findStr*[T: enum](a, b: static[T], s: string, default: T): T =
|
||||||
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)
|
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
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue