home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / argument_name2.e < prev    next >
Text File  |  1999-06-05  |  2KB  |  89 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr
  4. --                       http://SmallEiffel.loria.fr
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License
  11. -- for  more  details.  You  should  have  received a copy of the GNU General
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class ARGUMENT_NAME2
  17.    --
  18.    -- An argument name used somewhere.
  19.    --
  20.  
  21. inherit ARGUMENT_NAME;
  22.  
  23. creation refer_to, with
  24.  
  25. feature
  26.  
  27.    rank: INTEGER;
  28.  
  29. feature {NONE}
  30.  
  31.    formal_arg_list: FORMAL_ARG_LIST;
  32.  
  33. feature {NONE}
  34.  
  35.    refer_to(sp: POSITION; fal: FORMAL_ARG_LIST; r: like rank) is
  36.       require
  37.          sp /= Void;
  38.          r.in_range(1,fal.count)
  39.       do
  40.          start_position := sp;
  41.          formal_arg_list := fal;
  42.          rank := r;
  43.       ensure
  44.          start_position = sp;
  45.          rank = r
  46.       end;
  47.  
  48.    with(model: like Current; fal: FORMAL_ARG_LIST) is
  49.       require
  50.          model /= Void;
  51.          fal /= Void
  52.       do
  53.          standard_copy(model);
  54.          formal_arg_list := fal;
  55.       ensure
  56.          start_position = model.start_position;
  57.          rank = model.rank;
  58.          formal_arg_list = fal
  59.       end;
  60.  
  61. feature
  62.  
  63.    to_string: STRING is
  64.       do
  65.          Result := formal_arg_list.name(rank).to_string;
  66.       end;
  67.  
  68.    result_type: TYPE is
  69.       do
  70.          Result := formal_arg_list.type(rank);
  71.       end;
  72.  
  73.    to_runnable(ct: TYPE): like Current is
  74.       local
  75.          rf: RUN_FEATURE;
  76.          fal: FORMAL_ARG_LIST;
  77.       do
  78.          rf := small_eiffel.top_rf;
  79.          fal := rf.arguments;
  80.          if formal_arg_list = fal then
  81.             Result := Current;
  82.          else
  83.             !!Result.with(Current,fal);
  84.          end;
  85.       end;
  86.  
  87. end -- ARGUMENT_NAME2
  88.  
  89.