A simple scripting language in C++
Ferenc Szontágh
2025-04-18 d092df5264f6e48f9d59650c092b8297382b1316
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 {