BaseTools: Expression - remove redundant variable

Str is created and not needed.

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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Carsey, Jaben 2018-03-14 07:11:31 +08:00 committed by Yonghong Zhu
parent 7ccc9c954c
commit ae4cc2b084
1 changed files with 4 additions and 6 deletions

View File

@ -46,14 +46,13 @@ ERR_IN_OPERAND = 'Macro after IN operator can only be: $(FAMILY), $(ARC
# #
def SplitString(String): def SplitString(String):
# There might be escaped quote: "abc\"def\\\"ghi", 'abc\'def\\\'ghi' # There might be escaped quote: "abc\"def\\\"ghi", 'abc\'def\\\'ghi'
Str = String
RetList = [] RetList = []
InSingleQuote = False InSingleQuote = False
InDoubleQuote = False InDoubleQuote = False
Item = '' Item = ''
for i, ch in enumerate(Str): for i, ch in enumerate(String):
if ch == '"' and not InSingleQuote: if ch == '"' and not InSingleQuote:
if Str[i - 1] != '\\': if String[i - 1] != '\\':
InDoubleQuote = not InDoubleQuote InDoubleQuote = not InDoubleQuote
if not InDoubleQuote: if not InDoubleQuote:
Item += String[i] Item += String[i]
@ -64,7 +63,7 @@ def SplitString(String):
RetList.append(Item) RetList.append(Item)
Item = '' Item = ''
elif ch == "'" and not InDoubleQuote: elif ch == "'" and not InDoubleQuote:
if Str[i - 1] != '\\': if String[i - 1] != '\\':
InSingleQuote = not InSingleQuote InSingleQuote = not InSingleQuote
if not InSingleQuote: if not InSingleQuote:
Item += String[i] Item += String[i]
@ -84,13 +83,12 @@ def SplitString(String):
def SplitPcdValueString(String): def SplitPcdValueString(String):
# There might be escaped comma in GUID() or DEVICE_PATH() or " " # There might be escaped comma in GUID() or DEVICE_PATH() or " "
# or ' ' or L' ' or L" " # or ' ' or L' ' or L" "
Str = String
RetList = [] RetList = []
InParenthesis = 0 InParenthesis = 0
InSingleQuote = False InSingleQuote = False
InDoubleQuote = False InDoubleQuote = False
Item = '' Item = ''
for i, ch in enumerate(Str): for i, ch in enumerate(String):
if ch == '(': if ch == '(':
InParenthesis += 1 InParenthesis += 1
if ch == ')': if ch == ')':