From a1b623b938b8aa2a019c11f7c07eca7504a03749 Mon Sep 17 00:00:00 2001 From: Doug Flick Date: Thu, 3 Apr 2025 13:32:48 -0700 Subject: BaseTools:Expression.py Size used before Init The following example fails to be parsed correctly due to Size being used in the outer scope but initialized in the inner scope ``` gPlatformPkgTokenSpaceGuid.PcdSecureBootDbxBinaryFile|{} ``` Problematic code: ```python for Item in NewPcdValueList: Size = 0 # .... if Size > 0: PcdValue = '{' + ', '.join(AllPcdValueList) + '}' ```` Signed-off-by: Doug Flick --- BaseTools/Source/Python/Common/Expression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'BaseTools/Source/Python/Common/Expression.py') diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index 9d9cb0c929..4860ace11a 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -969,8 +969,8 @@ class ValueExpressionEx(ValueExpression): NewPcdValueList.append(Item) AllPcdValueList = [] + Size = 0 for Item in NewPcdValueList: - Size = 0 ValueStr = '' TokenSpaceGuidName = '' if Item.startswith(TAB_GUID) and Item.endswith(')'): -- cgit v1.2.3