]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/GenFds: remove MacroDict parameter
authorJaben Carsey <jaben.carsey@intel.com>
Tue, 23 Oct 2018 17:29:22 +0000 (01:29 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Thu, 25 Oct 2018 12:16:31 +0000 (20:16 +0800)
The MacroDict parameter goes around in circles through 4 functions without use.
1. GetSectionData calls into GetLeafSection, otherwise doesn?t use MacroDict
2. GetLeafSection calls into GetFileStatement, otherwise doesn?t use MacroDict
3. GetFileStatement calls into GetFilePart, otherwise doesn?t use MacroDict
4. GetFilePart calls into GetSectionData, otherwise doesn?t use MacroDict
Go to 1 and repeat forever.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/GenFds/FdfParser.py

index 9e806de0d294a6dea3a3cfc61eb576b7876d766b..f8f559aecffd0932a4116f6599667ad6a8b4ba42 100644 (file)
@@ -2113,12 +2113,12 @@ class FdfParser:
         if FvObj.FvNameString == 'TRUE' and not FvObj.FvNameGuid:\r
             raise Warning("FvNameString found but FvNameGuid was not found", self.FileName, self.CurrentLineNumber)\r
 \r
-        self._GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())\r
-        self._GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())\r
+        self._GetAprioriSection(FvObj)\r
+        self._GetAprioriSection(FvObj)\r
 \r
         while True:\r
             isInf = self._GetInfStatement(FvObj)\r
-            isFile = self._GetFileStatement(FvObj, MacroDict = FvObj.DefineVarDict.copy())\r
+            isFile = self._GetFileStatement(FvObj)\r
             if not isInf and not isFile:\r
                 break\r
 \r
@@ -2353,11 +2353,10 @@ class FdfParser:
     #\r
     #   @param  self        The object pointer\r
     #   @param  FvObj       for whom apriori is got\r
-    #   @param  MacroDict   dictionary used to replace macro\r
     #   @retval True        Successfully find apriori statement\r
     #   @retval False       Not able to find apriori statement\r
     #\r
-    def _GetAprioriSection(self, FvObj, MacroDict = {}):\r
+    def _GetAprioriSection(self, FvObj):\r
         if not self._IsKeyword("APRIORI"):\r
             return False\r
 \r
@@ -2372,7 +2371,6 @@ class FdfParser:
         AprSectionObj.AprioriType = AprType\r
 \r
         self._GetDefineStatements(AprSectionObj)\r
-        MacroDict.update(AprSectionObj.DefineVarDict)\r
 \r
         while True:\r
             IsInf = self._GetInfStatement(AprSectionObj)\r
@@ -2526,11 +2524,10 @@ class FdfParser:
     #\r
     #   @param  self        The object pointer\r
     #   @param  Obj         for whom FILE statement is got\r
-    #   @param  MacroDict   dictionary used to replace macro\r
     #   @retval True        Successfully find FILE statement\r
     #   @retval False       Not able to find FILE statement\r
     #\r
-    def _GetFileStatement(self, Obj, ForCapsule = False, MacroDict = {}):\r
+    def _GetFileStatement(self, Obj, ForCapsule = False):\r
         if not self._IsKeyword("FILE"):\r
             return False\r
 \r
@@ -2561,7 +2558,7 @@ class FdfParser:
 \r
         FfsFileObj.NameGuid = self._Token\r
 \r
-        self._GetFilePart(FfsFileObj, MacroDict.copy())\r
+        self._GetFilePart(FfsFileObj)\r
 \r
         if ForCapsule:\r
             capsuleFfs = CapsuleFfs()\r
@@ -2608,9 +2605,8 @@ class FdfParser:
     #\r
     #   @param  self        The object pointer\r
     #   @param  FfsFileObj   for whom component is got\r
-    #   @param  MacroDict   dictionary used to replace macro\r
     #\r
-    def _GetFilePart(self, FfsFileObj, MacroDict = {}):\r
+    def _GetFilePart(self, FfsFileObj):\r
         self._GetFileOpts(FfsFileObj)\r
 \r
         if not self._IsToken("{"):\r
