renan-guimaraes / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

Properties fail to retrieve values from abstract methods #365

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm having an issue where properties in classes seem to fail to retrieve values 
from an abstract method which is implemented in a subclass.

I've included a sample project to demonstrate the issue. It defines the 
following structure:

TTestParent = class abstract
protected
  function GetProp(Pt: TPoint): Integer; virtual; abstract;
public
  property Prop[Pt: TPoint]: Integer read GetProp;
end;

TTest = class(TTestParent)
protected
  function GetProp(Pt: TPoint): Integer; override;
end;

The script being executed is:

var Pt: TPoint;
Pt.X := 5; Pt.Y := 8;

var Obj = TTest.Create;
ShowMessage(Format('%d', [Obj.Prop[Pt]]));

The GetProp function should add the coordinate values of the point and return 
it as an integer, so the message should show 13, but it shows 0 instead.

Original issue reported on code.google.com by frederic...@gmail.com on 10 Apr 2013 at 12:38

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Further details:
- issue only applies for classes defined manually in the sample
- issue only applies for property (explicity GetProp call works)
- issue doesn't apply when class & records defined via TdwsUnit

Original comment by zar...@gmail.com on 11 Jun 2013 at 8:14

GoogleCodeExporter commented 9 years ago
Couldn't find where the issue in the Unit1 RegisterSymbols was, it's probably 
something simple or missing...
Registering through a TdwsUnit works, as does declaring the classes & methods 
in script code.

Original comment by zar...@gmail.com on 11 Jun 2013 at 8:35