Skip to content

Support 'of object' and 'reference to' in procedural types - #348

Open
De-Novo-Research wants to merge 1 commit into
RomanYankovsky:masterfrom
De-Novo-Research:procedural-type-variants
Open

De-Novo-Research wants to merge 1 commit into
RomanYankovsky:masterfrom
De-Novo-Research:procedural-type-variants

Conversation

@De-Novo-Research

Copy link
Copy Markdown

Both variants were parsed correctly but then discarded, leaving the syntax tree unable to distinguish three types Delphi treats as distinct:

procedure(...) tkProcedure
procedure(...) of object tkMethod
reference to procedure(...) tkInterface

'of object' produced a tree byte-identical to a plain procedural type, and 'reference to' produced no TYPE node at all - PARAMETERS hung directly off TYPEDECL. Functions were affected the same way.

Both now carry a kind= attribute, following the existing interface / dispinterface precedent:

AnonymousMethodType inlined NextToken at the point where the procedure or function token is current, so there was no hook to record which it was. Added AnonymousMethodKind, mirroring the existing MethodKind; its base implementation is just NextToken, so behaviour is unchanged for any existing subclass that does not override it.

Both variants were parsed correctly but then discarded, leaving the syntax
tree unable to distinguish three types Delphi treats as distinct:

  procedure(...)                 tkProcedure
  procedure(...) of object       tkMethod
  reference to procedure(...)    tkInterface

'of object' produced a tree byte-identical to a plain procedural type, and
'reference to' produced no TYPE node at all - PARAMETERS hung directly off
TYPEDECL. Functions were affected the same way.

Both now carry a kind= attribute, following the existing interface /
dispinterface precedent:

  <TYPE name="procedure"/>
  <TYPE name="procedure" kind="ofobject"/>
  <TYPE name="procedure" kind="referenceto"/>

AnonymousMethodType inlined NextToken at the point where the procedure or
function token is current, so there was no hook to record which it was.
Added AnonymousMethodKind, mirroring the existing MethodKind; its base
implementation is just NextToken, so behaviour is unchanged for any
existing subclass that does not override it.
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