Deprecate when declared(echo):echo (#13840)
This commit is contained in:
parent
9102ac8c7d
commit
afd0afe0a3
4 changed files with 79 additions and 81 deletions
|
|
@ -24,55 +24,55 @@ proc typeToYaml*(conf: ConfigRef; n: PType, indent: int = 0, maxRecDepth: int =
|
||||||
proc symToYaml*(conf: ConfigRef; n: PSym, indent: int = 0, maxRecDepth: int = - 1): Rope
|
proc symToYaml*(conf: ConfigRef; n: PSym, indent: int = 0, maxRecDepth: int = - 1): Rope
|
||||||
proc lineInfoToStr*(conf: ConfigRef; info: TLineInfo): Rope
|
proc lineInfoToStr*(conf: ConfigRef; info: TLineInfo): Rope
|
||||||
|
|
||||||
when declared(echo):
|
|
||||||
# these are for debugging only: They are not really deprecated, but I want
|
|
||||||
# the warning so that release versions do not contain debugging statements:
|
|
||||||
proc debug*(n: PSym; conf: ConfigRef = nil) {.exportc: "debugSym", deprecated.}
|
|
||||||
proc debug*(n: PType; conf: ConfigRef = nil) {.exportc: "debugType", deprecated.}
|
|
||||||
proc debug*(n: PNode; conf: ConfigRef = nil) {.exportc: "debugNode", deprecated.}
|
|
||||||
|
|
||||||
proc typekinds*(t: PType) {.deprecated.} =
|
# these are for debugging only: They are not really deprecated, but I want
|
||||||
var t = t
|
# the warning so that release versions do not contain debugging statements:
|
||||||
var s = ""
|
proc debug*(n: PSym; conf: ConfigRef = nil) {.exportc: "debugSym", deprecated.}
|
||||||
while t != nil and t.len > 0:
|
proc debug*(n: PType; conf: ConfigRef = nil) {.exportc: "debugType", deprecated.}
|
||||||
s.add $t.kind
|
proc debug*(n: PNode; conf: ConfigRef = nil) {.exportc: "debugNode", deprecated.}
|
||||||
s.add " "
|
|
||||||
t = t.lastSon
|
|
||||||
echo s
|
|
||||||
|
|
||||||
template debug*(x: PSym|PType|PNode) {.deprecated.} =
|
proc typekinds*(t: PType) {.deprecated.} =
|
||||||
when compiles(c.config):
|
var t = t
|
||||||
debug(c.config, x)
|
var s = ""
|
||||||
elif compiles(c.graph.config):
|
while t != nil and t.len > 0:
|
||||||
debug(c.graph.config, x)
|
s.add $t.kind
|
||||||
|
s.add " "
|
||||||
|
t = t.lastSon
|
||||||
|
echo s
|
||||||
|
|
||||||
|
template debug*(x: PSym|PType|PNode) {.deprecated.} =
|
||||||
|
when compiles(c.config):
|
||||||
|
debug(c.config, x)
|
||||||
|
elif compiles(c.graph.config):
|
||||||
|
debug(c.graph.config, x)
|
||||||
|
else:
|
||||||
|
error()
|
||||||
|
|
||||||
|
template debug*(x: auto) {.deprecated.} =
|
||||||
|
echo x
|
||||||
|
|
||||||
|
template mdbg*: bool {.deprecated.} =
|
||||||
|
when compiles(c.graph):
|
||||||
|
c.module.fileIdx == c.graph.config.projectMainIdx
|
||||||
|
elif compiles(c.module):
|
||||||
|
c.module.fileIdx == c.config.projectMainIdx
|
||||||
|
elif compiles(c.c.module):
|
||||||
|
c.c.module.fileIdx == c.c.config.projectMainIdx
|
||||||
|
elif compiles(m.c.module):
|
||||||
|
m.c.module.fileIdx == m.c.config.projectMainIdx
|
||||||
|
elif compiles(cl.c.module):
|
||||||
|
cl.c.module.fileIdx == cl.c.config.projectMainIdx
|
||||||
|
elif compiles(p):
|
||||||
|
when compiles(p.lex):
|
||||||
|
p.lex.fileIdx == p.lex.config.projectMainIdx
|
||||||
else:
|
else:
|
||||||
error()
|
p.module.module.fileIdx == p.config.projectMainIdx
|
||||||
|
elif compiles(m.module.fileIdx):
|
||||||
template debug*(x: auto) {.deprecated.} =
|
m.module.fileIdx == m.config.projectMainIdx
|
||||||
echo x
|
elif compiles(L.fileIdx):
|
||||||
|
L.fileIdx == L.config.projectMainIdx
|
||||||
template mdbg*: bool {.deprecated.} =
|
else:
|
||||||
when compiles(c.graph):
|
error()
|
||||||
c.module.fileIdx == c.graph.config.projectMainIdx
|
|
||||||
elif compiles(c.module):
|
|
||||||
c.module.fileIdx == c.config.projectMainIdx
|
|
||||||
elif compiles(c.c.module):
|
|
||||||
c.c.module.fileIdx == c.c.config.projectMainIdx
|
|
||||||
elif compiles(m.c.module):
|
|
||||||
m.c.module.fileIdx == m.c.config.projectMainIdx
|
|
||||||
elif compiles(cl.c.module):
|
|
||||||
cl.c.module.fileIdx == cl.c.config.projectMainIdx
|
|
||||||
elif compiles(p):
|
|
||||||
when compiles(p.lex):
|
|
||||||
p.lex.fileIdx == p.lex.config.projectMainIdx
|
|
||||||
else:
|
|
||||||
p.module.module.fileIdx == p.config.projectMainIdx
|
|
||||||
elif compiles(m.module.fileIdx):
|
|
||||||
m.module.fileIdx == m.config.projectMainIdx
|
|
||||||
elif compiles(L.fileIdx):
|
|
||||||
L.fileIdx == L.config.projectMainIdx
|
|
||||||
else:
|
|
||||||
error()
|
|
||||||
|
|
||||||
# --------------------------- ident tables ----------------------------------
|
# --------------------------- ident tables ----------------------------------
|
||||||
proc idTableGet*(t: TIdTable, key: PIdObj): RootRef
|
proc idTableGet*(t: TIdTable, key: PIdObj): RootRef
|
||||||
|
|
@ -628,30 +628,30 @@ proc value(this: var DebugPrinter; value: PNode) =
|
||||||
|
|
||||||
this.closeCurly
|
this.closeCurly
|
||||||
|
|
||||||
when declared(echo):
|
|
||||||
proc debug(n: PSym; conf: ConfigRef) =
|
|
||||||
var this: DebugPrinter
|
|
||||||
this.visited = initTable[pointer, int]()
|
|
||||||
this.renderSymType = true
|
|
||||||
this.useColor = not defined(windows)
|
|
||||||
this.value(n)
|
|
||||||
echo($this.res)
|
|
||||||
|
|
||||||
proc debug(n: PType; conf: ConfigRef) =
|
proc debug(n: PSym; conf: ConfigRef) =
|
||||||
var this: DebugPrinter
|
var this: DebugPrinter
|
||||||
this.visited = initTable[pointer, int]()
|
this.visited = initTable[pointer, int]()
|
||||||
this.renderSymType = true
|
this.renderSymType = true
|
||||||
this.useColor = not defined(windows)
|
this.useColor = not defined(windows)
|
||||||
this.value(n)
|
this.value(n)
|
||||||
echo($this.res)
|
echo($this.res)
|
||||||
|
|
||||||
proc debug(n: PNode; conf: ConfigRef) =
|
proc debug(n: PType; conf: ConfigRef) =
|
||||||
var this: DebugPrinter
|
var this: DebugPrinter
|
||||||
this.visited = initTable[pointer, int]()
|
this.visited = initTable[pointer, int]()
|
||||||
#this.renderSymType = true
|
this.renderSymType = true
|
||||||
this.useColor = not defined(windows)
|
this.useColor = not defined(windows)
|
||||||
this.value(n)
|
this.value(n)
|
||||||
echo($this.res)
|
echo($this.res)
|
||||||
|
|
||||||
|
proc debug(n: PNode; conf: ConfigRef) =
|
||||||
|
var this: DebugPrinter
|
||||||
|
this.visited = initTable[pointer, int]()
|
||||||
|
#this.renderSymType = true
|
||||||
|
this.useColor = not defined(windows)
|
||||||
|
this.value(n)
|
||||||
|
echo($this.res)
|
||||||
|
|
||||||
proc nextTry(h, maxHash: Hash): Hash =
|
proc nextTry(h, maxHash: Hash): Hash =
|
||||||
result = ((5 * h) + 1) and maxHash
|
result = ((5 * h) + 1) and maxHash
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,7 @@ proc echoCfg*(c: ControlFlowGraph; start=0; last = -1) {.deprecated.} =
|
||||||
## echos the ControlFlowGraph for debugging purposes.
|
## echos the ControlFlowGraph for debugging purposes.
|
||||||
var buf = ""
|
var buf = ""
|
||||||
codeListing(c, buf, start, last)
|
codeListing(c, buf, start, last)
|
||||||
when declared(echo):
|
echo buf
|
||||||
echo buf
|
|
||||||
|
|
||||||
proc forkI(c: var Con; n: PNode): TPosition =
|
proc forkI(c: var Con; n: PNode): TPosition =
|
||||||
result = TPosition(c.code.len)
|
result = TPosition(c.code.len)
|
||||||
|
|
|
||||||
|
|
@ -100,16 +100,15 @@ proc searchInScopes*(c: PContext, s: PIdent): PSym =
|
||||||
if result != nil: return
|
if result != nil: return
|
||||||
result = nil
|
result = nil
|
||||||
|
|
||||||
when declared(echo):
|
proc debugScopes*(c: PContext; limit=0) {.deprecated.} =
|
||||||
proc debugScopes*(c: PContext; limit=0) {.deprecated.} =
|
var i = 0
|
||||||
var i = 0
|
for scope in walkScopes(c.currentScope):
|
||||||
for scope in walkScopes(c.currentScope):
|
echo "scope ", i
|
||||||
echo "scope ", i
|
for h in 0..high(scope.symbols.data):
|
||||||
for h in 0..high(scope.symbols.data):
|
if scope.symbols.data[h] != nil:
|
||||||
if scope.symbols.data[h] != nil:
|
echo scope.symbols.data[h].name.s
|
||||||
echo scope.symbols.data[h].name.s
|
if i == limit: break
|
||||||
if i == limit: break
|
inc i
|
||||||
inc i
|
|
||||||
|
|
||||||
proc searchInScopes*(c: PContext, s: PIdent, filter: TSymKinds): PSym =
|
proc searchInScopes*(c: PContext, s: PIdent, filter: TSymKinds): PSym =
|
||||||
for scope in walkScopes(c.currentScope):
|
for scope in walkScopes(c.currentScope):
|
||||||
|
|
|
||||||
|
|
@ -892,7 +892,7 @@ elif not defined(useNimRtl):
|
||||||
|
|
||||||
# Parent process. Copy process information.
|
# Parent process. Copy process information.
|
||||||
if poEchoCmd in options:
|
if poEchoCmd in options:
|
||||||
when declared(echo): echo(command, " ", join(args, " "))
|
echo(command, " ", join(args, " "))
|
||||||
result.id = pid
|
result.id = pid
|
||||||
result.exitFlag = false
|
result.exitFlag = false
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue