Skip to content

Commit

Permalink
fix(compiler): adding a guard on compileLetMutSet if we are passed so…
Browse files Browse the repository at this point in the history
…mething that isn't a symbol as the name of the variable
  • Loading branch information
SuperFola committed May 26, 2024
1 parent 7e0e1af commit 997061f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/arkreactor/Compiler/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ namespace Ark

void Compiler::compileLetMutSet(const Keyword n, const Node& x, const int p)
{
if (const auto sym = x.constList()[1]; sym.nodeType() != NodeType::Symbol)
throwCompilerError(fmt::format("Expected a symbol, got a {}", typeToString(sym)), sym);

const std::string name = x.constList()[1].string();
uint16_t i = addSymbol(x.constList()[1]);
if (n != Keyword::Set)
Expand Down

0 comments on commit 997061f

Please sign in to comment.