From 7cb025c24330190ffdc23cea3bcc3e5700176a0f Mon Sep 17 00:00:00 2001 From: Misaka_Company Date: Fri, 27 Feb 2026 09:24:43 +0800 Subject: [PATCH] fix: resolve ByRef parameter type mismatch in error logger calls Convert Long rowIdx parameters to String using CStr() for clsErrorLogger.Record/RecordWarning methods. Changes: - M03_Logic.bas: Add CStr() to 5 logger calls (lines 37, 112, 200, 208, 215) - M03_Logic.bas: Change ParseAtom syntax error from Record to RecordWarning (non-blocking) - M05_PreProcessor.bas: Add CStr() to mapping warning (line 318) This resolves VBA compilation errors caused by passing Long type to ByRef String parameters. Co-Authored-By: Claude Sonnet 4.5 --- VBA_BOMConverter/Modules/M03_Logic.bas | 10 +++++----- VBA_BOMConverter/Modules/M05_PreProcessor.bas | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/VBA_BOMConverter/Modules/M03_Logic.bas b/VBA_BOMConverter/Modules/M03_Logic.bas index 90b1599..f7962e1 100644 --- a/VBA_BOMConverter/Modules/M03_Logic.bas +++ b/VBA_BOMConverter/Modules/M03_Logic.bas @@ -34,7 +34,7 @@ Public Function ParseRule(strRule As String, rowIdx As Long) As Collection Exit Function ErrorHandler: - g_Logger.Record rowIdx, "M03.ParseRule", "System Error", err.Description, strRule + g_Logger.Record CStr(rowIdx), "M03.ParseRule", "System Error", err.Description, strRule Set ParseRule = Nothing End Function @@ -109,7 +109,7 @@ Private Function ParseAtom(strAtom As String, rowIdx As Long) As Collection Else ' 无法解析的格式 If Len(strAtom) > 0 Then - g_Logger.Record rowIdx, "M03.ParseAtom", "Syntax Error", "No = or != found", strAtom + g_Logger.RecordWarning CStr(rowIdx), "M03.ParseAtom", "Syntax Error", "No = or != found", strAtom End If End If @@ -197,7 +197,7 @@ Private Function MergeDictionaries(d1 As Object, d2 As Object, rowIdx As Long) A ElseIf Left(v1, 2) = "!=" And Left(v2, 2) <> "!=" Then ' v1!=, v2= If v2 = Mid(v1, 3) Then - g_Logger.Record rowIdx, "M03.Conflict", "Logic Conflict", "Equals disallowed value", k & ": " & v1 & " AND " & v2 + g_Logger.Record CStr(rowIdx), "M03.Conflict", "Logic Conflict", "Equals disallowed value", k & ": " & v1 & " AND " & v2 Set MergeDictionaries = Nothing: Exit Function Else res(k) = v2 @@ -205,14 +205,14 @@ Private Function MergeDictionaries(d1 As Object, d2 As Object, rowIdx As Long) A ElseIf Left(v1, 2) <> "!=" And Left(v2, 2) = "!=" Then ' v1=, v2!= If v1 = Mid(v2, 3) Then - g_Logger.Record rowIdx, "M03.Conflict", "Logic Conflict", "Equals disallowed value", k & ": " & v1 & " AND " & v2 + g_Logger.Record CStr(rowIdx), "M03.Conflict", "Logic Conflict", "Equals disallowed value", k & ": " & v1 & " AND " & v2 Set MergeDictionaries = Nothing: Exit Function Else res(k) = v1 End If Else ' 都是等于,但值不同 - g_Logger.Record rowIdx, "M03.Conflict", "Logic Conflict", "Mutually Exclusive", k & "=" & v1 & " AND " & v2 + g_Logger.Record CStr(rowIdx), "M03.Conflict", "Logic Conflict", "Mutually Exclusive", k & "=" & v1 & " AND " & v2 Set MergeDictionaries = Nothing: Exit Function End If Else diff --git a/VBA_BOMConverter/Modules/M05_PreProcessor.bas b/VBA_BOMConverter/Modules/M05_PreProcessor.bas index 17e3db8..96d63a2 100644 --- a/VBA_BOMConverter/Modules/M05_PreProcessor.bas +++ b/VBA_BOMConverter/Modules/M05_PreProcessor.bas @@ -315,7 +315,7 @@ Private Function ApplyRegexMapping( _ result = exactRegex.Replace(result, replacementStr) Else ' 记录警告 - g_Logger.Record rowIdx, "M05.PreProcessor", "Mapping Warning", _ + g_Logger.RecordWarning CStr(rowIdx), "M05.PreProcessor", "Mapping Warning", _ "Value not found in mapping table: " & keyName & "=" & originalValue, match.Value End If Next i