summary refs log tree commit diff stats
path: root/compiler/ccgexprs.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-10-16 23:37:52 -0700
committerGitHub <noreply@github.com>2021-10-17 08:37:52 +0200
commitf77dea01fd980734a3ed4acb812575827540aff9 (patch)
tree551a89d58f170d7b1fc7f8e51e6b3bf5144c15cd /compiler/ccgexprs.nim
parent162b07d72cbe79bad1ddf99413ba508f07a831b1 (diff)
downloadNim-f77dea01fd980734a3ed4acb812575827540aff9.tar.gz
define `nimVersion` automatically and avoid needing -d:nimVersion140 (#18726)
* define `nimVersion` and avoid needing -d:nimVersion140

* fix changelog
Diffstat (limited to 'compiler/ccgexprs.nim')
-rw-r--r--compiler/ccgexprs.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim
index ac4a26bd6..fc09fefc3 100644
--- a/compiler/ccgexprs.nim
+++ b/compiler/ccgexprs.nim
@@ -894,7 +894,7 @@ proc genFieldCheck(p: BProc, e: PNode, obj: Rope, field: PSym) =
     let discIndex = rdSetElemLoc(p.config, v, u.t)
     if optTinyRtti in p.config.globalOptions:
       # not sure how to use `genEnumToStr` here
-      if p.config.isDefined("nimVersion140"):
+      if p.config.getStdlibVersion < (1,5,1):
         const code = "{ #raiseFieldError($1); $2} $n"
         linefmt(p, cpsStmts, code, [strLit, raiseInstr(p)])
       else:
@@ -905,7 +905,7 @@ proc genFieldCheck(p: BProc, e: PNode, obj: Rope, field: PSym) =
       let first = p.config.firstOrd(disc.sym.typ)
       let firstLit = int64Literal(cast[int](first))
       let discName = genTypeInfo(p.config, p.module, disc.sym.typ, e.info)
-      if p.config.isDefined("nimVersion140"):
+      if p.config.getStdlibVersion < (1,5,1):
         const code = "{ #raiseFieldError($1); $2} $n"
         linefmt(p, cpsStmts, code, [strLit, raiseInstr(p)])
       else: