/src/tools/interpreter/liberty_interpreter_object_creator.e
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-- 15class LIBERTY_INTERPRETER_OBJECT_CREATOR 16 17inherit 18 LIBERTY_TYPE_VISITOR 19 20creation {LIBERTY_INTERPRETER} 21 make 22 23feature {LIBERTY_INTERPRETER} 24 new_object (type: LIBERTY_ACTUAL_TYPE; a_position: like position): LIBERTY_INTERPRETER_OBJECT is 25 do 26 position := a_position 27 type.accept(Current) 28 Result := last_created 29 ensure 30 Result.type = type 31 end 32 33feature {LIBERTY_UNIVERSE} 34 visit_type_any (type: LIBERTY_ACTUAL_TYPE) is 35 do 36 check False end 37 end 38 39 visit_type_arguments (type: LIBERTY_ACTUAL_TYPE) is 40 do 41 create {LIBERTY_INTERPRETER_OBJECT_STRUCTURE} last_created.make(interpreter, type, position) 42 end 43 44 visit_type_platform (type: LIBERTY_ACTUAL_TYPE) is 45 do 46 check False end 47 end 48 49 visit_type_pointer (type: LIBERTY_ACTUAL_TYPE) is 50 do 51 create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[POINTER]} last_created.make(interpreter, type, position) 52 end 53 54 visit_type_integer_64 (type: LIBERTY_ACTUAL_TYPE) is 55 do 56 create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[INTEGER_64]} last_created.make(interpreter, type, position) 57 end 58 59 visit_type_integer_32 (type: LIBERTY_ACTUAL_TYPE) is 60 do 61 create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[INTEGER_64]} last_created.make(interpreter, type, position) 62 end 63 64 visit_type_integer_16 (type: LIBERTY_ACTUAL_TYPE) is 65 do 66 create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[INTEGER_64]} last_created.make(interpreter, type, position) 67 end 68 69 visit_type_integer_8 (type: LIBERTY_ACTUAL_TYPE) is 70 do 71 create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[INTEGER_64]} last_created.make(interpreter, type, position) 72 end 73 74 visit_type_real_64 (type: LIBERTY_ACTUAL_TYPE) is 75 do 76 create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[REAL_128]} last_created.make(interpreter, type, position) 77 end 78 79 visit_type_real_32 (type: LIBERTY_ACTUAL_TYPE) is 80 do 81 create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[REAL_128]} last_created.make(interpreter, type, position) 82 end 83 84 visit_type_real_80 (type: LIBERTY_ACTUAL_TYPE) is 85 do 86 create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[REAL_128]} last_created.make(interpreter, type, position) 87 end 88 89 visit_type_real_128 (type: LIBERTY_ACTUAL_TYPE) is 90 do 91 create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[REAL_128]} last_created.make(interpreter, type, position) 92 end 93 94 visit_type_character (type: LIBERTY_ACTUAL_TYPE) is 95 do 96 create {LIBERTY_INTERPRETER_OBJECT_HASHABLE[CHARACTER]} last_created.make(interpreter, type, position) 97 end 98 99 visit_type_string (type: LIBERTY_ACTUAL_TYPE) is 100 do 101 create {LIBERTY_INTERPRETER_OBJECT_STRUCTURE} last_created.make(interpreter, type, position) 102 end 103 104 visit_type_boolean (type: LIBERTY_ACTUAL_TYPE) is 105 do 106 create {LIBERTY_INTERPRETER_OBJECT_BOOLEAN} last_created.make(interpreter, type, position) 107 end 108 109 visit_type_native_array (type: LIBERTY_ACTUAL_TYPE) is 110 do 111 last_created := interpreter.new_array(type, 0, position) 112 end 113 114 visit_type_tuple (type: LIBERTY_ACTUAL_TYPE) is 115 do 116 create {LIBERTY_INTERPRETER_TUPLE} last_created.make(interpreter, type, position) 117 end 118 119 visit_type_routine (type: LIBERTY_ACTUAL_TYPE) is 120 do 121 create {LIBERTY_INTERPRETER_AGENT} last_created.make(interpreter, type, position) 122 end 123 124 visit_type_procedure (type: LIBERTY_ACTUAL_TYPE) is 125 do 126 create {LIBERTY_INTERPRETER_AGENT} last_created.make(interpreter, type, position) 127 end 128 129 visit_type_function (type: LIBERTY_ACTUAL_TYPE) is 130 do 131 create {LIBERTY_INTERPRETER_AGENT} last_created.make(interpreter, type, position) 132 end 133 134 visit_type_predicate (type: LIBERTY_ACTUAL_TYPE) is 135 do 136 create {LIBERTY_INTERPRETER_AGENT} last_created.make(interpreter, type, position) 137 end 138 139 visit_user_type (type: LIBERTY_ACTUAL_TYPE) is 140 do 141 create {LIBERTY_INTERPRETER_OBJECT_STRUCTURE} last_created.make(interpreter, type, position) 142 end 143 144feature {LIBERTY_VOID_TYPE} 145 visit_void (type: LIBERTY_VOID_TYPE) is 146 do 147 check False end 148 end 149 150feature {} 151 make (a_interpreter: like interpreter) is 152 require 153 a_interpreter /= Void 154 do 155 interpreter := a_interpreter 156 ensure 157 interpreter = a_interpreter 158 end 159 160 position: LIBERTY_POSITION 161 last_created: LIBERTY_INTERPRETER_OBJECT 162 interpreter: LIBERTY_INTERPRETER 163 164invariant 165 interpreter /= Void 166 167end -- class LIBERTY_INTERPRETER_OBJECT_CREATOR