Skip to content

Commit 75d105f

Browse files
authored
Merge pull request #3178 from ntrel/statement-macros
[spec/statement.dd] Remove more unnecessary GLINKs Signed-off-by: Max Haughton <[email protected]> Merged-on-behalf-of: Max Haughton <[email protected]>
2 parents c556d36 + 1319f1d commit 75d105f

File tree

1 file changed

+32
-37
lines changed

1 file changed

+32
-37
lines changed

spec/statement.dd

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ $(GNAME ElseStatement):
254254
$(PSSCOPE)
255255
)
256256

257-
$(P $(EXPRESSION) is evaluated and must have a type that
257+
$(P *Expression* is evaluated and must have a type that
258258
can be converted to a boolean. If it's `true` the
259259
$(I ThenStatement) is transferred to, else the $(I ElseStatement)
260260
is transferred to.)
@@ -265,19 +265,19 @@ $(GNAME ElseStatement):
265265
$(P If an $(D auto) $(I Identifier) is provided, it is declared and
266266
initialized
267267
to the value
268-
and type of the $(EXPRESSION). Its scope extends from when it is
268+
and type of the *Expression*. Its scope extends from when it is
269269
initialized to the end of the $(I ThenStatement).)
270270

271271
$(P If a $(I TypeCtors) $(I Identifier) is provided, it is declared
272272
to be of the type specified by $(I TypeCtors)
273-
and is initialized with the value of the $(EXPRESSION).
273+
and is initialized with the value of the *Expression*.
274274
Its scope extends from when it is
275275
initialized to the end of the $(I ThenStatement).)
276276

277277
$(P If a $(I Declarator) is provided, it is declared and
278278
initialized
279279
to the value
280-
of the $(EXPRESSION). Its scope extends from when it is
280+
of the *Expression*. Its scope extends from when it is
281281
initialized to the end of the $(I ThenStatement).)
282282

283283
---
@@ -374,7 +374,7 @@ $(GNAME ForStatement):
374374

375375
$(GNAME Initialize):
376376
$(D ;)
377-
$(PS0)
377+
$(GLINK NoScopeNonEmptyStatement)
378378

379379
$(GNAME Test):
380380
$(EXPRESSION)
@@ -452,7 +452,7 @@ $(GNAME AggregateForeach):
452452
$(GLINK Foreach) $(D $(LPAREN)) $(GLINK ForeachTypeList) $(D ;) $(GLINK ForeachAggregate) $(D $(RPAREN))
453453

454454
$(GNAME ForeachStatement):
455-
$(GLINK AggregateForeach) $(PS0)
455+
$(GLINK AggregateForeach) $(GLINK NoScopeNonEmptyStatement)
456456

457457
$(GNAME Foreach):
458458
$(D foreach)
@@ -1144,7 +1144,7 @@ $(GNAME StatementNoCaseNoDefault):
11441144
$(P The case expressions must all evaluate to a constant value or array,
11451145
or a runtime initialized const or immutable variable of integral type.
11461146
They must be implicitly convertible to the type of the switch
1147-
$(EXPRESSION). )
1147+
*Expression*. )
11481148

