From d092df5264f6e48f9d59650c092b8297382b1316 Mon Sep 17 00:00:00 2001
From: Ferenc Szontágh <szf@fsociety.hu>
Date: Fri, 18 Apr 2025 21:16:43 +0000
Subject: [PATCH] some built-in io module
---
src/Interpreter/DeclareFunctionStatementNode.hpp | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/Interpreter/DeclareFunctionStatementNode.hpp b/src/Interpreter/DeclareFunctionStatementNode.hpp
index f2ddb04..9290de5 100644
--- a/src/Interpreter/DeclareFunctionStatementNode.hpp
+++ b/src/Interpreter/DeclareFunctionStatementNode.hpp
@@ -37,12 +37,17 @@
ns(ns) {}
void interpret(Interpreter & /*interpreter*/) const override {
- //Symbols::Value value = expression_->evaluate(interpreter);
- if (Symbols::SymbolContainer::instance()->exists(functionName_)) {
- throw Exception("Function already declared: " + functionName_, filename_, line_, column_);
+ try {
+ if (Symbols::SymbolContainer::instance()->exists(functionName_)) {
+ throw Exception("Function already declared: " + functionName_, filename_, line_, column_);
+ }
+ const auto func = Symbols::SymbolFactory::createFunction(functionName_, ns, params_, "", returnType_);
+ Symbols::SymbolContainer::instance()->add(func);
+ } catch (const Exception &) {
+ throw;
+ } catch (const std::exception &e) {
+ throw Exception(e.what(), filename_, line_, column_);
}
- const auto func = Symbols::SymbolFactory::createFunction(functionName_, ns, params_, "", returnType_);
- Symbols::SymbolContainer::instance()->add(func);
}
std::string toString() const override {
--
Gitblit v1.9.3