value.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef AFUN_VALUE_HPP
  2. #define AFUN_VALUE_HPP
  3. #include "tool.hpp"
  4. #include "aFunCoreExport.h"
  5. #include "list"
  6. #include "core.hpp"
  7. #include "gc.hpp"
  8. namespace aFuncore {
  9. class Object : public GcObject<class Object> {
  10. public:
  11. Inter *const inter;
  12. const std::string type; // 标识 Object 的字符串
  13. AFUN_CORE_EXPORT explicit Object(const std::string &type_, Inter *inter_);
  14. AFUN_CORE_EXPORT ~Object() override =default;
  15. };
  16. class Function : public Object {
  17. public:
  18. Function(const std::string &type_, Inter *inter_) : Object(type_, inter_) {}
  19. class CallFunction {
  20. public:
  21. struct ArgCodeList {
  22. Code *code = nullptr;
  23. Object *ret = nullptr;
  24. };
  25. virtual ~CallFunction()=default;
  26. virtual std::list<ArgCodeList> *getArgCodeList()=0;
  27. virtual ActivationStatus runFunction()=0;
  28. };
  29. virtual CallFunction *getCallFunction(Code *code, Inter *inter)=0;
  30. virtual bool isInfix() {return false;}
  31. };
  32. };
  33. #endif //AFUN_VALUE_HPP