11491149
$(P Case expressions must all evaluate to distinct values. Const or
11501150
immutable variables must all have different names. If they share a
@@ -1253,13 +1253,13 @@ $(GNAME FinalSwitchStatement):
12531253
$(UL
12541254
$(LI No $(GLINK DefaultStatement) is allowed.)
12551255
$(LI No $(GLINK CaseRangeStatement)s are allowed.)
1256-
$(LI If the switch $(EXPRESSION) is of enum type, all
1256+
$(LI If the switch *Expression* is of enum type, all
12571257
the enum members must appear in the $(GLINK CaseStatement)s.)
12581258
$(LI The case expressions cannot evaluate to a run time
12591259
initialized value.)
12601260
)
12611261

1262-
$(IMPLEMENTATION_DEFINED If the $(EXPRESSION) value does not match any
1262+
$(IMPLEMENTATION_DEFINED If the *Expression* value does not match any
12631263
of the $(I CaseRangeStatements), whether that is diagnosed at compile
12641264
time or at runtime.)
12651265

@@ -1336,19 +1336,19 @@ $(GNAME ReturnStatement):
13361336

13371337
$(P `return` exits the current function and supplies its return value.)
13381338

1339-
$(P $(EXPRESSION) is required if the function specifies a return type that is
1340-
not void. The $(EXPRESSION) is implicitly converted to the function return
1339+
$(P *Expression* is required if the function specifies a return type that is
1340+
not void. The *Expression* is implicitly converted to the function return
13411341
type.)
13421342

13431343
$(P At least one return statement, throw statement, or assert(0) expression
13441344
is required if the function specifies a return type that is not void,
13451345
unless the function contains inline assembler code.)
13461346

13471347
$(COMMENT
1348-
$(EXPRESSION) is allowed even if the function specifies
1349-
a $(D_KEYWORD void) return type. The $(EXPRESSION) will be evaluated,
1348+
*Expression* is allowed even if the function specifies
1349+
a $(D_KEYWORD void) return type. The *Expression* will be evaluated,
13501350
but nothing will be returned.
1351-
If the $(EXPRESSION) has no side effects, and the return
1351+
If the *Expression* has no side effects, and the return
13521352
type is $(D_KEYWORD void), then it is illegal.
13531353
)
13541354
$(P Before the function actually returns,
@@ -1365,7 +1365,7 @@ $(COMMENT
13651365
$(P If there is an out postcondition
13661366
(see $(DDLINK spec/contracts, Contract Programming, Contract Programming)),
13671367
that postcondition is executed
1368-
after the $(EXPRESSION) is evaluated and before the function
1368+
after the *Expression* is evaluated and before the function
13691369
actually returns.)
13701370

13711371
---
@@ -1402,10 +1402,10 @@ DefaultStatement) of an enclosing $(GLINK SwitchStatement).)
14021402
next $(GLINK CaseStatement) of the innermost enclosing
14031403
$(GLINK SwitchStatement).)
14041404

1405-
$(P The fourth form, $(CODE goto case) $(EXPRESSION)$(D ;), transfers to the
1405+
$(P The fourth form, $(CODE goto case) *Expression*$(D ;), transfers to the
14061406
$(GLINK CaseStatement) of the innermost enclosing
14071407
$(GLINK SwitchStatement)
1408-
with a matching $(EXPRESSION).)
1408+
with a matching *Expression*.)
14091409

14101410
---
14111411
switch (x)
@@ -1440,7 +1440,7 @@ $(GNAME WithStatement):
14401440
$(D with) $(D $(LPAREN)) $(GLINK2 template, TemplateInstance) $(D $(RPAREN)) $(PSSCOPE)
14411441
)
14421442

1443-
where $(EXPRESSION) evaluates to a class reference or struct
1443+
where *Expression* evaluates to a class reference or struct
14441444
instance.
14451445
Within the with body the referenced object is searched first for
14461446
identifier symbols.
@@ -1466,7 +1466,7 @@ with (expression)
14661466
}
14671467
--------------
14681468

1469-
$(P Note that $(EXPRESSION) only gets evaluated once and is not copied.
1469+
$(P Note that *Expression* only gets evaluated once and is not copied.
14701470
The with statement does not change what $(D this) or
14711471
$(D super) refer to.
14721472
)
@@ -1594,13 +1594,13 @@ $(GNAME SynchronizedStatement):
15941594
$(I ScopeStatement) by using a mutex.
15951595
)
15961596

1597-
$(P What mutex is used is determined by the $(EXPRESSION).
1598-
If there is no $(EXPRESSION), then a global mutex is created,
1597+
$(P What mutex is used is determined by the *Expression*.
1598+
If there is no *Expression*, then a global mutex is created,
15991599
one per such synchronized statement.
16001600
Different synchronized statements will have different global mutexes.
16011601
)
16021602

1603-
$(P If there is an $(EXPRESSION), it must evaluate to either an
1603+
$(P If there is an *Expression*, it must evaluate to either an
16041604
Object or an instance of an $(I Interface), in which case it
16051605
is cast to the Object instance that implemented that $(I Interface).
16061606
The mutex used is specific to that Object instance, and
@@ -1642,13 +1642,13 @@ $(GNAME Catches):
16421642
$(GLINK Catch) $(GSELF Catches)
16431643

16441644
$(GNAME Catch):
1645-
$(D catch $(LPAREN)) $(GLINK CatchParameter) $(D $(RPAREN)) $(PS0)
1645+
$(D catch $(LPAREN)) $(GLINK CatchParameter) $(D $(RPAREN)) $(GLINK NoScopeNonEmptyStatement)
16461646

16471647
$(GNAME CatchParameter):
16481648
$(GLINK2 type, BasicType) $(GLINK_LEX Identifier)$(OPT)
16491649

16501650
$(GNAME FinallyStatement):
1651-
$(D finally) $(PS0)
1651+
$(D finally) $(GLINK NoScopeNonEmptyStatement)
16521652
)
16531653

16541654
$(P $(I CatchParameter) declares a variable v of type T, where T is
@@ -1742,7 +1742,7 @@ $(GNAME ThrowStatement):
17421742
$(D throw) $(EXPRESSION) $(D ;)
17431743
)
17441744

1745-
$(P $(EXPRESSION) is evaluated and must be a `Throwable` reference. The
1745+
$(P *Expression* is evaluated and must be a `Throwable` reference. The
17461746
`Throwable` reference is thrown as an exception.)
17471747

17481748
---
@@ -1758,17 +1758,17 @@ $(H2 $(LEGACY_LNAME2 ScopeGuardStatement, scope-guard-statement, Scope Guard Sta
17581758

17591759
$(GRAMMAR
17601760
$(GNAME ScopeGuardStatement):
1761-
$(D scope ( exit )) $(PSCURLYSCOPE)
1762-
$(D scope ( success )) $(PSCURLYSCOPE)
1763-
$(D scope ( failure )) $(PSCURLYSCOPE)
1761+
$(D scope ( exit )) $(GLINK NonEmptyOrScopeBlockStatement)
1762+
$(D scope ( success )) $(GLINK NonEmptyOrScopeBlockStatement)
1763+
$(D scope ( failure )) $(GLINK NonEmptyOrScopeBlockStatement)
17641764
)
17651765

1766-
$(P The $(I ScopeGuardStatement) executes $(PSCURLYSCOPE) at the close of the
1766+
$(P The $(I ScopeGuardStatement) executes *NonEmptyOrScopeBlockStatement* at the close of the
17671767
current scope, rather than at the point where the $(I ScopeGuardStatement)
1768-
appears. $(D scope(exit)) executes $(PSCURLYSCOPE) when the scope exits normally
1768+
appears. $(D scope(exit)) executes *NonEmptyOrScopeBlockStatement* when the scope exits normally
17691769
or when it exits due to exception unwinding. $(D scope(failure)) executes
1770-
$(PSCURLYSCOPE) when the scope exits due to exception unwinding.
1771-
`scope(success)` executes $(PSCURLYSCOPE) when the scope exits normally.)
1770+
*NonEmptyOrScopeBlockStatement* when the scope exits due to exception unwinding.
1771+
`scope(success)` executes *NonEmptyOrScopeBlockStatement* when the scope exits normally.)
17721772

17731773
$(P If there are multiple $(I ScopeGuardStatement)s in a scope, they
17741774
will be executed in the reverse lexical order in which they appear.
@@ -1995,10 +1995,5 @@ Macros:
19951995
EXPRESSION=$(GLINK2 expression, Expression)
19961996
PSSEMI_PSCURLYSCOPE=$(GLINK Statement)
19971997
PSSEMI_PSCURLYSCOPE_LIST=$(GLINK ScopeStatementList)
1998-
PS0=$(GLINK NoScopeNonEmptyStatement)
19991998
PSSCOPE=$(GLINK ScopeStatement)
2000-
PSCURLY=$(GLINK BlockStatement)
2001-
PSSEMI=$(GLINK NoScopeStatement)
2002-
PSCURLY_PSSCOPE=$(GLINK ScopeBlockStatement)
2003-
PSCURLYSCOPE=$(GLINK NonEmptyOrScopeBlockStatement)
20041999
_=

0 commit comments

Comments
 (0)