/src/tools/semantics/types/type_resolver/liberty_type_lookup.e
Specman e | 94 lines | 66 code | 9 blank | 19 comment | 1 complexity | e2e2c75b22ac501c169a1ddb4990ee22 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-- 15expanded class LIBERTY_TYPE_LOOKUP 16-- 17-- Access and manipulation of LIBERTY_TYPE_RESOLVER contexts. 18-- 19-- It avoids having method signatures longer than humanly legible. 20-- 21 22insert 23 LOGGING 24 25feature {ANY} 26 push (r: like resolver) is 27 require 28 r /= Void 29 do 30 r.set_parent(resolver) 31 resolver_memory.set_item(r) 32 debug 33 log.trace.put_string(once " >>> Type Lookup: pushed ") 34 log.trace.put_line(r.out) 35 end 36 ensure 37 resolver = r 38 end 39 40 pop is 41 require 42 resolver /= Void 43 local 44 r: like resolver 45 do 46 debug 47 r := resolver 48 end 49 resolver_memory.set_item(resolver.parent) 50 debug 51 log.trace.put_string(once " <<< Type Lookup: popped ") 52 log.trace.put_string(r.out) 53 if resolver /= Void then 54 log.trace.put_string(once ", back to ") 55 log.trace.put_line(resolver.out) 56 else 57 log.trace.put_new_line 58 end 59 end 60 end 61 62 resolver: LIBERTY_TYPE_RESOLVER is 63 do 64 Result := resolver_memory.item 65 end 66 67 universe: LIBERTY_UNIVERSE is 68 do 69 Result := universe_memory.item 70 end 71 72feature {LIBERTY_UNIVERSE} 73 set_universe (a_universe: LIBERTY_UNIVERSE) is 74 require 75 a_universe /= Void 76 universe = Void 77 do 78 universe_memory.set_item(a_universe) 79 ensure 80 universe = a_universe 81 end 82 83feature {} 84 resolver_memory: REFERENCE[LIBERTY_TYPE_RESOLVER] is 85 once 86 create Result 87 end 88 89 universe_memory: REFERENCE[LIBERTY_UNIVERSE] is 90 once 91 create Result 92 end 93 94end -- class LIBERTY_TYPE_LOOKUP