bugfix: 'defined/compiles' open an implicit mixin scope in generics
This commit is contained in:
parent
a71c5f98ea
commit
4892d6929a
4 changed files with 15 additions and 8 deletions
|
|
@ -138,9 +138,12 @@ proc semGenericStmt(c: PContext, n: PNode,
|
||||||
else:
|
else:
|
||||||
result.sons[0] = newSymNode(s, n.sons[0].info)
|
result.sons[0] = newSymNode(s, n.sons[0].info)
|
||||||
first = 1
|
first = 1
|
||||||
if not isDefinedMagic:
|
# Consider 'when defined(globalsSlot): ThreadVarSetValue(globalsSlot, ...)'
|
||||||
for i in countup(first, sonsLen(result) - 1):
|
# in threads.nim: the subtle preprocessing here binds 'globalsSlot' which
|
||||||
result.sons[i] = semGenericStmt(c, result.sons[i], flags, toBind)
|
# is not exported and yet the generic 'threadProcWrapper' works correctly.
|
||||||
|
let flags = if isDefinedMagic: flags+{withinMixin} else: flags
|
||||||
|
for i in countup(first, sonsLen(result) - 1):
|
||||||
|
result.sons[i] = semGenericStmt(c, result.sons[i], flags, toBind)
|
||||||
of nkMacroStmt:
|
of nkMacroStmt:
|
||||||
checkMinSonsLen(n, 2)
|
checkMinSonsLen(n, 2)
|
||||||
var a: PNode
|
var a: PNode
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ proc inbox*[TIn, TOut](self: PActor[TIn, TOut]): ptr TChannel[TIn] =
|
||||||
## gets a pointer to the associated inbox of the actor `self`.
|
## gets a pointer to the associated inbox of the actor `self`.
|
||||||
result = addr(self.i)
|
result = addr(self.i)
|
||||||
|
|
||||||
proc running*[TIn, TOut](a: PActor[TIn, TOut]) =
|
proc running*[TIn, TOut](a: PActor[TIn, TOut]): bool =
|
||||||
## returns true if the actor `a` is running.
|
## returns true if the actor `a` is running.
|
||||||
result = running(a.t)
|
result = running(a.t)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,12 +169,14 @@ var
|
||||||
disabled: int
|
disabled: int
|
||||||
|
|
||||||
proc disableProfiling*() =
|
proc disableProfiling*() =
|
||||||
atomicDec disabled
|
when defined(system.TStackTrace):
|
||||||
system.profilerHook = nil
|
atomicDec disabled
|
||||||
|
system.profilerHook = nil
|
||||||
|
|
||||||
proc enableProfiling*() =
|
proc enableProfiling*() =
|
||||||
if atomicInc(disabled) >= 0:
|
when defined(system.TStackTrace):
|
||||||
system.profilerHook = hook
|
if atomicInc(disabled) >= 0:
|
||||||
|
system.profilerHook = hook
|
||||||
|
|
||||||
when defined(system.TStackTrace):
|
when defined(system.TStackTrace):
|
||||||
system.profilerHook = hook
|
system.profilerHook = hook
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,8 @@ proc c_ungetc(c: int, f: C_TextFileStar) {.importc: "ungetc", nodecl.}
|
||||||
proc c_putc(c: Char, stream: C_TextFileStar) {.importc: "putc", nodecl.}
|
proc c_putc(c: Char, stream: C_TextFileStar) {.importc: "putc", nodecl.}
|
||||||
proc c_fprintf(f: C_TextFileStar, frmt: CString) {.
|
proc c_fprintf(f: C_TextFileStar, frmt: CString) {.
|
||||||
importc: "fprintf", nodecl, varargs.}
|
importc: "fprintf", nodecl, varargs.}
|
||||||
|
proc c_printf(frmt: CString) {.
|
||||||
|
importc: "printf", nodecl, varargs.}
|
||||||
|
|
||||||
proc c_fopen(filename, mode: cstring): C_TextFileStar {.
|
proc c_fopen(filename, mode: cstring): C_TextFileStar {.
|
||||||
importc: "fopen", nodecl.}
|
importc: "fopen", nodecl.}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue