/src/tools/semantics/code/instructions/liberty_call_instruction.e
Specman e | 105 lines | 79 code | 12 blank | 14 comment | 3 complexity | 18473a78c5f5abacfb594385ddfb78b7 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_CALL_INSTRUCTION 16 17inherit 18 LIBERTY_INSTRUCTION 19 LIBERTY_CALL 20 21create {LIBERTY_BUILDER_TOOLS, LIBERTY_CALL_INSTRUCTION} 22 make, implicit_current 23 24feature {ANY} 25 target: LIBERTY_EXPRESSION 26 entity: LIBERTY_FEATURE_ENTITY 27 28feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER} 29 mark_reachable_code (mark: INTEGER) is 30 do 31 if target /= Void then 32 target.mark_reachable_code(mark) 33 end 34 entity.mark_reachable_code(mark) 35 expressions_marker.mark_reachable_code(mark, actuals) 36 end 37 38feature {} 39 make (a_target: like target; a_entity: like entity; a_actuals: like actuals_list; a_position: like position) is 40 require 41 a_target /= Void 42 a_entity /= Void 43 a_actuals /= Void 44 a_position /= Void 45 do 46 target := a_target 47 entity := a_entity 48 actuals_list := a_actuals 49 position := a_position 50 register_for_promotion 51 ensure 52 target = a_target or else {LIBERTY_CAST_EXPRESSION} ?:= target 53 entity = a_entity 54 actuals_list = a_actuals 55 position = a_position 56 end 57 58 implicit_current (a_entity: like entity; a_actuals: like actuals_list; a_position: like position) is 59 require 60 a_entity /= Void 61 a_actuals /= Void 62 a_position /= Void 63 do 64 entity := a_entity 65 actuals_list := a_actuals 66 position := a_position 67 ensure 68 is_implicit_current 69 entity = a_entity 70 actuals_list = a_actuals 71 position = a_position 72 end 73 74 actuals_list: COLLECTION[LIBERTY_EXPRESSION] 75 76 make_new (a_target: like target; a_entity: like entity; a_actuals: like actuals_list; a_position: like position): like Current is 77 do 78 if a_target = Void then 79 create Result.implicit_current(a_entity, a_actuals, a_position) 80 else 81 create Result.make(a_target, a_entity, a_actuals, a_position) 82 end 83 end 84 85feature {LIBERTY_CALL_PROMOTION} 86 set_entity (a_entity: like entity) is 87 do 88 entity := a_entity 89 end 90 91 set_target (a_target: like target) is 92 do 93 target := a_target 94 end 95 96feature {ANY} 97 accept (v: VISITOR) is 98 local 99 v0: LIBERTY_CALL_INSTRUCTION_VISITOR 100 do 101 v0 ::= v 102 v0.visit_liberty_call_instruction(Current) 103 end 104 105end