/src/tools/semantics/code/features/liberty_feature_external.e

http://github.com/tybor/Liberty · Specman e · 132 lines · 99 code · 19 blank · 14 comment · 2 complexity · 3633edb697046bd0643f61e864b0e67e 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_FEATURE_EXTERNAL
  16. inherit
  17. LIBERTY_FEATURE
  18. rename
  19. make as make_late_binding
  20. redefine
  21. set_specialized_in
  22. end
  23. create {LIBERTY_BUILDER_TOOLS}
  24. make
  25. feature {ANY}
  26. external_def: FIXED_STRING
  27. alias_def: FIXED_STRING
  28. rescue_instruction: LIBERTY_INSTRUCTION
  29. feature {ANY}
  30. accept (v: VISITOR) is
  31. local
  32. v0: LIBERTY_FEATURE_EXTERNAL_VISITOR
  33. do
  34. v0 ::= v
  35. v0.visit_liberty_feature_external(Current)
  36. end
  37. feature {LIBERTY_FEATURE}
  38. set_specialized_in (a_original: like Current; a_context: like context) is
  39. do
  40. Precursor(a_original, a_context)
  41. if rescue_instruction /= Void then
  42. rescue_instruction := rescue_instruction.specialized_in(a_context.current_type)
  43. end
  44. end
  45. feature {LIBERTY_BUILDER_TOOLS}
  46. set_rescue (a_rescue: like rescue_instruction) is
  47. require
  48. rescue_instruction = Void
  49. a_rescue /= Void
  50. do
  51. rescue_instruction := a_rescue
  52. ensure
  53. rescue_instruction = a_rescue
  54. end
  55. feature {}
  56. do_join (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  57. do
  58. Result := a_feature.joined_external(a_type, Current, other_fd, current_fd)
  59. end
  60. feature {LIBERTY_FEATURE}
  61. joined_attribute (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_ATTRIBUTE; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  62. do
  63. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  64. end
  65. joined_constant (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_CONSTANT; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  66. do
  67. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  68. end
  69. joined_deferred (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_DEFERRED; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  70. do
  71. Result := Current
  72. end
  73. joined_do (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_DO; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  74. do
  75. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  76. end
  77. joined_external (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_EXTERNAL; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  78. do
  79. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  80. end
  81. joined_once (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_ONCE; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  82. do
  83. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  84. end
  85. joined_redefined (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_REDEFINED; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  86. do
  87. if a_feature.definition_type = definition_type then
  88. current_fd.fatal_join_error_concrete_redefined(a_type, other_fd)
  89. end
  90. Result := Current
  91. end
  92. joined_unique (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_UNIQUE; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  93. do
  94. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  95. end
  96. feature {}
  97. make (a_definition_type: like definition_type; a_external, a_alias: FIXED_STRING; a_accelerator: like accelerator) is
  98. require
  99. a_definition_type /= Void
  100. a_external /= Void
  101. a_accelerator /= Void
  102. do
  103. make_late_binding(a_definition_type, a_accelerator)
  104. external_def := a_external
  105. alias_def := a_alias
  106. ensure
  107. definition_type = a_definition_type
  108. external_def = a_external
  109. alias_def = a_alias
  110. end
  111. invariant
  112. external_def /= Void
  113. end