make fullpaths the default in error messages and stack traces for mor… (#11385)

* make fullpaths the default in error messages and stack traces for more convenient development
* split up -d:release into -d:release and -d:danger flags
* workaround a Nim config parser bug
* fixes an old nim config parser bug
* make megatest green again
* make nimpretty tests work again
* make nimsuggest green
This commit is contained in:
Andreas Rumpf 2019-06-05 08:02:54 +02:00 • committed by GitHub
commit 7215341190
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 41 additions and 27 deletions

View file

@ -480,9 +480,7 @@ proc detectCapturedVars(n: PNode; owner: PSym; c: var DetectionPass) =
if n.typ != nil:
detectCapturedVars(n[namePos], owner, c)
of nkReturnStmt:
if n[0].kind in {nkAsgn, nkFastAsgn}:
detectCapturedVars(n[0].sons[1], owner, c)
else: assert n[0].kind == nkEmpty
detectCapturedVars(n[0], owner, c)
else:
for i in 0..<n.len:
detectCapturedVars(n[i], owner, c)

View file

@ -363,7 +363,8 @@ proc mainCommand*(graph: ModuleGraph) =
rawMessage(conf, hintSuccessX, [$conf.linesCompiled,
formatFloat(epochTime() - conf.lastCmdTime, ffDecimal, 3),
usedMem,
if isDefined(conf, "release"): "Release Build"
if isDefined(conf, "danger"): "Dangerous Release Build"
elif isDefined(conf, "release"): "Release Build"
else: "Debug Build"])
when PrintRopeCacheStats:

View file

@ -28,7 +28,7 @@ proc parseAtom(L: var TLexer, tok: var TToken; config: ConfigRef): bool =
result = parseExpr(L, tok, config)
if tok.tokType == tkParRi: ppGetTok(L, tok)
else: lexMessage(L, errGenerated, "expected closing ')'")
elif tok.ident.id == ord(wNot):
elif tok.tokType == tkNot:
ppGetTok(L, tok)
result = not parseAtom(L, tok, config)
else:
@ -37,14 +37,14 @@ proc parseAtom(L: var TLexer, tok: var TToken; config: ConfigRef): bool =
proc parseAndExpr(L: var TLexer, tok: var TToken; config: ConfigRef): bool =
result = parseAtom(L, tok, config)
while tok.ident.id == ord(wAnd):
while tok.tokType == tkAnd:
ppGetTok(L, tok) # skip "and"
var b = parseAtom(L, tok, config)
result = result and b
proc parseExpr(L: var TLexer, tok: var TToken; config: ConfigRef): bool =
result = parseAndExpr(L, tok, config)
while tok.ident.id == ord(wOr):
while tok.tokType == tkOr:
ppGetTok(L, tok) # skip "or"
var b = parseAndExpr(L, tok, config)
result = result or b

View file

@ -276,7 +276,8 @@ const
optBoundsCheck, optOverflowCheck, optAssert, optWarns,
optHints, optStackTrace, optLineTrace,
optTrMacros, optNilCheck, optMoveCheck}
DefaultGlobalOptions* = {optThreadAnalysis}
DefaultGlobalOptions* = {optThreadAnalysis,
optExcessiveStackTrace, optListFullPaths}
proc getSrcTimestamp(): DateTime =
try:
@ -312,7 +313,7 @@ proc newConfigRef*(): ConfigRef =
macrosToExpand: newStringTable(modeStyleInsensitive),
m: initMsgConfig(),
evalExpr: "",
cppDefines: initSet[string](),
cppDefines: initHashSet[string](),
headerFile: "", features: {}, foreignPackageNotes: {hintProcessing, warnUnknownMagic,
hintQuitCalled, hintExecuting},
notes: NotesVerbosity[1], mainPackageNotes: NotesVerbosity[1],
@ -540,7 +541,7 @@ proc getNimcacheDir*(conf: ConfigRef): AbsoluteDir =
conf.projectPath / genSubDir
else:
AbsoluteDir(getOsCacheDir() / splitFile(conf.projectName).name &
(if isDefined(conf, "release"): "_r" else: "_d"))
(if isDefined(conf, "release") or isDefined(conf, "danger"): "_r" else: "_d"))
proc pathSubs*(conf: ConfigRef; p, config: string): string =
let home = removeTrailingDirSep(os.getHomeDir())

View file

@ -1189,7 +1189,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
of opcFinallyEnd:
# The control flow may not resume at the next instruction since we may be
# raising an exception or performing a cleanup.
if not savedPC < 0:
if savedPC >= 0:
pc = savedPC - 1
savedPC = -1
if tos != savedFrame: