@@ -73,7 +73,7 @@ class alignas(8) Pattern {
73
73
Value : 1
74
74
);
75
75
76
- SWIFT_INLINE_BITFIELD (VarPattern , Pattern, 1 ,
76
+ SWIFT_INLINE_BITFIELD (BindingPattern , Pattern, 1 ,
77
77
// / True if this is a let pattern, false if a var pattern.
78
78
IsLet : 1
79
79
);
@@ -113,7 +113,7 @@ class alignas(8) Pattern {
113
113
// / Find the smallest subpattern which obeys the property that matching it is
114
114
// / equivalent to matching this pattern.
115
115
// /
116
- // / Looks through ParenPattern, VarPattern , and TypedPattern.
116
+ // / Looks through ParenPattern, BindingPattern , and TypedPattern.
117
117
Pattern *getSemanticsProvidingPattern ();
118
118
const Pattern *getSemanticsProvidingPattern () const {
119
119
return const_cast <Pattern*>(this )->getSemanticsProvidingPattern ();
@@ -692,22 +692,23 @@ class ExprPattern : public Pattern {
692
692
// / semantics of its own, but has a syntactic effect on the subpattern. Bare
693
693
// / identifiers in the subpattern create new variable bindings instead of being
694
694
// / parsed as expressions referencing existing entities.
695
- class VarPattern : public Pattern {
695
+ class BindingPattern : public Pattern {
696
696
SourceLoc VarLoc;
697
697
Pattern *SubPattern;
698
698
public:
699
- VarPattern (SourceLoc loc, bool isLet, Pattern *sub)
700
- : Pattern(PatternKind::Var ), VarLoc(loc), SubPattern(sub) {
701
- Bits.VarPattern .IsLet = isLet;
699
+ BindingPattern (SourceLoc loc, bool isLet, Pattern *sub)
700
+ : Pattern(PatternKind::Binding ), VarLoc(loc), SubPattern(sub) {
701
+ Bits.BindingPattern .IsLet = isLet;
702
702
}
703
703
704
- static VarPattern *createImplicit (ASTContext &Ctx, bool isLet, Pattern *sub) {
705
- auto *VP = new (Ctx) VarPattern (SourceLoc (), isLet, sub);
704
+ static BindingPattern *createImplicit (ASTContext &Ctx, bool isLet,
705
+ Pattern *sub) {
706
+ auto *VP = new (Ctx) BindingPattern (SourceLoc (), isLet, sub);
706
707
VP->setImplicit ();
707
708
return VP;
708
709
}
709
710
710
- bool isLet () const { return Bits.VarPattern .IsLet ; }
711
+ bool isLet () const { return Bits.BindingPattern .IsLet ; }
711
712
712
713
SourceLoc getLoc () const { return VarLoc; }
713
714
SourceRange getSourceRange () const {
@@ -722,17 +723,16 @@ class VarPattern : public Pattern {
722
723
void setSubPattern (Pattern *p) { SubPattern = p; }
723
724
724
725
static bool classof (const Pattern *P) {
725
- return P->getKind () == PatternKind::Var ;
726
+ return P->getKind () == PatternKind::Binding ;
726
727
}
727
728
};
728
729
729
-
730
730
inline Pattern *Pattern::getSemanticsProvidingPattern () {
731
731
if (auto *pp = dyn_cast<ParenPattern>(this ))
732
732
return pp->getSubPattern ()->getSemanticsProvidingPattern ();
733
733
if (auto *tp = dyn_cast<TypedPattern>(this ))
734
734
return tp->getSubPattern ()->getSemanticsProvidingPattern ();
735
- if (auto *vp = dyn_cast<VarPattern >(this ))
735
+ if (auto *vp = dyn_cast<BindingPattern >(this ))
736
736
return vp->getSubPattern ()->getSemanticsProvidingPattern ();
737
737
return this ;
738
738
}
0 commit comments