@@ -2645,11 +2641,11 @@ class FdfParser:
 \r
         elif self._Token in {TAB_DEFINE, "APRIORI", "SECTION"}:\r
             self._UndoToken()\r
-            self._GetSectionData(FfsFileObj, MacroDict)\r
+            self._GetSectionData(FfsFileObj)\r
 \r
         elif hasattr(FfsFileObj, 'FvFileType') and FfsFileObj.FvFileType == 'RAW':\r
             self._UndoToken()\r
-            self._GetRAWData(FfsFileObj, MacroDict)\r
+            self._GetRAWData(FfsFileObj)\r
 \r
         else:\r
             FfsFileObj.CurrentLineNum = self.CurrentLineNumber\r
@@ -2666,9 +2662,8 @@ class FdfParser:
     #\r
     #   @param  self         The object pointer\r
     #   @param  FfsFileObj   for whom section is got\r
-    #   @param  MacroDict    dictionary used to replace macro\r
     #\r
-    def _GetRAWData(self, FfsFileObj, MacroDict = {}):\r
+    def _GetRAWData(self, FfsFileObj):\r
         FfsFileObj.FileName = []\r
         FfsFileObj.SubAlignment = []\r
         while True:\r
@@ -2756,26 +2751,18 @@ class FdfParser:
 \r
         return False\r
 \r
-    ## _GetFilePart() method\r
+    ## _GetSectionData() method\r
     #\r
     #   Get section data for FILE statement\r
     #\r
     #   @param  self        The object pointer\r
     #   @param  FfsFileObj   for whom section is got\r
-    #   @param  MacroDict   dictionary used to replace macro\r
     #\r
-    def _GetSectionData(self, FfsFileObj, MacroDict = {}):\r
-        Dict = {}\r
-        Dict.update(MacroDict)\r
-\r
+    def _GetSectionData(self, FfsFileObj):\r
         self._GetDefineStatements(FfsFileObj)\r
 \r
-        Dict.update(FfsFileObj.DefineVarDict)\r
-        self._GetAprioriSection(FfsFileObj, Dict.copy())\r
-        self._GetAprioriSection(FfsFileObj, Dict.copy())\r
-\r
         while True:\r
-            IsLeafSection = self._GetLeafSection(FfsFileObj, Dict)\r
+            IsLeafSection = self._GetLeafSection(FfsFileObj)\r
             IsEncapSection = self._GetEncapsulationSec(FfsFileObj)\r
             if not IsLeafSection and not IsEncapSection:\r
                 break\r
@@ -2786,11 +2773,10 @@ class FdfParser:
     #\r
     #   @param  self        The object pointer\r
     #   @param  Obj         for whom leaf section is got\r
-    #   @param  MacroDict   dictionary used to replace macro\r
     #   @retval True        Successfully find section statement\r
     #   @retval False       Not able to find section statement\r
     #\r
-    def _GetLeafSection(self, Obj, MacroDict = {}):\r
+    def _GetLeafSection(self, Obj):\r
         OldPos = self.GetFileBufferPos()\r
 \r
         if not self._IsKeyword("SECTION"):\r
@@ -2861,17 +2847,15 @@ class FdfParser:
                 FvObj = FV()\r
                 FvObj.UiFvName = FvName.upper()\r
                 self._GetDefineStatements(FvObj)\r
-                MacroDict.update(FvObj.DefineVarDict)\r
+\r
                 self._GetBlockStatement(FvObj)\r
                 self._GetSetStatements(FvObj)\r
                 self._GetFvAlignment(FvObj)\r
                 self._GetFvAttributes(FvObj)\r
-                self._GetAprioriSection(FvObj, MacroDict.copy())\r
-                self._GetAprioriSection(FvObj, MacroDict.copy())\r
 \r
                 while True:\r
                     IsInf = self._GetInfStatement(FvObj)\r
-                    IsFile = self._GetFileStatement(FvObj, MacroDict.copy())\r
+                    IsFile = self._GetFileStatement(FvObj)\r
                     if not IsInf and not IsFile:\r
                         break\r
 \r