@@ -558,8 +558,8 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
558
558
bool literal; // this template declaration is a literal
559
559
bool ismixin; // this is a mixin template declaration
560
560
bool isstatic; // this is static template declaration
561
- bool isAliasSeq; // / matches pattern `template AliasSeq(T...) { alias AliasSeq = T; }`
562
- bool isAlias; // / matches pattern `template Alias(T) { alias Alias = qualifiers(T); }`
561
+ bool isTrivialAliasSeq; // / matches pattern `template AliasSeq(T...) { alias AliasSeq = T; }`
562
+ bool isTrivialAlias; // / matches pattern `template Alias(T) { alias Alias = qualifiers(T); }`
563
563
Prot protection;
564
564
int inuse; // / for recursive expansion detection
565
565
@@ -602,49 +602,48 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
602
602
603
603
// Compute in advance for Ddoc's use
604
604
// https://issues.dlang.org/show_bug.cgi?id=11153: ident could be NULL if parsing fails.
605
- if (members && ident)
606
- {
607
- Dsymbol s;
608
- if (Dsymbol.oneMembers(members, &s, ident) && s)
609
- {
610
- onemember = s;
611
- s.parent = this ;
605
+ if (! members || ! ident)
606
+ return ;
612
607
613
- /* Set isAliasSeq if this fits the pattern:
614
- * template AliasSeq(T...) { alias AliasSeq = T; }
615
- * or set isAlias if this fits the pattern:
616
- * template Alias(T) { alias Alias = qualifiers(T); }
617
- */
618
- if (! (parameters && parameters.length == 1 ))
619
- return ;
608
+ Dsymbol s;
609
+ if (! Dsymbol.oneMembers(members, &s, ident) || ! s)
610
+ return ;
620
611
621
- if (auto ad = s.isAliasDeclaration())
622
- {
623
- if (! ad.type)
624
- return ;
625
- if (auto ti = ad.type.isTypeIdentifier())
626
- {
627
- if (auto ttp = (* parameters)[0 ].isTemplateTupleParameter())
628
- {
629
- if (ti.idents.length == 0 &&
630
- ti.ident is ttp.ident &&
631
- ti.mod == 0 )
632
- {
633
- // printf("found isAliasSeq %s %s\n", s.toChars(), ad.type.toChars());
634
- isAliasSeq = true ;
635
- }
636
- }
637
- else if (auto ttp = (* parameters)[0 ].isTemplateTypeParameter())
638
- {
639
- if (ti.idents.length == 0 &&
640
- ti.ident is ttp.ident)
641
- {
642
- // printf("found isAlias %s %s\n", s.toChars(), ad.type.toChars());
643
- isAlias = true ;
644
- }
645
- }
646
- }
647
- }
612
+ onemember = s;
613
+ s.parent = this ;
614
+
615
+ /* Set isTrivialAliasSeq if this fits the pattern:
616
+ * template AliasSeq(T...) { alias AliasSeq = T; }
617
+ * or set isTrivialAlias if this fits the pattern:
618
+ * template Alias(T) { alias Alias = qualifiers(T); }
619
+ */
620
+ if (! (parameters && parameters.length == 1 ))
621
+ return ;
622
+
623
+ auto ad = s.isAliasDeclaration();
624
+ if (! ad || ! ad.type)
625
+ return ;
626
+
627
+ auto ti = ad.type.isTypeIdentifier();
628
+
629
+ if (! ti || ti.idents.length != 0 )
630
+ return ;
631
+
632
+ if (auto ttp = (* parameters)[0 ].isTemplateTupleParameter())
633
+ {
634
+ if (ti.ident is ttp.ident &&
635
+ ti.mod == 0 )
636
+ {
637
+ // printf("found isTrivialAliasSeq %s %s\n", s.toChars(), ad.type.toChars());
638
+ isTrivialAliasSeq = true ;
639
+ }
640
+ }
641
+ else if (auto ttp = (* parameters)[0 ].isTemplateTypeParameter())
642
+ {
643
+ if (ti.ident is ttp.ident)
644
+ {
645
+ // printf("found isTrivialAlias %s %s\n", s.toChars(), ad.type.toChars());
646
+ isTrivialAlias = true ;
648
647
}
649
648
}
650
649
}
0 commit comments