From 4459c272ecb8ddb964fa2d34a4dcef3368d807b5 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Sun, 29 Jan 2023 22:11:24 +0800 Subject: [PATCH] remove `enumUtilsExist` defines (#21309) --- compiler/wordrecg.nim | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim index a9ef31dc2c..29a50ac52f 100644 --- a/compiler/wordrecg.nim +++ b/compiler/wordrecg.nim @@ -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)