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

http://github.com/tybor/Liberty · Specman e · 82 lines · 54 code · 11 blank · 17 comment · 3 complexity · 13dcd6f1ee7a09c1ba17843286d1144d 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_TYPE_RESOLVER_IN_INLINE_AGENT
  16. inherit
  17. LIBERTY_TYPE_RESOLVER
  18. creation {LIBERTY_SEMANTICS_BUILDER}
  19. make
  20. feature {ANY}
  21. local_context: LIBERTY_INLINE_AGENT_CONTEXT
  22. out_in_tagged_out_memory is
  23. do
  24. tagged_out_memory.append(once "resolver in inline agent")
  25. end
  26. specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
  27. do
  28. Result := Current --| TODO: ???
  29. end
  30. feature {}
  31. lookup_type (type_definition: LIBERTY_AST_TYPE_DEFINITION): LIBERTY_TYPE is
  32. local
  33. name: FIXED_STRING
  34. do
  35. if type_definition.is_like_result then
  36. if local_context.result_type = Void then
  37. --|*** TODO: error: not a function
  38. not_yet_implemented
  39. end
  40. Result := local_context.result_type
  41. elseif type_definition.is_like_entity then
  42. -- If it's an anchor to a parameter or a local, resolve it immediately. (TODO: beware of cycles!)
  43. -- Other cases will be caught by parent resolvers.
  44. name := type_definition.entity_anchor.image.image.intern
  45. if local_context.is_parameter(name) then
  46. Result := local_context.parameter(name).result_type
  47. elseif local_context.is_local(name) then
  48. Result := local_context.local_var(name).result_type
  49. end
  50. end
  51. end
  52. lookup_export_type (type_definition: LIBERTY_AST_TYPE_DEFINITION): LIBERTY_TYPE is
  53. do
  54. check Result = Void end
  55. end
  56. lookup_position (type_definition: LIBERTY_AST_TYPE_DEFINITION): LIBERTY_POSITION is
  57. do
  58. check Result = Void end
  59. end
  60. feature {}
  61. make (a_local_context: like local_context) is
  62. require
  63. a_local_context /= Void
  64. do
  65. local_context := a_local_context
  66. ensure
  67. local_context = a_local_context
  68. end
  69. invariant
  70. local_context /= Void
  71. end -- class LIBERTY_TYPE_RESOLVER_IN_INLINE_AGENT