PageRenderTime 25ms CodeModel.GetById 20ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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