ghkweon / dwscript

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

Assign property of RTTI-exposed class a instance #334

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
First, i really like dwscript, you do nice work!
I want to use dwscript for gameprogramming. For that reason I test different 
usage scenarios and plumb how viable dwscript is for my usecase.
While testing i found following problem:

I have published a class from delphi via dwsRTTIExposer. In the script I try to 
assign a property of classtype a instance. I expect the code will run without 
problems and AnotherObject (see example below) contains reference to AObject, 
but I get only a stack overflow (stops in TdwsRTTIInvoker.ValueFromIInfo). Btw 
I get same error if i try to create a second instance of TTestClass and assign 
that to AObject.AnotherObject. 

I use following code:

DelphiCode

TTestClass = class
  private
    FAnotherObject: TTestClass;
  public
    property AnotherObject: TTestClass read FAnotherObject write FAnotherObject;
    constructor Create();
  end;

ScriptCode

var AObject     : TTestClass;

begin

    AObject := TTestClass.Create;
    AObject.AnotherObject := AObject; //this line cause the stack overlow
end;

Original issue reported on code.google.com by dragonfl...@gmail.com on 7 Feb 2013 at 12:54