mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Use std::shared_ptr for fstack nodes (#1371)
This commit is contained in:
@@ -97,15 +97,13 @@ static void dumpFilename(Symbol const &sym) {
|
||||
|
||||
// Update a symbol's definition filename and line
|
||||
static void updateSymbolFilename(Symbol &sym) {
|
||||
FileStackNode *oldSrc = sym.src;
|
||||
|
||||
std::shared_ptr<FileStackNode> oldSrc = std::move(sym.src);
|
||||
sym.src = fstk_GetFileStack();
|
||||
sym.fileLine = sym.src ? lexer_GetLineNo() : 0;
|
||||
|
||||
// If the old node was referenced, ensure the new one is
|
||||
if (oldSrc && oldSrc->referenced && oldSrc->ID != (uint32_t)-1)
|
||||
// If the old node was registered, ensure the new one is too
|
||||
if (oldSrc && oldSrc->ID != (uint32_t)-1)
|
||||
out_RegisterNode(sym.src);
|
||||
// TODO: unref the old node, and use `out_ReplaceNode` instead of deleting it
|
||||
}
|
||||
|
||||
// Create a new symbol by name
|
||||
|
||||
Reference in New Issue
Block a user