mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Replace Either with std::variant (#1731)
This commit is contained in:
@@ -418,11 +418,11 @@ void sdobj_ReadFile(FileStackNode const &where, FILE *file, std::vector<Symbol>
|
||||
// The same symbol can only be defined twice if neither
|
||||
// definition is in a floating section
|
||||
auto checkSymbol = [](Symbol const &sym) -> std::tuple<Section *, int32_t> {
|
||||
if (sym.data.holds<Label>()) {
|
||||
Label const &label = sym.data.get<Label>();
|
||||
if (std::holds_alternative<Label>(sym.data)) {
|
||||
Label const &label = std::get<Label>(sym.data);
|
||||
return {label.section, label.offset};
|
||||
}
|
||||
return {nullptr, sym.data.get<int32_t>()};
|
||||
return {nullptr, std::get<int32_t>(sym.data)};
|
||||
};
|
||||
auto [symbolSection, symbolValue] = checkSymbol(symbol);
|
||||
auto [otherSection, otherValue] = checkSymbol(*other);
|
||||
@@ -929,8 +929,8 @@ void sdobj_ReadFile(FileStackNode const &where, FILE *file, std::vector<Symbol>
|
||||
// This has to run **after** all the `sect_AddSection()` calls,
|
||||
// so that `sect_GetSection()` will work
|
||||
for (Symbol &sym : fileSymbols) {
|
||||
if (sym.data.holds<Label>()) {
|
||||
Label &label = sym.data.get<Label>();
|
||||
if (std::holds_alternative<Label>(sym.data)) {
|
||||
Label &label = std::get<Label>(sym.data);
|
||||
if (Section *section = label.section; section->modifier != SECTION_NORMAL) {
|
||||
if (section->modifier == SECTION_FRAGMENT) {
|
||||
// Add the fragment's offset to the symbol's
|
||||
|
||||
Reference in New Issue
Block a user