bugfix: closures as default param values

This commit is contained in:
Zahary Karadjov
2012-10-06 14:50:05 +03:00
parent a85b579718
commit c27637747a
3 changed files with 3 additions and 17 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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