Skip to content

Does not handle 'dispinterface' keyword and subsequent types are lost #6

Description

@vintagedave

A type node with a dispinterface gets confused, and the properties in the interface end up in the type node itself. Types declared after a dispinterface are not visible at all.

Using the following unit:

unit TestDispInterface;

interface

const   
    HELLO = 2;
    ID_COLOR = 3;
    ID_NAME = 4;

type
  // See https://tips.delphidabbler.com/tips/216
  IMyDispInterface = dispinterface
    ['{4D733284-C514-11D4-8481-A68F52CBDB56}']
    procedure DoThis; DispID 1;
    procedure DoThat; dispid HELLO;
    property Color: Integer dispid ID_COLOR;
    property Name: WideString dispid ID_NAME;
  end;

  TMyRec = record
  end;

implementation

end.

the node for 'interface' will have the following children:

<Node type=kInterface, start_point=(2, 0), end_point=(2, 9)>,
<Node type=declConsts, start_point=(4, 0), end_point=(7, 16)>,
<Node type=declTypes, start_point=(9, 0), end_point=(12, 4)>,
<Node type=declProc, start_point=(12, 4), end_point=(13, 21)>
<Node type=ERROR, start_point=(13, 22), end_point=(13, 31)>,
<Node type=declProc, start_point=(14, 4), end_point=(14, 21)>, 
<Node type=ERROR, start_point=(14, 22), end_point=(14, 35)>,
<Node type=declProp, start_point=(15, 4), end_point=(15, 44)>,
<Node type=declProp, start_point=(16, 4), end_point=(16, 45)>

Note how after the declTypes, which should contain the IMyDispInterface type, procedures start getting into the interface itself, even though they are part of the dispinterface.

Types declared after the dispinterface will not be present at all, it's as though they are not seen.

(See https://tips.delphidabbler.com/tips/216 . The ID is a constant of some sort - can be an integer, can be a constant defined elsewhere.)

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