PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

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