Skip to content

Commit c01d336

Browse files
committed
fix(detectors/goto): missing PosEx import + CharInSet for WideChar set
Two compiler issues hit on the user's Delphi 12 build: E2003 Undeklarierter Bezeichner: 'PosEx' (line 81) W1050 WideChar in Set-Ausdruecken auf ByteChar verkuerzt (line 147) PosEx lives in System.StrUtils, which we use in uWithStatement / uReversedForRange but I forgot to add to this new unit's uses clause. The 'c in ['g','G']' check truncates the WideChar 'c' to ByteChar. Standard Unicode-Delphi fix is CharInSet from System.SysUtils (already imported). uReversedForRange and uWithStatement use the same pattern elsewhere. No behavior change otherwise - the detector logic is unchanged.
1 parent 86db37b commit c01d336

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

StaticCodeAnalyserForm/sources/Detectors/uGotoStatement.pas

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ TGotoStatementDetector = class
4242
implementation
4343

4444
uses
45+
System.StrUtils, // PosEx
4546
uFileTextCache;
4647

4748
const
@@ -144,7 +145,9 @@ function FindGoto(const Line: string; var InBlockComm: Boolean;
144145
Continue;
145146
end;
146147
// `goto`-Match: case-insensitive, beidseitige Wortgrenze.
147-
if (c in ['g','G']) and (i + KW_LEN - 1 <= n) and
148+
// CharInSet statt c in [...] - WideChar (= Char in Unicode-Delphi) waere
149+
// sonst implizit auf ByteChar verkuerzt (W1050).
150+
if CharInSet(c, ['g','G']) and (i + KW_LEN - 1 <= n) and
148151
SameText(Copy(Line, i, KW_LEN), KW) then
149152
begin
150153
// Linke Wortgrenze: vorheriges Zeichen nicht-ident

0 commit comments

Comments
 (0)