rt-message.cpp 1.1 KB

123456789101112131415161718192021222324252627282930
  1. #include "rt-message.h"
  2. namespace aFunrt {
  3. NormalMessage::NormalMessage(aFuncore::Object *obj_) : obj {obj_} {
  4. obj->addReference();
  5. }
  6. NormalMessage::~NormalMessage(){
  7. if (obj != nullptr) {
  8. obj->delReference();
  9. obj = nullptr;
  10. }
  11. }
  12. void NormalMessage::topProgress(aFuncore::Inter &inter, aFuncore::Activation &){
  13. inter.getOutMessageStream().pushMessage("NORMAL", new NormalMessage(std::move(*this)));
  14. }
  15. ErrorMessage::ErrorMessage(std::string error_type_, std::string error_info_, aFuncore::Inter &inter)
  16. : inter{inter}, error_type{std::move(error_type_)}, error_info{std::move(error_info_)} {
  17. for (const auto activation : inter.getStack()) {
  18. if (activation->getFileLine() != 0)
  19. trackback.push_front({activation->getFilePath(), activation->getFileLine()});
  20. }
  21. }
  22. void ErrorMessage::topProgress(aFuncore::Inter &inter_, aFuncore::Activation &){
  23. inter_.getOutMessageStream().pushMessage("ERROR", new ErrorMessage(std::move(*this)));
  24. }
  25. }