From 4abeb5f8a6ad77b32496f3e8b20e1fd1b6f428fb Mon Sep 17 00:00:00 2001
From: Ferenc Szontágh <szf@fsociety.hu>
Date: Fri, 18 Apr 2025 07:54:40 +0000
Subject: [PATCH] function checking
---
src/Interpreter/Interpreter.hpp | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/Interpreter/Interpreter.hpp b/src/Interpreter/Interpreter.hpp
index cb617c8..b8e2ce8 100644
--- a/src/Interpreter/Interpreter.hpp
+++ b/src/Interpreter/Interpreter.hpp
@@ -6,6 +6,7 @@
#include "Interpreter/Operation.hpp"
#include "Interpreter/OperationContainer.hpp"
+#include "Symbols/SymbolContainer.hpp"
namespace Interpreter {
@@ -38,7 +39,13 @@
break;
}
- case Operations::Type::FunctionCall:
+ case Operations::Type::FunctionCall: {
+ // Check that the called function is defined in the symbol table
+ if (!Symbols::SymbolContainer::instance()->exists(op.targetName)) {
+ throw std::runtime_error("Function not declared: " + op.targetName);
+ }
+ break;
+ }
case Operations::Type::Return:
case Operations::Type::Loop:
case Operations::Type::Break:
@@ -47,7 +54,7 @@
case Operations::Type::Import:
case Operations::Type::Error:
case Operations::Type::Conditional:
- // TODO: implementálható később
+ // TODO: implement these operations later
break;
default:
throw std::runtime_error("Not implemented operation type");
--
Gitblit v1.9.3