/src/tools/semantics/code/features/liberty_feature_constant.e
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-- 15class LIBERTY_FEATURE_CONSTANT 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 expression: LIBERTY_EXPRESSION 30 31feature {ANY} 32 accept (v: VISITOR) is 33 local 34 v0: LIBERTY_FEATURE_CONSTANT_VISITOR 35 do 36 v0 ::= v 37 v0.visit_liberty_feature_constant(Current) 38 end 39 40feature {LIBERTY_FEATURE} 41 set_specialized_in (a_original: like Current; a_context: like context) is 42 do 43 Precursor(a_original, a_context) 44 expression := expression.specialized_in(a_context.current_type) 45 end 46 47feature {} 48 do_join (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is 49 do 50 Result := a_feature.joined_constant(a_type, Current, other_fd, current_fd) 51 end 52 53feature {LIBERTY_FEATURE} 54 joined_attribute (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_ATTRIBUTE; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is 55 do 56 current_fd.fatal_join_error_concrete_concrete(a_type, other_fd) 57 end 58 59 joined_constant (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_CONSTANT; 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 64 joined_deferred (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_DEFERRED; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is 65 do 66 Result := Current 67 end 68 69 joined_do (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_DO; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is 70 do 71 current_fd.fatal_join_error_concrete_concrete(a_type, other_fd) 72 end 73 74 joined_external (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_EXTERNAL; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is 75 do 76 current_fd.fatal_join_error_concrete_concrete(a_type, other_fd) 77 end 78 79 joined_once (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_ONCE; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is 80 do 81 current_fd.fatal_join_error_concrete_concrete(a_type, other_fd) 82 end 83 84 joined_redefined (a_type: LIBERTY_ACTUAL_TYPE; a_feature: LIBERTY_FEATURE_REDEFINED; current_fd, other_fd: LIBERTY_FEATURE_DEFINITION): LIBERTY_FEATURE is 85 do 86 if a_feature.definition_type = definition_type then 87 current_fd.fatal_join_error_concrete_redefined(a_type, other_fd) 88 end 89 Result := Current 90 end 91 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 97feature {} 98 make (a_definition_type: like definition_type; a_expression: like expression) is 99 require 100 a_definition_type /= Void 101 a_expression /= Void 102 do 103 make_late_binding(a_definition_type, Void) 104 expression := a_expression 105 ensure 106 definition_type = a_definition_type 107 expression = a_expression 108 end 109 110invariant 111 expression /= Void 112 113end