Menu ▾ ▴

#139 Formatter - Anonymous Methods

Closed
closed-fixed
None
5
2019-09-20
2019-09-18
Rob Truby
No

GExperts: 1.3.14 build 80
Windows 10

Anonymous methods do not format correclty if they have a var section.

The following code:

Comparer := TDelegatedComparer<TData>.Create(
    function(const Data1, Data2: TData): Integer
    var
      Node1: TNode;
    begin

    end);

formats to:

    Comparer := TDelegatedComparer<TData>.Create(

function(const Data1, Data2: TData): Integer
var
  Node1: TNode;
begin

end);

The code formats correctly if there is no var section:

Comparer := TDelegatedComparer<TData>.Create(
    function(const Data1, Data2: TData): Integer
    begin

    end);

Discussion

  • Rob Truby

    Rob Truby - 2019-09-18

    I'm not sure how to edit the original ticket.

    • The /tdata tag was added after begin when I submitted the ticket.
    • Formatting was lost.
     

    Last edit: Rob Truby 2019-09-18
  • Thomas Mueller

    Thomas Mueller - 2019-09-20
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,7 +4,7 @@
     Anonymous methods do not format correclty if they have a var section. 
    
     The following code: 
    -
    +~~~
     Comparer := TDelegatedComparer&lt;TData&gt;.Create(
         function(const Data1, Data2: TData): Integer
         var
    @@ -12,11 +12,11 @@
         begin
    
         end);
    +~~~
    
       formats to: 
    
    -  
    +~~~
         Comparer := TDelegatedComparer&lt;TData&gt;.Create(
    -
     function(const Data1, Data2: TData): Integer
     var
       Node1: TNode;
    @@ -24,11 +24,15 @@
    
     end);
    
    +~~~  
    +
     The code formats correctly if there is no var section: 
    
    
    -  Comparer := TDelegatedComparer&lt;TData&gt;.Create(
    +~~~
    +Comparer := TDelegatedComparer&lt;TData&gt;.Create(
         function(const Data1, Data2: TData): Integer
         begin
    
         end);
    +~~~
    
    • assigned_to: Thomas Mueller
    • Group: Closed --> New
     
  • Thomas Mueller

    Thomas Mueller - 2019-09-20

    I fixed the formatting (of the bug report, not in GExperts yet)

     
  • Thomas Mueller

    Thomas Mueller - 2019-09-20
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -17,6 +17,7 @@
       formats to: 
     ~~~
         Comparer := TDelegatedComparer&lt;TData&gt;.Create(
    +
     function(const Data1, Data2: TData): Integer
     var
       Node1: TNode;
    
    • status: open --> closed-fixed
    • Group: New --> Closed
     
  • Thomas Mueller

    Thomas Mueller - 2019-09-20

    fixed in revision #2744

     

Log in to post a comment.