fixes the regressions introduced by fix for #5076
This commit is contained in:
parent
75345ad1aa
commit
20cf28adde
4 changed files with 18 additions and 4 deletions
|
|
@ -1129,7 +1129,11 @@ proc genNewSeqOfCap(p: BProc; e: PNode; d: var TLoc) =
|
||||||
|
|
||||||
proc genConstExpr(p: BProc, n: PNode): Rope
|
proc genConstExpr(p: BProc, n: PNode): Rope
|
||||||
proc handleConstExpr(p: BProc, n: PNode, d: var TLoc): bool =
|
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)
|
var t = getUniqueType(n.typ)
|
||||||
discard getTypeDesc(p.module, t) # so that any fields are initialized
|
discard getTypeDesc(p.module, t) # so that any fields are initialized
|
||||||
let id = nodeTableTestOrSet(p.module.dataCache, n, p.module.labels)
|
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
|
result = false
|
||||||
|
|
||||||
proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
|
proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
|
||||||
if handleConstExpr(p, e, d): return
|
|
||||||
#echo rendertree e, " ", e.isDeepConstExpr
|
#echo rendertree e, " ", e.isDeepConstExpr
|
||||||
|
if handleConstExpr(p, e, d): return
|
||||||
var tmp: TLoc
|
var tmp: TLoc
|
||||||
var t = e.typ.skipTypes(abstractInst)
|
var t = e.typ.skipTypes(abstractInst)
|
||||||
getTemp(p, t, tmp)
|
getTemp(p, t, tmp)
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ type
|
||||||
TInfoCCProps* = set[TInfoCCProp]
|
TInfoCCProps* = set[TInfoCCProp]
|
||||||
TInfoCC* = tuple[
|
TInfoCC* = tuple[
|
||||||
name: string, # the short name of the compiler
|
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
|
optSpeed: string, # the options for optimization for speed
|
||||||
optSize: string, # the options for optimization for size
|
optSize: string, # the options for optimization for size
|
||||||
compilerExe: string, # the compiler's executable
|
compilerExe: string, # the compiler's executable
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,16 @@ proc setDefaultLibpath*() =
|
||||||
libpath = parentNimLibPath
|
libpath = parentNimLibPath
|
||||||
|
|
||||||
proc canonicalizePath*(path: string): string =
|
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 =
|
proc shortenDir*(dir: string): string =
|
||||||
## returns the interesting part of a dir
|
## returns the interesting part of a dir
|
||||||
|
|
|
||||||
|
|
@ -490,6 +490,7 @@ proc pragmaLine(c: PContext, n: PNode) =
|
||||||
elif y.kind != nkIntLit:
|
elif y.kind != nkIntLit:
|
||||||
localError(n.info, errIntLiteralExpected)
|
localError(n.info, errIntLiteralExpected)
|
||||||
else:
|
else:
|
||||||
|
# XXX this produces weird paths which are not properly resolved:
|
||||||
n.info.fileIndex = msgs.fileInfoIdx(x.strVal)
|
n.info.fileIndex = msgs.fileInfoIdx(x.strVal)
|
||||||
n.info.line = int16(y.intVal)
|
n.info.line = int16(y.intVal)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue