Skip to content

Commit 9bd20fa

Browse files
authored
Spec change for Issue 16140
PR: dlang/dmd#12246
1 parent 0c4a943 commit 9bd20fa

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

spec/statement.dd

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,16 @@ $(H2 $(LEGACY_LNAME2 WhileStatement, while-statement, While Statement))
298298

299299
$(GRAMMAR
300300
$(GNAME WhileStatement):
301-
$(D while $(LPAREN)) $(EXPRESSION) $(D $(RPAREN)) $(PSSCOPE)
301+
$(D while $(LPAREN)) $(GLINK IfCondition) $(D $(RPAREN)) $(PSSCOPE)
302302
)
303303

304304
$(P A $(I While Statement) implements a simple loop.)
305305

306-
$(P $(EXPRESSION) is evaluated and must have a type that can be converted to a
307-
boolean. If it's true the $(PSSCOPE) is executed. After the $(PSSCOPE) is
308-
executed, the $(EXPRESSION) is evaluated again, and if true the $(PSSCOPE) is
309-
executed again. This continues until the $(EXPRESSION) evaluates to false.)
306+
$(P If the $(IfCondition) is an $(EXPRESSION), it is evaluated and must have a type
307+
that can be converted to a boolean. If it's true the $(PSSCOPE) is executed.
308+
After the $(PSSCOPE) is executed, the $(EXPRESSION) is evaluated again, and
309+
if true the $(PSSCOPE) is executed again. This continues until the $(EXPRESSION)
310+
evaluates to false.)
310311

311312
---
312313
int i = 0;
@@ -317,15 +318,22 @@ while (i < 10)
317318
}
318319
---
319320

320-
$(P A $(GLINK BreakStatement) will exit the loop.)
321+
$(P If an $(D auto) $(I Identifier) is provided, it is declared and
322+
initialized to the value and type of the $(EXPRESSION). Its scope
323+
extends from when it is initialized to the end of the $(PSSCOPE).)
321324

322-
$(P A $(GLINK ContinueStatement) will transfer directly to evaluating $(EXPRESSION) again.)
325+
$(P If a $(I TypeCtors) $(I Identifier) is provided, it is declared
326+
to be of the type specified by $(I TypeCtors) and is initialized with
327+
the value of the $(EXPRESSION). Its scope extends from when it is
328+
initialized to the end of the $(PSSCOPE).)
323329

324-
$(P A $(I While Statement) is equivalent to:)
330+
$(P If a $(I Declarator) is provided, it is declared and initialized
331+
to the value of the $(EXPRESSION). Its scope extends from when it is
332+
initialized to the end of the $(PSSCOPE).)
325333

326-
---
327-
for (; Expression; ) ScopeStatement
328-
---
334+
$(P A $(GLINK BreakStatement) will exit the loop.)
335+
336+
$(P A $(GLINK ContinueStatement) will transfer directly to evaluating $(IfCondition) again.)
329337

330338
$(H2 $(LEGACY_LNAME2 DoStatement, do-statement, Do Statement))
331339

0 commit comments

Comments
 (0)