mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-20 11:30:43 +00:00
bugfix: 'defined/compiles' open an implicit mixin scope in generics
This commit is contained in:
@@ -138,9 +138,12 @@ proc semGenericStmt(c: PContext, n: PNode,
|
||||
else:
|
||||
result.sons[0] = newSymNode(s, n.sons[0].info)
|
||||
first = 1
|
||||
if not isDefinedMagic:
|
||||
for i in countup(first, sonsLen(result) - 1):
|
||||
result.sons[i] = semGenericStmt(c, result.sons[i], flags, toBind)
|
||||
# Consider 'when defined(globalsSlot): ThreadVarSetValue(globalsSlot, ...)'
|
||||
# in threads.nim: the subtle preprocessing here binds 'globalsSlot' which
|
||||
# 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:
|
||||
checkMinSonsLen(n, 2)
|
||||
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`.
|
||||
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.
|
||||
result = running(a.t)
|
||||
|
||||
|
||||
@@ -169,12 +169,14 @@ var
|
||||
disabled: int
|
||||
|
||||
proc disableProfiling*() =
|
||||
atomicDec disabled
|
||||
system.profilerHook = nil
|
||||
when defined(system.TStackTrace):
|
||||
atomicDec disabled
|
||||
system.profilerHook = nil
|
||||
|
||||
proc enableProfiling*() =
|
||||
if atomicInc(disabled) >= 0:
|
||||
system.profilerHook = hook
|
||||
when defined(system.TStackTrace):
|
||||
if atomicInc(disabled) >= 0:
|
||||
system.profilerHook = hook
|
||||
|
||||
when defined(system.TStackTrace):
|
||||
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_fprintf(f: C_TextFileStar, frmt: CString) {.
|
||||
importc: "fprintf", nodecl, varargs.}
|
||||
proc c_printf(frmt: CString) {.
|
||||
importc: "printf", nodecl, varargs.}
|
||||
|
||||
proc c_fopen(filename, mode: cstring): C_TextFileStar {.
|
||||
importc: "fopen", nodecl.}
|
||||
|
||||
Reference in New Issue
Block a user