public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Remove the redundant if statement
@ 2018-08-10  6:48 Yonghong Zhu
  2018-08-15 15:54 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2018-08-10  6:48 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

after analysis the BuildOptionValue function, we found the if statement
IsFieldValueAnArray is redundant because ValueExpressionEx will handle
it.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/Common/Expression.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py
index ccc7368..0091e47 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -15,11 +15,11 @@
 from __future__ import print_function
 from __future__ import absolute_import
 from Common.GlobalData import *
 from CommonDataClass.Exceptions import BadExpression
 from CommonDataClass.Exceptions import WrnExpression
-from .Misc import GuidStringToGuidStructureString, ParseFieldValue, IsFieldValueAnArray
+from .Misc import GuidStringToGuidStructureString, ParseFieldValue
 import Common.EdkLogger as EdkLogger
 import copy
 from Common.DataType import *
 import sys
 
@@ -136,15 +136,15 @@ def BuildOptionValue(PcdValue, GuidDict):
         InputValue = PcdValue
     elif PcdValue.startswith('L'):
         InputValue = 'L"' + PcdValue[1:] + '"'
     else:
         InputValue = PcdValue
-    if IsFieldValueAnArray(InputValue):
-        try:
-            PcdValue = ValueExpressionEx(InputValue, TAB_VOID, GuidDict)(True)
-        except:
-            pass
+    try:
+        PcdValue = ValueExpressionEx(InputValue, TAB_VOID, GuidDict)(True)
+    except:
+        pass
+
     return PcdValue
 
 ## ReplaceExprMacro
 #
 def ReplaceExprMacro(String, Macros, ExceptionList = None):
-- 
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-15 15:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-10  6:48 [Patch] BaseTools: Remove the redundant if statement Yonghong Zhu
2018-08-15 15:54 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox