Skip to content

Problems with anonymous methods and the unit JS

If I add the unit JS to a project, it seems that it enables generally enables the objfpc mode.

Here is a test project, that compiles

program Project1;

//uses
//  JS;

type
  TRouteProc = reference to procedure; async;

  TFoo = class
  public
   class procedure AddRoute(Proc: TRouteProc); overload;
  end;

{ TFoo }

class procedure TFoo.AddRoute(Proc: TRouteProc);
begin
end;

procedure Test; async;
begin
end;

begin
  TFoo.AddRoute(Test);
end.

If I add the unit JS to the uses clause, the project does not compile any longer. It seems that then the objfpc mode is enabled.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information