Skip to content

Commit

Permalink
Explain a Glaceon-confounding code decision
Browse files Browse the repository at this point in the history
  • Loading branch information
ISSOtm committed Dec 10, 2023
1 parent c5b43bd commit 3220b1b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/link/script.y
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ void yy::parser::error(std::string const &msg) {
}

static void includeFile(std::string &&path) {
// `emplace_back` can invalidate references to the stack's elements!
// This is why `newContext` must be gotten before `prevContext`.
auto &newContext = lexerStack.emplace_back(std::move(path));
auto &prevContext = lexerStack[lexerStack.size() - 2];

Expand Down

0 comments on commit 3220b1b

Please sign in to comment.