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

http://github.com/tybor/Liberty · Specman e · 113 lines · 82 code · 17 blank · 14 comment · 1 complexity · e888102143708c36e7006d99463a28d7 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_CONSTANT
  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. expression: LIBERTY_EXPRESSION
  27. feature {ANY}
  28. accept (v: VISITOR) is
  29. local
  30. v0: LIBERTY_FEATURE_CONSTANT_VISITOR
  31. do
  32. v0 ::= v
  33. v0.visit_liberty_feature_constant(Current)
  34. end
  35. feature {LIBERTY_FEATURE}
  36. set_specialized_in (a_original: like Current; a_context: like context) is
  37. do
  38. Precursor(a_original, a_context)
  39. expression := expression.specialized_in(a_context.current_type)
  40. end
  41. feature {}
  42. do_join (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  43. do
  44. Result := a_feature.joined_constant(a_type, Current, other_fd, current_fd)
  45. end
  46. feature {LIBERTY_FEATURE}
  47. joined_attribute (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_ATTRIBUTE; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  48. do
  49. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  50. end
  51. joined_constant (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_CONSTANT; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  52. do
  53. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  54. end
  55. joined_deferred (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_DEFERRED; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  56. do
  57. Result := Current
  58. end
  59. joined_do (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_DO; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  60. do
  61. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  62. end
  63. joined_external (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_EXTERNAL; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  64. do
  65. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  66. end
  67. joined_once (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_ONCE; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  68. do
  69. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  70. end
  71. joined_redefined (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_REDEFINED; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  72. do
  73. if a_feature.definition_type = definition_type then
  74. current_fd.fatal_join_error_concrete_redefined(a_type, other_fd)
  75. end
  76. Result := Current
  77. end
  78. joined_unique (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_UNIQUE; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is
  79. do
  80. current_fd.fatal_join_error_concrete_concrete(a_type, other_fd)
  81. end
  82. feature {}
  83. make (a_definition_type: like definition_type; a_expression: like expression) is
  84. require
  85. a_definition_type /= Void
  86. a_expression /= Void
  87. do
  88. make_late_binding(a_definition_type, Void)
  89. expression := a_expression
  90. ensure
  91. definition_type = a_definition_type
  92. expression = a_expression
  93. end
  94. invariant
  95. expression /= Void
  96. end