BaseTools: Optimizing code for function doesn't match

Optimizing code for function doesn't match name and comment

Fix https://bugzilla.tianocore.org/show_bug.cgi?id=924

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Yunhua Feng 2018-08-06 09:10:39 +08:00 committed by Yonghong Zhu
parent 4fea08b9c9
commit 7b85a1afa3
1 changed files with 14 additions and 16 deletions

View File

@ -530,26 +530,24 @@ class BuildRule:
# #
# @param LineIndex The line index of build rule text # @param LineIndex The line index of build rule text
# #
def ParseInputFile(self, LineIndex): def ParseInputFileSubSection(self, LineIndex):
FileList = [File.strip() for File in self.RuleContent[LineIndex].split(",")] FileList = [File.strip() for File in self.RuleContent[LineIndex].split(",")]
for ToolChainFamily in self._FamilyList: for ToolChainFamily in self._FamilyList:
InputFiles = self._RuleInfo[ToolChainFamily, self._State] if self._RuleInfo[ToolChainFamily, self._State] is None:
if InputFiles is None: self._RuleInfo[ToolChainFamily, self._State] = []
InputFiles = [] self._RuleInfo[ToolChainFamily, self._State].extend(FileList)
self._RuleInfo[ToolChainFamily, self._State] = InputFiles
InputFiles.extend(FileList)
## Parse <ExtraDependency> sub-section ## Parse <ExtraDependency> sub-section
## Parse <OutputFile> sub-section
## Parse <Command> sub-section
# #
# @param LineIndex The line index of build rule text # @param LineIndex The line index of build rule text
# #
def ParseCommon(self, LineIndex): def ParseCommonSubSection(self, LineIndex):
for ToolChainFamily in self._FamilyList: for ToolChainFamily in self._FamilyList:
Items = self._RuleInfo[ToolChainFamily, self._State] if self._RuleInfo[ToolChainFamily, self._State] is None:
if Items is None: self._RuleInfo[ToolChainFamily, self._State] = []
Items = [] self._RuleInfo[ToolChainFamily, self._State].append(self.RuleContent[LineIndex])
self._RuleInfo[ToolChainFamily, self._State] = Items
Items.append(self.RuleContent[LineIndex])
## Get a build rule via [] operator ## Get a build rule via [] operator
# #
@ -584,10 +582,10 @@ class BuildRule:
_Section : ParseSection, _Section : ParseSection,
_SubSectionHeader : ParseSubSectionHeader, _SubSectionHeader : ParseSubSectionHeader,
_SubSection : ParseSubSection, _SubSection : ParseSubSection,
_InputFile : ParseInputFile, _InputFile : ParseInputFileSubSection,
_OutputFile : ParseCommon, _OutputFile : ParseCommonSubSection,
_ExtraDependency : ParseCommon, _ExtraDependency : ParseCommonSubSection,
_Command : ParseCommon, _Command : ParseCommonSubSection,
_UnknownSection : SkipSection, _UnknownSection : SkipSection,
} }