Skip to content

Support calling conventions on anonymous / reference-to-function types#343

Open
civilian7 wants to merge 1 commit into
RomanYankovsky:masterfrom
civilian7:pr-anon-calling-convention
Open

Support calling conventions on anonymous / reference-to-function types#343
civilian7 wants to merge 1 commit into
RomanYankovsky:masterfrom
civilian7:pr-anon-calling-convention

Conversation

@civilian7

Copy link
Copy Markdown

Summary

AnonymousMethod / AnonymousMethodType did not consume a trailing calling-convention directive after the result type. The Delphi RTL uses this on reference to function types and inline anonymous methods:

  • Winapi.EdgeUtils.pas: TCb<T> = reference to function(const P1: T): HResult stdcall;
  • Vcl.Edge.pas: inline function(...): HResult stdcall begin ... end;

These currently fail with SemiColon / Begin expected found stdcall.

Change

Both AnonymousMethod and AnonymousMethodType now consume trailing calling-convention directives (cdecl / pascal / register / safecall / stdcall) via the existing ProceduralDirective rule.

Test

Added Test/Snippets/anonymousmethodcallingconvention.pas exercising reference to function(...): HRESULT stdcall and reference to procedure(...) cdecl.

Verified by parsing the full Delphi 13.1 RTL/VCL source: Winapi.EdgeUtils, Vcl.Edge, and FMX.WebBrowser.Win now parse cleanly (no new regressions across the 2455-unit corpus).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant