@@ -67,6 +67,15 @@ class alignas(8) Pattern {
67
67
IsPropagatedType : 1
68
68
);
69
69
70
+ SWIFT_INLINE_BITFIELD (BoolPattern, Pattern, 1 ,
71
+ Value : 1
72
+ );
73
+
74
+ SWIFT_INLINE_BITFIELD (VarPattern, Pattern, 1 ,
75
+ // / True if this is a let pattern, false if a var pattern.
76
+ IsLet : 1
77
+ );
78
+
70
79
} Bits;
71
80
72
81
Pattern (PatternKind kind) {
@@ -581,15 +590,15 @@ class EnumElementPattern : public Pattern {
581
590
// / matched against the associated value for the case.
582
591
class BoolPattern : public Pattern {
583
592
SourceLoc NameLoc;
584
- bool Value;
585
593
586
594
public:
587
595
BoolPattern (SourceLoc NameLoc, bool Value)
588
- : Pattern(PatternKind::Bool), NameLoc(NameLoc), Value(Value) {
596
+ : Pattern(PatternKind::Bool), NameLoc(NameLoc) {
597
+ Bits.BoolPattern .Value = Value;
589
598
}
590
599
591
- bool getValue () const { return Value; }
592
- void setValue (bool v) { Value = v; }
600
+ bool getValue () const { return Bits. BoolPattern . Value ; }
601
+ void setValue (bool v) { Bits. BoolPattern . Value = v; }
593
602
594
603
SourceLoc getNameLoc () const { return NameLoc; }
595
604
SourceLoc getLoc () const { return NameLoc; }
@@ -703,17 +712,17 @@ class ExprPattern : public Pattern {
703
712
// / parsed as expressions referencing existing entities.
704
713
class VarPattern : public Pattern {
705
714
SourceLoc VarLoc;
706
- bool IsLet; // True if this is a let pattern, false if a var pattern.
707
715
Pattern *SubPattern;
708
716
public:
709
717
VarPattern (SourceLoc loc, bool isLet, Pattern *sub,
710
718
Optional<bool > implicit = None)
711
- : Pattern(PatternKind::Var), VarLoc(loc), IsLet(isLet), SubPattern(sub) {
719
+ : Pattern(PatternKind::Var), VarLoc(loc), SubPattern(sub) {
720
+ Bits.VarPattern .IsLet = isLet;
712
721
if (implicit.hasValue () ? *implicit : !loc.isValid ())
713
722
setImplicit ();
714
723
}
715
724
716
- bool isLet () const { return IsLet; }
725
+ bool isLet () const { return Bits. VarPattern . IsLet ; }
717
726
718
727
SourceLoc getLoc () const { return VarLoc; }
719
728
SourceRange getSourceRange () const {
0 commit comments