mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 21:40:32 +00:00
bugfix: closures as default param values
This commit is contained in:
@@ -778,11 +778,6 @@ proc genPragma(p: BProc, n: PNode) =
|
||||
genEmit(p, it)
|
||||
of wBreakpoint:
|
||||
genBreakPoint(p, it)
|
||||
of wDeadCodeElim:
|
||||
if not (optDeadCodeElim in gGlobalOptions):
|
||||
# we need to keep track of ``deadCodeElim`` pragma
|
||||
if (sfDeadCodeElim in p.module.module.flags):
|
||||
addPendingModule(p.module)
|
||||
of wWatchpoint:
|
||||
genWatchpoint(p, it)
|
||||
else: nil
|
||||
|
||||
@@ -38,17 +38,11 @@ proc addForwardedProc(m: BModule, prc: PSym) =
|
||||
m.forwardedProcs.add(prc)
|
||||
inc(gForwardedProcsCounter)
|
||||
|
||||
proc addPendingModule(m: BModule) =
|
||||
for i in countup(0, high(gPendingModules)):
|
||||
if gPendingModules[i] == m:
|
||||
InternalError("module already pending: " & m.module.name.s)
|
||||
gPendingModules.add(m)
|
||||
|
||||
proc findPendingModule(m: BModule, s: PSym): BModule =
|
||||
var ms = getModule(s)
|
||||
if ms.id == m.module.id: return m
|
||||
for i in countup(0, high(gPendingModules)):
|
||||
result = gPendingModules[i]
|
||||
for i in countup(0, high(gModules)):
|
||||
result = gModules[i]
|
||||
if result.module.id == ms.id: return
|
||||
# else we found no pending module: This can happen for procs that are in
|
||||
# a module that is already closed. This is fine, don't generate code for
|
||||
@@ -1021,8 +1015,7 @@ proc newModule(module: PSym, filename: string): BModule =
|
||||
if (optDeadCodeElim in gGlobalOptions):
|
||||
if (sfDeadCodeElim in module.flags):
|
||||
InternalError("added pending module twice: " & filename)
|
||||
addPendingModule(result)
|
||||
|
||||
|
||||
proc myOpen(module: PSym, filename: string): PPassContext =
|
||||
result = newModule(module, filename)
|
||||
if optGenIndex in gGlobalOptions and generatedHeader == nil:
|
||||
|
||||
@@ -115,8 +115,6 @@ type
|
||||
var
|
||||
mainModProcs*, mainModInit*, mainDatInit*: PRope # parts of the main module
|
||||
gMapping*: PRope # the generated mapping file (if requested)
|
||||
gPendingModules*: seq[BModule] = @[] # list of modules that are not
|
||||
# finished with code generation
|
||||
gModules*: seq[BModule] = @[] # list of all compiled modules
|
||||
gForwardedProcsCounter*: int = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user