pas2js source used is latest trunk pulled 8/22/2020Trying to implement some classes with pas2js and am noticing an issue with virtual methods. my example is
parent class defined with a virtual method with no implementation
TNyxElementBaseImpl
...
//declaration
procedure DoUpdateHeight; virtual;
...
//implementation
procedure TNyxElementBaseImpl.DoUpdateHeight;
begin
//nothing in base
end
this parent class, makes a call to the virtual method in this other method,
procedure TNyxElementBaseImpl.NotifyHeight(const AType: TPropertyUpdateType;
const ASize: INyxSize; const AProperty: TSizeProperty);
begin
if AType = puAfterUpdate then
DoUpdateHeight; // <---------right here
end;
now, I have a child class which overrides the DoUpdateHeight method here
TNyxElementBrowserImpl = class(TNyxElementBaseImpl, INyxElementBrowser)
...
//interface
procedure DoUpdateHeight; override;
...
//impl
procedure TNyxElementBrowserImpl.DoUpdateHeight;
begin
inherited DoUpdateHeight; // <------- we never get here in the debugger
UpdateSize;
end;
What
should be happening is the
TNyxElementBrowserImpl.DoUpdateHeight should be used, not the parent's empty stubbed method... but when debugging, the parent method is triggered rather than the overridden child.
Has anyone run into this or spot something that I may be doing improperly?
any help would be appreciated.
for reference, the full source for the examples are found at these lines,
parent:
https://github.com/mr-highball/nyx/blob/master/src/nyx.types.pas#L262https://github.com/mr-highball/nyx/blob/master/src/nyx.types.pas#L1726child:
https://github.com/mr-highball/nyx/blob/master/src/nyx.element.browser.pas#L72https://github.com/mr-highball/nyx/blob/master/src/nyx.element.browser.pas#L149