Skip to content

Parser should accept stdcall in anonymous method declaration #338

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;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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