fixes the regressions introduced by fix for #5076

This commit is contained in:
Araq
2016-11-30 19:02:16 +01:00
parent 75345ad1aa
commit 20cf28adde
4 changed files with 18 additions and 4 deletions

View File

@@ -1129,7 +1129,11 @@ proc genNewSeqOfCap(p: BProc; e: PNode; d: var TLoc) =
proc genConstExpr(p: BProc, n: PNode): Rope
proc handleConstExpr(p: BProc, n: PNode, d: var TLoc): bool =
if d.k == locNone and n.len > ord(n.kind == nkObjConstr) and n.isDeepConstExpr:
proc forbiddenType(t: PType): bool {.inline.} =
result = t.kind == tyObject and not isObjLackingTypeField(t)
#echo "forbidden type ", result
if d.k == locNone and n.len > ord(n.kind == nkObjConstr) and n.isDeepConstExpr and
not forbiddenType(n.typ):
var t = getUniqueType(n.typ)
discard getTypeDesc(p.module, t) # so that any fields are initialized
let id = nodeTableTestOrSet(p.module.dataCache, n, p.module.labels)
@@ -1144,8 +1148,8 @@ proc handleConstExpr(p: BProc, n: PNode, d: var TLoc): bool =
result = false
proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
if handleConstExpr(p, e, d): return
#echo rendertree e, " ", e.isDeepConstExpr
if handleConstExpr(p, e, d): return
var tmp: TLoc
var t = e.typ.skipTypes(abstractInst)
getTemp(p, t, tmp)

View File

@@ -34,7 +34,7 @@ type
TInfoCCProps* = set[TInfoCCProp]
TInfoCC* = tuple[
name: string, # the short name of the compiler
objExt: string, # the compiler's object file extenstion
objExt: string, # the compiler's object file extension
optSpeed: string, # the options for optimization for speed
optSize: string, # the options for optimization for size
compilerExe: string, # the compiler's executable

View File

@@ -227,7 +227,16 @@ proc setDefaultLibpath*() =
libpath = parentNimLibPath
proc canonicalizePath*(path: string): string =
result = path.expandFilename
# on Windows, 'expandFilename' calls getFullPathName which doesn't do
# case corrections, so we have to use this convoluted way of retrieving
# the true filename (see tests/modules and Nimble uses 'import Uri' instead
# of 'import uri'):
when defined(windows):
result = path.expandFilename
for x in walkFiles(result):
return x
else:
result = path.expandFilename
proc shortenDir*(dir: string): string =
## returns the interesting part of a dir

View File

@@ -490,6 +490,7 @@ proc pragmaLine(c: PContext, n: PNode) =
elif y.kind != nkIntLit:
localError(n.info, errIntLiteralExpected)
else:
# XXX this produces weird paths which are not properly resolved:
n.info.fileIndex = msgs.fileInfoIdx(x.strVal)
n.info.line = int16(y.intVal)
else: