Skip to content

Commit

Permalink
remove unused nimStdlibVersion (nim-lang#24060)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout authored Sep 4, 2024
1 parent 6908fb4 commit 99f4cfa
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
18 changes: 0 additions & 18 deletions compiler/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ const
cmdCtags, cmdBuildindex}

type
NimVer* = tuple[major: int, minor: int, patch: int]
TStringSeq* = seq[string]
TGCMode* = enum # the selected GC
gcUnselected = "unselected"
Expand Down Expand Up @@ -396,7 +395,6 @@ type
outDir*: AbsoluteDir
jsonBuildFile*: AbsoluteFile
prefixDir*, libpath*, nimcacheDir*: AbsoluteDir
nimStdlibVersion*: NimVer
dllOverrides, moduleOverrides*, cfileSpecificOptions*: StringTableRef
projectName*: string # holds a name like 'nim'
projectPath*: AbsoluteDir # holds a path like /home/alice/projects/nim/compiler/
Expand Down Expand Up @@ -450,16 +448,6 @@ type
clientProcessId*: int


proc parseNimVersion*(a: string): NimVer =
# could be moved somewhere reusable
result = default(NimVer)
if a.len > 0:
let b = a.split(".")
assert b.len == 3, a
template fn(i) = result[i] = b[i].parseInt # could be optimized if needed
fn(0)
fn(1)
fn(2)

proc assignIfDefault*[T](result: var T, val: T, def = default(T)) =
## if `result` was already assigned to a value (that wasn't `def`), this is a noop.
Expand Down Expand Up @@ -634,12 +622,6 @@ proc newPartialConfigRef*(): ConfigRef =
proc cppDefine*(c: ConfigRef; define: string) =
c.cppDefines.incl define

proc getStdlibVersion*(conf: ConfigRef): NimVer =
if conf.nimStdlibVersion == (0,0,0):
let s = conf.symbols.getOrDefault("nimVersion", "")
conf.nimStdlibVersion = s.parseNimVersion
result = conf.nimStdlibVersion

proc isDefined*(conf: ConfigRef; symbol: string): bool =
if conf.symbols.hasKey(symbol):
result = true
Expand Down
2 changes: 1 addition & 1 deletion config/config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ when defined(nimStrictMode):
switch("hintAsError", "ConvFromXtoItselfNotNeeded")
# future work: XDeclaredButNotUsed

switch("define", "nimVersion:" & NimVersion)
switch("define", "nimVersion:" & NimVersion) # deadcode

0 comments on commit 99f4cfa

Please sign in to comment.