/src/tools/interpreter/liberty_interpreter_object_creator.e

http://github.com/tybor/Liberty · Specman e · 167 lines · 123 code · 30 blank · 14 comment · 0 complexity · 7fae6ce27e41d7995babe8432f007495 MD5 · raw file

  1. -- This file is part of Liberty Eiffel.
  2. --
  3. -- Liberty Eiffel is free software: you can redistribute it and/or modify
  4. -- it under the terms of the GNU General Public License as published by
  5. -- the Free Software Foundation, version 3 of the License.
  6. --
  7. -- Liberty Eiffel is distributed in the hope that it will be useful,
  8. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. -- GNU General Public License for more details.
  11. --
  12. -- You should have received a copy of the GNU General Public License
  13. -- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
  14. --
  15. class LIBERTY_INTERPRETER_OBJECT_CREATOR
  16. inherit
  17. LIBERTY_TYPE_VISITOR
  18. creation {LIBERTY_INTERPRETER}
  19. make
  20. feature {LIBERTY_INTERPRETER}
  21. new_object (type: LIBERTY_ACTUAL_TYPE; a_position: like position): LIBERTY_INTERPRETER_OBJECT is
  22. do
  23. position := a_position
  24. type.accept(Current)
  25. Result := last_created
  26. ensure
  27. Result.type = type
  28. end
  29. feature {LIBERTY_UNIVERSE}
  30. visit_type_any (type: LIBERTY_ACTUAL_TYPE) is
  31. do
  32. check False end
  33. end
  34. visit_type_arguments (type: LIBERTY_ACTUAL_TYPE) is
  35. do
  36. create {LIBERTY_INTERPRETER_OBJECT_STRUCTURE} last_created.make(interpreter, type, position)
  37. end
  38. visit_type_platform (type: LIBERTY_ACTUAL_TYPE) is
  39. do
  40. check False end
  41. end
  42. visit_type_pointer (type: LIBERTY_ACTUAL_TYPE) is
  43. do
  44. create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[POINTER]} last_created.make(interpreter, type, position)
  45. end
  46. visit_type_integer_64 (type: LIBERTY_ACTUAL_TYPE) is
  47. do
  48. create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[INTEGER_64]} last_created.make(interpreter, type, position)
  49. end
  50. visit_type_integer_32 (type: LIBERTY_ACTUAL_TYPE) is
  51. do
  52. create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[INTEGER_64]} last_created.make(interpreter, type, position)
  53. end
  54. visit_type_integer_16 (type: LIBERTY_ACTUAL_TYPE) is
  55. do
  56. create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[INTEGER_64]} last_created.make(interpreter, type, position)
  57. end
  58. visit_type_integer_8 (type: LIBERTY_ACTUAL_TYPE) is
  59. do
  60. create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[INTEGER_64]} last_created.make(interpreter, type, position)
  61. end
  62. visit_type_real_64 (type: LIBERTY_ACTUAL_TYPE) is
  63. do
  64. create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[REAL_128]} last_created.make(interpreter, type, position)
  65. end
  66. visit_type_real_32 (type: LIBERTY_ACTUAL_TYPE) is
  67. do
  68. create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[REAL_128]} last_created.make(interpreter, type, position)
  69. end
  70. visit_type_real_80 (type: LIBERTY_ACTUAL_TYPE) is
  71. do
  72. create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[REAL_128]} last_created.make(interpreter, type, position)
  73. end
  74. visit_type_real_128 (type: LIBERTY_ACTUAL_TYPE) is
  75. do
  76. create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[REAL_128]} last_created.make(interpreter, type, position)
  77. end
  78. visit_type_character (type: LIBERTY_ACTUAL_TYPE) is
  79. do
  80. create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[CHARACTER]} last_created.make(interpreter, type, position)
  81. end
  82. visit_type_string (type: LIBERTY_ACTUAL_TYPE) is
  83. do
  84. create {LIBERTY_INTERPRETER_OBJECT_STRUCTURE} last_created.make(interpreter, type, position)
  85. end
  86. visit_type_boolean (type: LIBERTY_ACTUAL_TYPE) is
  87. do
  88. create {LIBERTY_INTERPRETER_OBJECT_BOOLEAN} last_created.make(interpreter, type, position)
  89. end
  90. visit_type_native_array (type: LIBERTY_ACTUAL_TYPE) is
  91. do
  92. last_created := interpreter.new_array(type, 0, position)
  93. end
  94. visit_type_tuple (type: LIBERTY_ACTUAL_TYPE) is
  95. do
  96. create {LIBERTY_INTERPRETER_TUPLE} last_created.make(interpreter, type, position)
  97. end
  98. visit_type_routine (type: LIBERTY_ACTUAL_TYPE) is
  99. do
  100. create {LIBERTY_INTERPRETER_AGENT} last_created.make(interpreter, type, position)
  101. end
  102. visit_type_procedure (type: LIBERTY_ACTUAL_TYPE) is
  103. do
  104. create {LIBERTY_INTERPRETER_AGENT} last_created.make(interpreter, type, position)
  105. end
  106. visit_type_function (type: LIBERTY_ACTUAL_TYPE) is
  107. do
  108. create {LIBERTY_INTERPRETER_AGENT} last_created.make(interpreter, type, position)
  109. end
  110. visit_type_predicate (type: LIBERTY_ACTUAL_TYPE) is
  111. do
  112. create {LIBERTY_INTERPRETER_AGENT} last_created.make(interpreter, type, position)
  113. end
  114. visit_user_type (type: LIBERTY_ACTUAL_TYPE) is
  115. do
  116. create {LIBERTY_INTERPRETER_OBJECT_STRUCTURE} last_created.make(interpreter, type, position)
  117. end
  118. feature {LIBERTY_VOID_TYPE}
  119. visit_void (type: LIBERTY_VOID_TYPE) is
  120. do
  121. check False end
  122. end
  123. feature {}
  124. make (a_interpreter: like interpreter) is
  125. require
  126. a_interpreter /= Void
  127. do
  128. interpreter := a_interpreter
  129. ensure
  130. interpreter = a_interpreter
  131. end
  132. position: LIBERTY_POSITION
  133. last_created: LIBERTY_INTERPRETER_OBJECT
  134. interpreter: LIBERTY_INTERPRETER
  135. invariant
  136. interpreter /= Void
  137. end -- class LIBERTY_INTERPRETER_OBJECT_CREATOR