Reorganize so that warningPass is always set at least once when constfold is set.

This commit is contained in:
Sei Lisa 2015-08-19 05:41:21 +02:00
parent 8a8e255239
commit f8a6d3d86c

View file

@ -81,16 +81,17 @@ class optimizer(foldconst, renamer, deadcode):
self.globalmode = False self.globalmode = False
if self.constfold:
self.FoldScript(warningpass=False)
if self.dcr: if self.dcr:
if self.constfold:
self.FoldScript(warningpass=False)
self.RemoveDeadCode() self.RemoveDeadCode()
# Make another fold pass, since RemoveDeadCode can embed expressions # Make another fold pass, since RemoveDeadCode can embed expressions
# into other expressions and generate unoptimized code. # into other expressions and generate unoptimized code.
if self.constfold: # Or make the first pass here if DCR is disabled.
self.FoldScript(warningpass=True) if self.constfold:
self.FoldScript(warningpass=True)
if self.shrinknames: if self.shrinknames:
self.ShrinkNames() self.ShrinkNames()