mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-25 16:53:59 +00:00
@@ -328,7 +328,8 @@ proc initLocalVar(p: BProc, v: PSym, immediateAsgn: bool) =
|
||||
proc getTemp(p: BProc, t: PType, result: var TLoc; needsInit=false) =
|
||||
inc(p.labels)
|
||||
result.r = "LOC" & rope(p.labels)
|
||||
linefmt(p, cpsLocals, "$1 $2;$n", getTypeDesc(p.module, t), result.r)
|
||||
addf(p.blocks[0].sections[cpsLocals],
|
||||
"$1 $2;$n", [getTypeDesc(p.module, t), result.r])
|
||||
result.k = locTemp
|
||||
#result.a = - 1
|
||||
result.t = t
|
||||
|
||||
@@ -15,7 +15,7 @@ import
|
||||
from msgs import TLineInfo
|
||||
|
||||
type
|
||||
TLabel* = Rope # for the C generator a label is just a rope
|
||||
TLabel* = Rope # for the C generator a label is just a rope
|
||||
TCFileSection* = enum # the sections a generated C file consists of
|
||||
cfsMergeInfo, # section containing merge information
|
||||
cfsHeaders, # section for C include file headers
|
||||
@@ -89,7 +89,7 @@ type
|
||||
# requires 'T x = T()' to become 'T x; x = T()'
|
||||
# (yes, C++ is weird like that)
|
||||
gcFrameId*: Natural # for the GC stack marking
|
||||
gcFrameType*: Rope # the struct {} we put the GC markers into
|
||||
gcFrameType*: Rope # the struct {} we put the GC markers into
|
||||
|
||||
TTypeSeq* = seq[PType]
|
||||
|
||||
@@ -111,10 +111,10 @@ type
|
||||
tmpBase*: Rope # base for temp identifier generation
|
||||
typeCache*: TIdTable # cache the generated types
|
||||
forwTypeCache*: TIdTable # cache for forward declarations of types
|
||||
declaredThings*: IntSet # things we have declared in this .c file
|
||||
declaredProtos*: IntSet # prototypes we have declared in this .c file
|
||||
declaredThings*: IntSet # things we have declared in this .c file
|
||||
declaredProtos*: IntSet # prototypes we have declared in this .c file
|
||||
headerFiles*: TLinkedList # needed headers to include
|
||||
typeInfoMarker*: IntSet # needed for generating type information
|
||||
typeInfoMarker*: IntSet # needed for generating type information
|
||||
initProc*: BProc # code for init procedure
|
||||
postInitProc*: BProc # code to be executed after the init proc
|
||||
preInitProc*: BProc # code executed before the init proc
|
||||
|
||||
20
tests/ccgbugs/tescaping_temps.nim
Normal file
20
tests/ccgbugs/tescaping_temps.nim
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
# bug #4505
|
||||
|
||||
proc f(t: tuple[]) = discard
|
||||
f((block: ()))
|
||||
|
||||
# bug #4230
|
||||
# If we make `test` function return nothing - the bug disappears
|
||||
proc test(dothejob: proc()): int {.discardable.} =
|
||||
dothejob()
|
||||
|
||||
test proc() =
|
||||
let f = 15
|
||||
if f > 10:
|
||||
test proc() = discard
|
||||
# If we remove elif branch of the condition - the bug disappears
|
||||
elif f < 3:
|
||||
test proc() = discard
|
||||
else:
|
||||
test proc() = discard
|
||||
Reference in New Issue
Block a user