renan-guimaraes / dwscript

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

DWS compiler does not recognize function pointers as constants #385

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
function Test(value: integer): boolean;
begin
   result := true;
end;

type
   TBoolFunc = function(value: integer): boolean;

   TMyRecord = record
      name: string;
      func: TBoolFunc;
   end;

const TEST_REC: TMyRecord = (name: 'test'; func: @Test);

-------------

Expected: This should work.
Observed: The compiler doesn't accept @Test as a constant, and without the 
@ it expects parameters.

Original issue reported on code.google.com by masonwhe...@gmail.com on 6 May 2013 at 3:29

GoogleCodeExporter commented 9 years ago
Yes, constant pointers to functions aren't supported yet.

Original comment by zar...@gmail.com on 6 May 2013 at 5:35

GoogleCodeExporter commented 9 years ago
Here's a first draft of a patch to fix this issue.

Original comment by masonwhe...@gmail.com on 4 Sep 2013 at 3:12

Attachments: