Skip to content

Commit 5a1286c

Browse files
committed
Add guideline for contracts
1 parent 2b1e8ce commit 5a1286c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

dstyle.dd

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ $(LISTSECTION phobos_whitespace, Whitespace,
300300
-------------------------------
301301
for (…) { … }
302302
foreach (…) { … }
303+
static foreach (…) { … }
303304
if (x) { … }
304305
static if (x) { … }
305306
while (…) { … }
@@ -381,6 +382,19 @@ $(LISTSECTION phobos_declarations, Declarations,
381382
-------------------------------
382383
void foo(R)(R r)
383384
if (R == 1)
385+
-------------------------------
386+
$(LI Pre and post contracts should have the same indentation level as their
387+
declaration. Put no space between `in`/`out` and an open parenthesis:)
388+
-------------------------------
389+
int foo(int r)
390+
in(r == 0)
391+
out(result; result == 0)
392+
do { … }
393+
394+
int foo(int r)
395+
in { … }
396+
out(result) { … }
397+
do { … }
384398
-------------------------------
385399
)
386400
$(LISTSECTION phobos_class_struct_field_declaration, Class/Struct Field Declarations,

0 commit comments

Comments
 (0)