Menu

#108 Write comments after class declaration

open
TridenT
5
2012-07-18
2009-12-15
TridenT
No

[Admin Entry - from Larry H.]

As comments are allowed after procedure declaration and before BEGIN keyword, I would like to write class comments after the class name but before any fields or methods.

ThcAttribute = class(TObject)
(**
An Attribute represents an attribute of a database object. It is owned by an instance of @see(ThcObject) and has a
reference to it's definition @see(ThcAttributeDef) which is owned by the @see(ThcMetaData) class.

@author Larry Hengen
@date Dec. 12, 2009
*)

private
FNullDisplayValue: string; //string value to display when the attribute IsNull.
FExternalOnChange: ThcAttributeNotifyEvent; //event for external subscribers wanting to know when an attribute is changed
public
procedure SomeMethod;
end;

Discussion

  • TridenT

    TridenT - 2009-12-15

    Example file

     
  • TridenT

    TridenT - 2009-12-15

    Fixed in v0.23beta.5

    Comment after a class declaration are now parsed and linked to the class.
    So this type of comments are now allowed.
    But be warbed that this feature is only enabled when there is a class visibility keyword after the class declaration, else the comment following the class conflict with the one for the next identifier (field for example).

    Example :
    /// TMyForm comment
    TMyForm = class(System.Windows.Forms.Form)
    /// TextBox comment
    TextBox: System.Windows.Forms.TextBox;
    end;

    In this case, the TMyForm comment cannot be moved after the class declaration, else it conflicts with the TextBox comment.
    In this special case, mentionning the implicit visibility 'published' will solve the issue !

     
  • TridenT

    TridenT - 2009-12-15

    A test case was created to ensure that the feature will not broke one day !

     

Anonymous
Anonymous

Add attachments
Cancel