PageRenderTime 19ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/src/tools/semantics/code/expressions/liberty_prefix_call.e

http://github.com/tybor/Liberty
Specman e | 104 lines | 76 code | 14 blank | 14 comment | 1 complexity | 2130c6a65827b60a1861dbf18ed197bc 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--
 15deferred class LIBERTY_PREFIX_CALL
 16
 17inherit
 18   LIBERTY_EXPRESSION
 19
 20insert
 21   LIBERTY_CALL
 22
 23feature {ANY}
 24   target: LIBERTY_EXPRESSION
 25   entity: LIBERTY_FEATURE_ENTITY
 26
 27   result_type: LIBERTY_TYPE is
 28      do
 29         Result := entity.result_type
 30      end
 31
 32feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
 33   mark_reachable_code (mark: INTEGER) is
 34      do
 35         target.mark_reachable_code(mark)
 36         entity.mark_reachable_code(mark)
 37      end
 38
 39feature {}
 40   make (a_target: like target; a_entity_builder: FUNCTION[TUPLE[LIBERTY_TYPE, LIBERTY_FEATURE_NAME], LIBERTY_FEATURE_ENTITY]; a_position: like position) is
 41      require
 42         a_target /= Void
 43         a_entity_builder /= Void
 44         a_position /= Void
 45      do
 46         create prefix_name.make_prefix(the_prefix_name, a_position)
 47         target := a_target
 48         entity := a_entity_builder.item([a_target.result_type, prefix_name])
 49         position := a_position
 50         register_for_promotion
 51      ensure
 52         position = a_position
 53      end
 54
 55   new (a_target: like target; a_entity: like entity; a_actuals: like actuals_list; a_position: like position) is
 56      require
 57         a_target /= Void
 58         a_actuals.is_empty
 59         a_position /= Void
 60      do
 61         check a_actuals = actuals_list end
 62         target := a_target
 63         entity := a_entity
 64         position := a_position
 65      ensure
 66         target = a_target or else {LIBERTY_CAST_EXPRESSION} ?:= target
 67         entity = a_entity
 68         actuals_list = a_actuals
 69         position = a_position
 70      end
 71
 72   prefix_name: LIBERTY_FEATURE_NAME is
 73      attribute
 74      ensure
 75         Result.is_prefix
 76      end
 77
 78   the_prefix_name: FIXED_STRING is
 79      deferred
 80      ensure
 81         Result /= Void
 82      end
 83
 84   actuals_list: COLLECTION[LIBERTY_EXPRESSION] is
 85      once
 86         create {FAST_ARRAY[LIBERTY_EXPRESSION]} Result.with_capacity(0)
 87      end
 88
 89feature {LIBERTY_CALL_PROMOTION}
 90   set_entity (a_entity: like entity) is
 91      do
 92         entity := a_entity
 93      end
 94
 95   set_target (a_target: like target) is
 96      do
 97         target := a_target
 98      end
 99
100invariant
101   actuals.is_empty
102   not is_implicit_current
103
104end