diff --git a/Source/uPSCompiler.pas b/Source/uPSCompiler.pas index f13307e2..6a915dc3 100644 --- a/Source/uPSCompiler.pas +++ b/Source/uPSCompiler.pas @@ -12593,8 +12593,14 @@ function TPSPascalCompiler.Compile(const s: tbtString): Boolean; except on e: Exception do begin - MakeError('', ecCustomError, tbtstring(e.Message)); - {$IFNDEF PS_USESSUPPORT} + MakeError('', ecCustomError, tbtstring(e.Message)); // still attributed to the used unit + {$IFDEF PS_USESSUPPORT} + // restore what the regular failure path above restores: a stale + // fModule survives Cleanup and makes every following Compile of + // this instance fail with a bogus cross-reference error + FParser:=ParserPos; + fModule:=OldFileName; + {$ELSE} FUses.Free; {$ENDIF} Result := False;