Merge pull request #13640 from davezarzycki/nfc_repack_two_pattern_bits
diff --git a/include/swift/AST/Pattern.h b/include/swift/AST/Pattern.h
index 566b275..7d5cfe7 100644
--- a/include/swift/AST/Pattern.h
+++ b/include/swift/AST/Pattern.h
@@ -67,6 +67,15 @@
IsPropagatedType : 1
);
+ SWIFT_INLINE_BITFIELD(BoolPattern, Pattern, 1,
+ Value : 1
+ );
+
+ SWIFT_INLINE_BITFIELD(VarPattern, Pattern, 1,
+ /// True if this is a let pattern, false if a var pattern.
+ IsLet : 1
+ );
+
} Bits;
Pattern(PatternKind kind) {
@@ -581,15 +590,15 @@
/// matched against the associated value for the case.
class BoolPattern : public Pattern {
SourceLoc NameLoc;
- bool Value;
public:
BoolPattern(SourceLoc NameLoc, bool Value)
- : Pattern(PatternKind::Bool), NameLoc(NameLoc), Value(Value) {
+ : Pattern(PatternKind::Bool), NameLoc(NameLoc) {
+ Bits.BoolPattern.Value = Value;
}
- bool getValue() const { return Value; }
- void setValue(bool v) { Value = v; }
+ bool getValue() const { return Bits.BoolPattern.Value; }
+ void setValue(bool v) { Bits.BoolPattern.Value = v; }
SourceLoc getNameLoc() const { return NameLoc; }
SourceLoc getLoc() const { return NameLoc; }
@@ -703,17 +712,17 @@
/// parsed as expressions referencing existing entities.
class VarPattern : public Pattern {
SourceLoc VarLoc;
- bool IsLet; // True if this is a let pattern, false if a var pattern.
Pattern *SubPattern;
public:
VarPattern(SourceLoc loc, bool isLet, Pattern *sub,
Optional<bool> implicit = None)
- : Pattern(PatternKind::Var), VarLoc(loc), IsLet(isLet), SubPattern(sub) {
+ : Pattern(PatternKind::Var), VarLoc(loc), SubPattern(sub) {
+ Bits.VarPattern.IsLet = isLet;
if (implicit.hasValue() ? *implicit : !loc.isValid())
setImplicit();
}
- bool isLet() const { return IsLet; }
+ bool isLet() const { return Bits.VarPattern.IsLet; }
SourceLoc getLoc() const { return VarLoc; }
SourceRange getSourceRange() const {