Fix SymbolRole serialization and make it hashable

This commit is contained in:
Fangrui Song 2018-02-08 12:18:36 -08:00
parent 715fece4dd
commit 48a6f836ca
2 changed files with 3 additions and 1 deletions

View File

@ -78,6 +78,7 @@ enum class SymbolRole : uint8_t {
CalledBy = 1 << 6, CalledBy = 1 << 6,
}; };
MAKE_REFLECT_TYPE_PROXY(SymbolRole); MAKE_REFLECT_TYPE_PROXY(SymbolRole);
MAKE_ENUM_HASHABLE(SymbolRole);
inline uint8_t operator&(SymbolRole lhs, SymbolRole rhs) { inline uint8_t operator&(SymbolRole lhs, SymbolRole rhs) {
return uint8_t(lhs) & uint8_t(rhs); return uint8_t(lhs) & uint8_t(rhs);

View File

@ -2319,7 +2319,8 @@ void Reflect(Reader& visitor, IndexFuncRef& value) {
if (str_value[0] == '~') { if (str_value[0] == '~') {
value.role = SymbolRole::Implicit; value.role = SymbolRole::Implicit;
++str_value; ++str_value;
} } else
value.role = SymbolRole::None;
RawId id = atol(str_value); RawId id = atol(str_value);
const char* loc_string = strchr(str_value, '@') + 1; const char* loc_string = strchr(str_value, '@') + 1;