[FixInsight Warning] dwsExprs.pas(3322): W504 Missing INHERITED call in destructor

Issue #58 invalid
IlyaS created an issue

dwsExprs.pas Line 3322: W504 Missing INHERITED call in destructor

destructor TdwsProcedure.Destroy;
begin
   FRootTable.Free;
   FExpr.Free;
   FInitExpr.Free;
   FPreConditions.Free;
   FPostConditions.Free;
end;

inherited call is missing, TdwsProgram.Destroy will not fire and free its objects.

Comments (3)

  1. Eric Grange repo owner

    TdwsProcedures should not free all the objects as TdwsProgram does, as it does not own all of them.

  2. IlyaS reporter

    OK. I guess that it is intentional that if TdwsProcedures constructor doesn't call inherited constructor, then it shouldn't call inherited destructor.

  3. Eric Grange repo owner

    This is very much of an extreme corner case though, I would not make it a general rule. It could be refactored away by extending the class hierarchy, but this is not done here to allow replacing some "is" class checks by ".ClassType=" for performance purposes... Hence the "sealed" classes... So quite uncommon usage case :)

  4. Log in to comment