[AST] Add OperatorFixity

Use this instead of DeclKind in a few places.
This commit is contained in:
Hamish Knight
2020-03-22 14:16:52 -07:00
parent e5952ab7fe
commit a502246f34
10 changed files with 60 additions and 22 deletions

View File

@@ -385,19 +385,18 @@ enum class SelfAccessKind : uint8_t {
};
using SelfAccessKindField = BCFixed<2>;
/// Translates an operator DeclKind to a Serialization fixity, whose values are
/// guaranteed to be stable.
static inline OperatorKind getStableFixity(DeclKind kind) {
switch (kind) {
case DeclKind::PrefixOperator:
/// Translates an operator decl fixity to a Serialization fixity, whose values
/// are guaranteed to be stable.
static inline OperatorKind getStableFixity(OperatorFixity fixity) {
switch (fixity) {
case OperatorFixity::Prefix:
return Prefix;
case DeclKind::PostfixOperator:
case OperatorFixity::Postfix:
return Postfix;
case DeclKind::InfixOperator:
case OperatorFixity::Infix:
return Infix;
default:
llvm_unreachable("unknown operator fixity");
}
llvm_unreachable("Unhandled case in switch");
}
// These IDs must \em not be renumbered or reordered without incrementing