Skip to content

Parser should accept stdcall in anonymous method declaration #338

@UweRaabe

Description

@UweRaabe

These are examples from the Delphi standard library.

FMX.WebBrowser.Win.pas

procedure TEdgeWebBrowserPresentation.EvaluateJavascript(const AJavascript: string; const AValueCallback: TJavaScriptResultCallback);
begin
  if FWebView <> nil then
  begin
    FWebView.ExecuteScript(PWideChar(AJavascript),
      Callback<HResult, PWideChar>.CreateAs<ICoreWebView2ExecuteScriptCompletedHandler>(
        function(ErrorCode: HResult; ResultObjectAsJson: PWideChar): HResult stdcall
        var
          JavascriptResult: string;
        begin
          Result := S_OK;
          JavascriptResult := string(ResultObjectAsJson);
          DoJavascriptEvaluated(ErrorCode, JavascriptResult);
          if Assigned(AValueCallback) then
            AValueCallback(JavascriptResult);
        end
      )
    );
  end;
end;

Winapi.EdgeUtils.pas:

type
  TCbStdProc1<T1> = reference to function(const P1: T1): HResult stdcall;
  TCbStdProc2<T1, T2> = reference to function(const P1: T1; const P2: T2): HResult stdcall;
  TCbStdProc3<T1, T2> = reference to function(P1: T1; P2: T2): HResult stdcall;
  TCbStdProc4<T1, T2> = reference to function(P1: T1; const P2: T2): HResult stdcall;
  TCbStdMethod1<T1> = function(P1: T1): HResult of object stdcall;
  TCbStdMethod2<T1, T2> = function(P1: T1; const P2: T2): HResult of object stdcall;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions