mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Implement ENDSECTION (#1211)
This commit is contained in:
@@ -598,7 +598,7 @@ void sect_EndUnion(void)
|
||||
void sect_CheckUnionClosed(void)
|
||||
{
|
||||
if (unionStack)
|
||||
error("Unterminated UNION construct!\n");
|
||||
error("Unterminated UNION construct\n");
|
||||
}
|
||||
|
||||
// Output an absolute byte
|
||||
@@ -965,7 +965,7 @@ void sect_PopSection(void)
|
||||
fatalerror("No entries in the section stack\n");
|
||||
|
||||
if (currentLoadSection)
|
||||
fatalerror("Cannot change the section within a `LOAD` block!\n");
|
||||
fatalerror("Cannot change the section within a `LOAD` block\n");
|
||||
|
||||
struct SectionStackEntry *entry = sectionStack;
|
||||
|
||||
@@ -981,6 +981,22 @@ void sect_PopSection(void)
|
||||
free(entry);
|
||||
}
|
||||
|
||||
void sect_EndSection(void)
|
||||
{
|
||||
if (!currentSection)
|
||||
fatalerror("Cannot end the section outside of a SECTION\n");
|
||||
|
||||
if (currentLoadSection)
|
||||
fatalerror("Cannot end the section within a `LOAD` block\n");
|
||||
|
||||
if (unionStack)
|
||||
fatalerror("Cannot end the section within a UNION\n");
|
||||
|
||||
// Reset the section scope
|
||||
currentSection = NULL;
|
||||
sym_SetCurrentSymbolScope(NULL);
|
||||
}
|
||||
|
||||
bool sect_IsSizeKnown(struct Section const NONNULL(sect))
|
||||
{
|
||||
// SECTION UNION and SECTION FRAGMENT can still grow
|
||||
|
||||
Reference in New Issue
Block a user