mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Store a pointer to the scoped label, not just its name
This commit is contained in:
@@ -31,7 +31,7 @@ struct UnionStackEntry {
|
||||
struct SectionStackEntry {
|
||||
Section *section;
|
||||
Section *loadSection;
|
||||
std::optional<std::string> scope; // Section's symbol scope
|
||||
Symbol const *scope;
|
||||
uint32_t offset;
|
||||
int32_t loadOffset;
|
||||
std::stack<UnionStackEntry> unionStack;
|
||||
@@ -44,7 +44,7 @@ std::unordered_map<std::string, size_t> sectionMap; // Indexes into `sectionList
|
||||
uint32_t curOffset; // Offset into the current section (see sect_GetSymbolOffset)
|
||||
Section *currentSection = nullptr;
|
||||
static Section *currentLoadSection = nullptr;
|
||||
std::optional<std::string> currentLoadScope = std::nullopt;
|
||||
static Symbol const *currentLoadScope = nullptr;
|
||||
int32_t loadOffset; // Offset into the LOAD section's parent (see sect_GetOutputOffset)
|
||||
|
||||
// A quick check to see if we have an initialized section
|
||||
@@ -395,7 +395,7 @@ static void changeSection() {
|
||||
if (!currentUnionStack.empty())
|
||||
fatalerror("Cannot change the section within a UNION\n");
|
||||
|
||||
sym_SetCurrentSymbolScope(std::nullopt);
|
||||
sym_SetCurrentSymbolScope(nullptr);
|
||||
}
|
||||
|
||||
bool Section::isSizeKnown() const {
|
||||
@@ -944,7 +944,7 @@ void sect_PushSection() {
|
||||
// Reset the section scope
|
||||
currentSection = nullptr;
|
||||
currentLoadSection = nullptr;
|
||||
sym_SetCurrentSymbolScope(std::nullopt);
|
||||
sym_SetCurrentSymbolScope(nullptr);
|
||||
std::swap(currentUnionStack, sectionStack.front().unionStack);
|
||||
}
|
||||
|
||||
@@ -979,5 +979,5 @@ void sect_EndSection() {
|
||||
|
||||
// Reset the section scope
|
||||
currentSection = nullptr;
|
||||
sym_SetCurrentSymbolScope(std::nullopt);
|
||||
sym_SetCurrentSymbolScope(nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user