make Nim compiler compile with 0.15.2

This commit is contained in:
Araq 2017-01-07 02:43:31 +01:00
commit 5c08ca7ed2
2 changed files with 22 additions and 6 deletions

View file

@ -16,11 +16,24 @@ import
condsyms, rodutils, renderer, idgen, cgendata, ccgmerge, semfold, aliases, condsyms, rodutils, renderer, idgen, cgendata, ccgmerge, semfold, aliases,
lowerings, semparallel, tables lowerings, semparallel, tables
from modulegraphs import ModuleGraph
from dynlib import libCandidates
import strutils except `%` # collides with ropes.`%` import strutils except `%` # collides with ropes.`%`
from modulegraphs import ModuleGraph
import dynlib
when not declared(dynlib.libCandidates):
proc libCandidates(s: string, dest: var seq[string]) =
## given a library name pattern `s` write possible library names to `dest`.
var le = strutils.find(s, '(')
var ri = strutils.find(s, ')', le+1)
if le >= 0 and ri > le:
var prefix = substr(s, 0, le - 1)
var suffix = substr(s, ri + 1)
for middle in split(substr(s, le + 1, ri - 1), '|'):
libCandidates(prefix & middle & suffix, dest)
else:
add(dest, s)
when options.hasTinyCBackend: when options.hasTinyCBackend:
import tccgen import tccgen

View file

@ -773,9 +773,12 @@ from json import escapeJson
proc writeJsonBuildInstructions*(projectfile: string) = proc writeJsonBuildInstructions*(projectfile: string) =
template lit(x: untyped) = f.write x template lit(x: untyped) = f.write x
template str(x: untyped) = template str(x: untyped) =
buf.setLen 0 when compiles(escapeJson(x, buf)):
escapeJson(x, buf) buf.setLen 0
f.write buf escapeJson(x, buf)
f.write buf
else:
f.write escapeJson(x)
proc cfiles(f: File; buf: var string; list: TLinkedList, isExternal: bool) = proc cfiles(f: File; buf: var string; list: TLinkedList, isExternal: bool) =
var it = PStrEntry(list.head) var it = PStrEntry(list.head)