rt-object.inline.h 994 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef AFUN_RT_OBJECT_INLINE_H
  2. #define AFUN_RT_OBJECT_INLINE_H
  3. #include "rt-object.h"
  4. namespace aFunrt {
  5. size_t VarSpace::getCount() {
  6. std::unique_lock<std::mutex> mutex{lock};
  7. return var.size();
  8. }
  9. aFuncore::Object *VarSpace::findObject(const std::string &name) {
  10. Var *ret = findVar(name);
  11. return ret ? ret->getData() : nullptr;
  12. }
  13. Function::CallFunction::ArgCodeList::ArgCodeList(const aFuncode::Code::ByteCode *code_) : code{code_}, ret{nullptr} {
  14. }
  15. Function::CallFunction::ArgCodeList::~ArgCodeList() {
  16. if (ret != nullptr)
  17. ret->delReference();
  18. }
  19. aFuncore::Object *Function::CallFunction::ArgCodeList::setObject(Object *res) {
  20. Object *obj = ret;
  21. ret = res;
  22. if (ret != nullptr)
  23. ret->addReference();
  24. return obj;
  25. }
  26. aFuncore::Object *Function::CallFunction::ArgCodeList::getObject() {
  27. return ret;
  28. }
  29. };
  30. #endif //AFUN_RT_OBJECT_INLINE_H