Skip to content

Commit b29220a

Browse files
committed
Add a Requires field to doc comments
rdar://problem/20902140 Swift SVN r28446
1 parent 296f0c9 commit b29220a

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

bindings/xml/comment-xml-schema.rng

+9
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,14 @@
507507
</element>
508508
</define>
509509

510+
<define name="Requires">
511+
<element name="Requires">
512+
<zeroOrMore>
513+
<ref name="BlockContent"/>
514+
</zeroOrMore>
515+
</element>
516+
</define>
517+
510518
<define name="See">
511519
<element name="See">
512520
<zeroOrMore>
@@ -715,6 +723,7 @@
715723
<ref name="Precondition"/>
716724
<ref name="Remark"/>
717725
<ref name="Remarks"/>
726+
<ref name="Requires"/>
718727
<ref name="See"/>
719728
<ref name="Since"/>
720729
<ref name="TODO"/>

docs/DocumentationComments.rst

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ one is supported and appear in order inside QuickHelp.
8080
- Precondition: ...
8181
- Remark: ...
8282
- Remarks: ...
83+
- Requires: ...
8384
- See: ...
8485
- Since: ...
8586
- Todo: ...

include/swift/Markup/ASTNodes.def

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ MARKUP_AST_NODE(PrivateExtension, MarkupASTNode)
6767
MARKUP_AST_NODE(RemarkField, PrivateExtension)
6868
MARKUP_AST_NODE(RemarksField, PrivateExtension)
6969
MARKUP_AST_NODE(ReturnsField, PrivateExtension)
70+
MARKUP_AST_NODE(RequiresField, PrivateExtension)
7071
MARKUP_AST_NODE(SeeField, PrivateExtension)
7172
MARKUP_AST_NODE(SinceField, PrivateExtension)
7273
MARKUP_AST_NODE(TODOField, PrivateExtension)

include/swift/Markup/SimpleFields.def

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ MARKUP_SIMPLE_FIELD(PreconditionField, precondition, Precondition)
3737
MARKUP_SIMPLE_FIELD(RemarkField, remark, Remark)
3838
MARKUP_SIMPLE_FIELD(RemarksField, remarks, Remarks)
3939
MARKUP_SIMPLE_FIELD(ReturnsField, returns, Returns)
40+
MARKUP_SIMPLE_FIELD(RequiresField, requires, Requires)
4041
MARKUP_SIMPLE_FIELD(SeeField, seealso, See)
4142
MARKUP_SIMPLE_FIELD(SinceField, since, Since)
4243
MARKUP_SIMPLE_FIELD(TODOField, todo, TODO)

test/IDE/comment_extensions.swift

+5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ func remark() {}
6767
func remarks() {}
6868
// 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>]
6969

70+
/// - requires:
71+
/// - explicit package name. Just kidding!
72+
func requires() {}
73+
// 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>]
74+
7075
/// - seealso: the pie (it's very good).
7176
func see() {}
7277
// 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>]

0 commit comments

Comments
 (0)