BaseTools/GenFds: Remove redundant GetRealFileLine call

The EvaluateConditional function should not call GetRealFileLine
because this is already done in Warning init and only needs to be
calculated in the event of a parsing failure. This fix stops
InsertedLines from being subtracted twice during error handling.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zurcher, Christopher J <christopher.j.zurcher@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Zurcher, Christopher J 2018-05-23 11:35:42 +08:00 committed by Yonghong Zhu
parent e95a0dfb46
commit 20274d2389
1 changed files with 3 additions and 4 deletions

View File

@ -914,7 +914,6 @@ class FdfParser:
return MacroDict
def __EvaluateConditional(self, Expression, Line, Op = None, Value = None):
FileLineTuple = GetRealFileLine(self.FileName, Line)
MacroPcdDict = self.__CollectMacroPcd()
if Op == 'eval':
try:
@ -939,12 +938,12 @@ class FdfParser:
" it must be defined in a [PcdsFixedAtBuild] or [PcdsFeatureFlag] section"
" of the DSC file (%s), and it is currently defined in this section:"
" %s, line #: %d." % (Excpt.Pcd, GlobalData.gPlatformOtherPcds['DSCFILE'], Info[0], Info[1]),
*FileLineTuple)
self.FileName, Line)
else:
raise Warning("PCD (%s) is not defined in DSC file (%s)" % (Excpt.Pcd, GlobalData.gPlatformOtherPcds['DSCFILE']),
*FileLineTuple)
self.FileName, Line)
else:
raise Warning(str(Excpt), *FileLineTuple)
raise Warning(str(Excpt), self.FileName, Line)
else:
if Expression.startswith('$(') and Expression[-1] == ')':
Expression = Expression[2:-1]