#pragma once #include "List.hpp" #include "Map.hpp" #include "Instructions.hpp" #include "Statements.hpp" #include "Constants.hpp" #include namespace tp::obj { struct MethodObject; struct FunctionDefinition { FunctionDefinition* mPrnt = nullptr; // signature std::string mFunctionId; List mArgsOrder; ConstObjectsPool mConstants; Map mLocals; List mInstructions; FunctionDefinition(const std::string& function_id, const Buffer& args, FunctionDefinition* prnt); FunctionDefinition() {} void generateByteCode(ByteCode& out); List::Node* inst(Instruction inst); void EvalExpr(Expression* expr); void EvalStatement(Statement* expr); ConstObject* defineLocal(const std::string& id); }; void initialize(); void finalize(); void Generate(ByteCode& out, StatementScope* body); bool Compile(MethodObject* obj); }