File tree Expand file tree Collapse file tree 5 files changed +21
-1
lines changed Expand file tree Collapse file tree 5 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -1696,6 +1696,7 @@ final class ForeachType : BaseNode
1696
1696
/* * */ bool isAlias;
1697
1697
/* * */ bool isEnum;
1698
1698
/* * */ bool isRef;
1699
+ /* * */ bool isScope;
1699
1700
/* * */ IdType[] typeConstructors;
1700
1701
/* * */ Type type;
1701
1702
/* * */ Token identifier;
Original file line number Diff line number Diff line change @@ -393,6 +393,10 @@ class XMLPrinter : ASTVisitor
393
393
override void visit (const ForeachType foreachType)
394
394
{
395
395
output.writeln(" <foreachType>" );
396
+ if (foreachType.isAlias) output.writeln(" <alias/>" );
397
+ if (foreachType.isEnum) output.writeln(" <enum/>" );
398
+ if (foreachType.isRef) output.writeln(" <ref/>" );
399
+ if (foreachType.isScope) output.writeln(" <scope/>" );
396
400
foreach (constructor; foreachType.typeConstructors)
397
401
{
398
402
output.writeln(" <typeConstructor>" , str(constructor), " </typeConstructor>" );
Original file line number Diff line number Diff line change @@ -3287,7 +3287,7 @@ class Parser
3287
3287
* Parses a ForeachType
3288
3288
*
3289
3289
* $(GRAMMAR $(RULEDEF foreachType):
3290
- * ($(LITERAL 'ref') | $(LITERAL 'alias') | $(LITERAL 'enum') | $(RULE typeConstructor))* $(RULE type)? $(LITERAL Identifier)
3290
+ * ($(LITERAL 'ref') | $(LITERAL 'alias') | $(LITERAL 'enum') | $(LITERAL 'scope') | $( RULE typeConstructor))* $(RULE type)? $(LITERAL Identifier)
3291
3291
* ;)
3292
3292
*/
3293
3293
ForeachType parseForeachType ()
@@ -3313,6 +3313,11 @@ class Parser
3313
3313
node.isEnum = true ;
3314
3314
advance();
3315
3315
}
3316
+ else if (currentIs(tok! " scope" ))
3317
+ {
3318
+ node.isScope = true ;
3319
+ advance();
3320
+ }
3316
3321
else if (tok! " " != (typeConstructor = parseTypeConstructor(false )))
3317
3322
{
3318
3323
trace(" \033 [01;36mType constructor" );
Original file line number Diff line number Diff line change
1
+ void foo (T)(T[] arr)
2
+ {
3
+ foreach (enum ref scope const inout alias f; arr) {}
4
+ }
Original file line number Diff line number Diff line change
1
+ //functionDeclaration//foreachStatement//foreachType/alias
2
+ //functionDeclaration//foreachStatement//foreachType/enum
3
+ //functionDeclaration//foreachStatement//foreachType/ref
4
+ //functionDeclaration//foreachStatement//foreachType/scope
5
+ //functionDeclaration//foreachStatement//foreachType/typeConstructor[text()='const']
6
+ //functionDeclaration//foreachStatement//foreachType/typeConstructor[text()='inout']
You can’t perform that action at this time.
0 commit comments