Skip to content

Commit

Permalink
Add a Requires field to doc comments
Browse files Browse the repository at this point in the history
rdar://problem/20902140

Swift SVN r28446
  • Loading branch information
bitjammer committed May 11, 2015
1 parent 296f0c9 commit b29220a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bindings/xml/comment-xml-schema.rng
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,14 @@
</element>
</define>

<define name="Requires">
<element name="Requires">
<zeroOrMore>
<ref name="BlockContent"/>
</zeroOrMore>
</element>
</define>

<define name="See">
<element name="See">
<zeroOrMore>
Expand Down Expand Up @@ -715,6 +723,7 @@
<ref name="Precondition"/>
<ref name="Remark"/>
<ref name="Remarks"/>
<ref name="Requires"/>
<ref name="See"/>
<ref name="Since"/>
<ref name="TODO"/>
Expand Down
1 change: 1 addition & 0 deletions docs/DocumentationComments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ one is supported and appear in order inside QuickHelp.
- Precondition: ...
- Remark: ...
- Remarks: ...
- Requires: ...
- See: ...
- Since: ...
- Todo: ...
Expand Down
1 change: 1 addition & 0 deletions include/swift/Markup/ASTNodes.def
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ MARKUP_AST_NODE(PrivateExtension, MarkupASTNode)
MARKUP_AST_NODE(RemarkField, PrivateExtension)
MARKUP_AST_NODE(RemarksField, PrivateExtension)
MARKUP_AST_NODE(ReturnsField, PrivateExtension)
MARKUP_AST_NODE(RequiresField, PrivateExtension)
MARKUP_AST_NODE(SeeField, PrivateExtension)
MARKUP_AST_NODE(SinceField, PrivateExtension)
MARKUP_AST_NODE(TODOField, PrivateExtension)
Expand Down
1 change: 1 addition & 0 deletions include/swift/Markup/SimpleFields.def
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ MARKUP_SIMPLE_FIELD(PreconditionField, precondition, Precondition)
MARKUP_SIMPLE_FIELD(RemarkField, remark, Remark)
MARKUP_SIMPLE_FIELD(RemarksField, remarks, Remarks)
MARKUP_SIMPLE_FIELD(ReturnsField, returns, Returns)
MARKUP_SIMPLE_FIELD(RequiresField, requires, Requires)
MARKUP_SIMPLE_FIELD(SeeField, seealso, See)
MARKUP_SIMPLE_FIELD(SinceField, since, Since)
MARKUP_SIMPLE_FIELD(TODOField, todo, TODO)
Expand Down
5 changes: 5 additions & 0 deletions test/IDE/comment_extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ func remark() {}
func remarks() {}
// CHECK: {{.*}}DocCommentAsXML=[<Function file="{{.*}}" line="{{.*}}" column="{{.*}}"><Name>remarks()</Name><USR>s:F14swift_ide_test7remarksFT_T_</USR><Declaration>func remarks()</Declaration><Discussion><Remarks><Para></Para><List-Bullet><Item><Para>Never let a bear approach you.</Para></Item></List-Bullet></Remarks></Discussion></Function>]

/// - requires:
/// - explicit package name. Just kidding!
func requires() {}
// CHECK: {{.*}}DocCommentAsXML=[<Function file="{{.*}}" line="{{.*}}" column="{{.*}}"><Name>requires()</Name><USR>s:F14swift_ide_test8requiresFT_T_</USR><Declaration>func requires()</Declaration><Discussion><Requires><Para></Para><List-Bullet><Item><Para>explicit package name. Just kidding!</Para></Item></List-Bullet></Requires></Discussion></Function>]

/// - seealso: the pie (it's very good).
func see() {}
// CHECK: {{.*}}DocCommentAsXML=[<Function file="{{.*}}" line="{{.*}}" column="{{.*}}"><Name>see()</Name><USR>s:F14swift_ide_test3seeFT_T_</USR><Declaration>func see()</Declaration><Discussion><See><Para>the pie (it&apos;s very good).</Para></See></Discussion></Function>]
Expand Down

0 comments on commit b29220a

Please sign in to comment.