Skip to content

Commit 17f4bff

Browse files
committed
Ignore indexed properties when stringifying + update test
1 parent 55eca20 commit 17f4bff

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Source/dwsJSONScript.pas

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,9 @@ class procedure JSONScript.StringifyComposite(exec : TdwsExecution;
334334
for i:=0 to compSym.Members.Count-1 do begin
335335
sym:=compSym.Members[i];
336336
if sym.ClassType=TPropertySymbol then begin
337-
propSym:=TPropertySymbol(sym);
337+
propSym := TPropertySymbol(sym);
338+
if propSym.HasArrayIndices then
339+
continue;
338340
if (propSym.Visibility>=cvPublished) and (propSym.ReadSym<>nil) then
339341
sym:=propSym.ReadSym
340342
else continue;

Test/JSONConnectorPass/stringify_class_getter.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ TTest = class
2222
property Num : Float read (3.14);
2323
property Arr : array of String read (StrSplit('abc,de', ','));
2424
property Sub : TSubTest;
25+
property Indexed[i : Integer] : String read (i.ToString);
2526
end;
2627

2728
var i := new TTest;

0 commit comments

Comments
 (0)