From 997061f1a62aba74873293ee24fa577b11d46671 Mon Sep 17 00:00:00 2001 From: Alexandre Plateau Date: Sun, 26 May 2024 19:59:33 +0200 Subject: [PATCH] fix(compiler): adding a guard on compileLetMutSet if we are passed something that isn't a symbol as the name of the variable --- src/arkreactor/Compiler/Compiler.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/arkreactor/Compiler/Compiler.cpp b/src/arkreactor/Compiler/Compiler.cpp index 8a5828655..3af699d59 100644 --- a/src/arkreactor/Compiler/Compiler.cpp +++ b/src/arkreactor/Compiler/Compiler.cpp @@ -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)