code.inline.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef AFUN_CODE_INLINE_H
  2. #define AFUN_CODE_INLINE_H
  3. #include "code.h"
  4. namespace aFuncore {
  5. inline Code::Code(aFuntool::FilePath file_) : code{new ByteCode(*this, 0)}, file{std::move(file_)} {
  6. }
  7. inline Code::ByteCode *Code::getByteCode() const{
  8. return code;
  9. }
  10. inline const aFuntool::FilePath &Code::getFilePath() const{
  11. return file;
  12. }
  13. inline Code::ByteCode::CodeType Code::ByteCode::getType() const {
  14. return type;
  15. }
  16. inline char Code::ByteCode::getPrefix() const {
  17. return prefix;
  18. }
  19. inline const char *Code::ByteCode::getElement() const {
  20. if (type != code_element)
  21. return "";
  22. return data.element;
  23. }
  24. inline Code::ByteCode::BlockType Code::ByteCode::getBlockType() const {
  25. if (type != code_block)
  26. return block_p;
  27. return data.block_type;
  28. }
  29. inline Code::ByteCode *Code::ByteCode::getSon() const {
  30. if (type != code_block)
  31. return nullptr;
  32. return data.son;
  33. }
  34. inline Code::ByteCode *Code::ByteCode::toNext() const {
  35. return next;
  36. }
  37. inline Code::ByteCode *Code::ByteCode::toPrev() const {
  38. return prev;
  39. }
  40. inline Code::ByteCode *Code::ByteCode::toFather() const {
  41. return father;
  42. }
  43. inline aFuntool::FileLine Code::ByteCode::getFileLine() const {
  44. return line;
  45. }
  46. inline const aFuntool::FilePath &Code::ByteCode::getFilePath() const{
  47. return belong.getFilePath();
  48. }
  49. inline Code::ByteCode::CodeData::CodeData() : element{nullptr} {
  50. }
  51. }
  52. #endif //AFUN_CODE_INLINE_H