1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +00:00

LibCpp: Parse enum members with explicit values

This commit is contained in:
Ali Mohammad Pur 2021-07-28 04:15:22 +04:30 committed by Andreas Kling
parent 67a19eaecb
commit 8fefbfd5ac
3 changed files with 16 additions and 4 deletions

View file

@ -616,11 +616,15 @@ public:
};
void set_type(Type type) { m_type = type; }
void add_entry(StringView entry) { m_entries.append(move(entry)); }
void add_entry(StringView entry, RefPtr<Expression> value = nullptr) { m_entries.append({ entry, move(value) }); }
private:
Type m_type { Type::RegularEnum };
Vector<StringView> m_entries;
struct EnumerationEntry {
StringView name;
RefPtr<Expression> value;
};
Vector<EnumerationEntry> m_entries;
};
class StructOrClassDeclaration : public Declaration {