/src/tools/interpreter/liberty_interpreter_void.e

http://github.com/tybor/Liberty · Specman e · 128 lines · 92 code · 22 blank · 14 comment · 0 complexity · a7bcb0b354b28399b00c91e583f9b272 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_VOID
  16. inherit
  17. LIBERTY_INTERPRETER_OBJECT
  18. redefine
  19. as_target, is_void, builtin_deep_twin
  20. end
  21. creation {LIBERTY_INTERPRETER, LIBERTY_INTERPRETER_VOID}
  22. make
  23. feature {ANY}
  24. type: LIBERTY_KNOWN_TYPE
  25. is_void: BOOLEAN is True
  26. hash_code: INTEGER is 31
  27. is_equal (other: LIBERTY_INTERPRETER_OBJECT): BOOLEAN is
  28. do
  29. Result := other.is_void
  30. end
  31. converted_to (target_type: LIBERTY_ACTUAL_TYPE): LIBERTY_INTERPRETER_OBJECT is
  32. require else
  33. True
  34. do
  35. create {LIBERTY_INTERPRETER_VOID} Result.make(interpreter, target_type, position)
  36. end
  37. as_target (a_position: LIBERTY_POSITION): like Current is
  38. do
  39. interpreter.fatal_error("Call on Void target", a_position)
  40. Result := Current
  41. end
  42. feature {LIBERTY_INTERPRETER_EXTERNAL_TYPE_ANY_BUILTINS} -- Standard builtings
  43. builtin_is_equal (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION): BOOLEAN is
  44. do
  45. Result := other.is_void
  46. end
  47. builtin_standard_is_equal (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION): BOOLEAN is
  48. do
  49. Result := other.is_void
  50. end
  51. builtin_copy (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION) is
  52. do
  53. interpreter.fatal_error("Call on Void target", a_position)
  54. end
  55. builtin_twin (a_position: LIBERTY_POSITION): like Current is
  56. do
  57. interpreter.fatal_error("Call on Void target", a_position)
  58. end
  59. builtin_standard_copy (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION) is
  60. do
  61. interpreter.fatal_error("Call on Void target", a_position)
  62. end
  63. builtin_standard_twin (a_position: LIBERTY_POSITION): like Current is
  64. do
  65. interpreter.fatal_error("Call on Void target", a_position)
  66. end
  67. builtin_deep_twin (a_position: LIBERTY_POSITION): like Current is
  68. do
  69. interpreter.fatal_error("Call on Void target", a_position)
  70. end
  71. feature {LIBERTY_INTERPRETER_OBJECT_PRINTER, LIBERTY_INTERPRETER_FEATURE_CALL}
  72. show_stack (o: OUTPUT_STREAM; indent: INTEGER) is
  73. do
  74. o.put_line(once "Void")
  75. end
  76. feature {LIBERTY_INTERPRETER_OBJECT}
  77. do_deep_twin (deep_twin_memory: DICTIONARY[LIBERTY_INTERPRETER_OBJECT, LIBERTY_INTERPRETER_OBJECT]; a_position: LIBERTY_POSITION): LIBERTY_INTERPRETER_OBJECT is
  78. do
  79. Result := Current
  80. end
  81. do_deep_equal (object: LIBERTY_INTERPRETER_OBJECT; deep_equal_memory: SET[LIBERTY_INTERPRETER_OBJECT]; a_position: LIBERTY_POSITION): BOOLEAN is
  82. do
  83. Result := object.is_void
  84. end
  85. feature {}
  86. expanded_twin: like Current is
  87. do
  88. Result := Current
  89. end
  90. make (a_interpreter: like interpreter; a_type: like type; a_position: like position) is
  91. require
  92. a_interpreter /= Void
  93. a_type /= Void
  94. a_position /= Void
  95. do
  96. interpreter := a_interpreter
  97. type := a_type
  98. position := a_position
  99. ensure
  100. interpreter = a_interpreter
  101. type = a_type
  102. position = a_position
  103. end
  104. invariant
  105. type /= Void
  106. end -- class LIBERTY_INTERPRETER_VOID