[edk2] [PATCH v1 3/5] BaseTools: Expression - change from series of if to elif

Jaben Carsey posted 5 patches 6 years, 9 months ago
[edk2] [PATCH v1 3/5] BaseTools: Expression - change from series of if to elif
Posted by Jaben Carsey 6 years, 9 months ago
since the first character of the string cannot be found by multiple if
statements, use elif to optomize the behavior.

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

diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py
index c7037dd0d00b..85c1ce9bbc09 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -93,18 +93,18 @@ def SplitPcdValueString(String):
     for i, ch in enumerate(String):
         if ch == '(':
             InParenthesis += 1
-        if ch == ')':
+        elif ch == ')':
             if InParenthesis:
                 InParenthesis -= 1
             else:
                 raise BadExpression(ERR_STRING_TOKEN % Item)
-        if ch == '"' and not InSingleQuote:
+        elif ch == '"' and not InSingleQuote:
             if String[i-1] != '\\':
                 InDoubleQuote = not InDoubleQuote
-        if ch == "'" and not InDoubleQuote:
+        elif ch == "'" and not InDoubleQuote:
             if String[i-1] != '\\':
                 InSingleQuote = not InSingleQuote
-        if ch == ',':
+        elif ch == ',':
             if InParenthesis or InSingleQuote or InDoubleQuote:
                 Item += String[i]
                 continue
-- 
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel