/src/tools/semantics/types/type_resolver/liberty_type_lookup.e

http://github.com/tybor/Liberty · 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. --
  15. expanded 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. insert
  22. LOGGING
  23. feature {ANY}
  24. push (r: like resolver) is
  25. require
  26. r /= Void
  27. do
  28. r.set_parent(resolver)
  29. resolver_memory.set_item(r)
  30. debug
  31. log.trace.put_string(once " >>> Type Lookup: pushed ")
  32. log.trace.put_line(r.out)
  33. end
  34. ensure
  35. resolver = r
  36. end
  37. pop is
  38. require
  39. resolver /= Void
  40. local
  41. r: like resolver
  42. do
  43. debug
  44. r := resolver
  45. end
  46. resolver_memory.set_item(resolver.parent)
  47. debug
  48. log.trace.put_string(once " <<< Type Lookup: popped ")
  49. log.trace.put_string(r.out)
  50. if resolver /= Void then
  51. log.trace.put_string(once ", back to ")
  52. log.trace.put_line(resolver.out)
  53. else
  54. log.trace.put_new_line
  55. end
  56. end
  57. end
  58. resolver: LIBERTY_TYPE_RESOLVER is
  59. do
  60. Result := resolver_memory.item
  61. end
  62. universe: LIBERTY_UNIVERSE is
  63. do
  64. Result := universe_memory.item
  65. end
  66. feature {LIBERTY_UNIVERSE}
  67. set_universe (a_universe: LIBERTY_UNIVERSE) is
  68. require
  69. a_universe /= Void
  70. universe = Void
  71. do
  72. universe_memory.set_item(a_universe)
  73. ensure
  74. universe = a_universe
  75. end
  76. feature {}
  77. resolver_memory: REFERENCE[LIBERTY_TYPE_RESOLVER] is
  78. once
  79. create Result
  80. end
  81. universe_memory: REFERENCE[LIBERTY_UNIVERSE] is
  82. once
  83. create Result
  84. end
  85. end -- class LIBERTY_TYPE_LOOKUP