value.cpp 658 B

12345678910111213141516171819202122
  1. #include "value.h"
  2. #include "inter.h"
  3. #include "init.h"
  4. namespace aFuncore {
  5. Object::Object(std::string type_, Inter &inter)
  6. : type{std::move(type_)}, env{inter.getEnvironment()}{
  7. std::unique_lock<std::mutex> mutex{env.lock};
  8. this->addObject(env.obj);
  9. }
  10. Object::Object(std::string type_, Environment &env_)
  11. : type{std::move(type_)}, env{env_}{
  12. std::unique_lock<std::mutex> mutex{env.lock};
  13. this->addObject(env.obj);
  14. }
  15. Object::~Object() {
  16. if (getReference() != 0)
  17. warningLog(aFunCoreLogger, "Object %p destruct reference: %d", this, getReference());
  18. }
  19. }