home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / implicit_cast.e < prev    next >
Text File  |  1999-06-05  |  5KB  |  238 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 IMPLICIT_CAST
  17.    --
  18.    -- To memorize an implicit cast from INTEGER to REAL or from
  19.    -- INTEGER to DOUBLE or from REAL to DOUBLE.
  20.    --
  21.  
  22. inherit EXPRESSION;
  23.  
  24. creation {CALL_INFIX1,IMPLICIT_CAST} make
  25.  
  26. feature
  27.  
  28.    expression : EXPRESSION;
  29.  
  30.    result_type: TYPE_BASIC_EIFFEL_EXPANDED;
  31.  
  32. feature
  33.  
  34.    is_manifest_string: BOOLEAN is false;
  35.  
  36.    is_void: BOOLEAN is false;
  37.  
  38. feature {NONE}
  39.  
  40.    make(e: like expression; rt: like result_type) is
  41.       require
  42.          e.result_type.run_time_mark /= rt.run_time_mark
  43.       do
  44.          expression := e;
  45.          result_type := rt;
  46.       ensure
  47.          expression = e;
  48.          result_type = rt
  49.       end;
  50.  
  51. feature
  52.  
  53.    static_result_base_class: BASE_CLASS is
  54.       do
  55.          Result := result_type.base_class;
  56.       end;
  57.  
  58.    is_writable: BOOLEAN is
  59.       do
  60.          Result := expression.is_writable;
  61.       end;
  62.  
  63.    is_result: BOOLEAN is
  64.       do
  65.          Result := expression.is_result;
  66.       end;
  67.  
  68.    is_current: BOOLEAN is
  69.       do
  70.          Result := expression.is_current;
  71.       end;
  72.  
  73.    assertion_check(tag: CHARACTER) is
  74.       do
  75.          expression.assertion_check(tag);
  76.       end;
  77.  
  78.    is_static: BOOLEAN is
  79.       do
  80.          Result := expression.is_static;
  81.       end;
  82.  
  83.    static_value: INTEGER is
  84.       do
  85.          Result := expression.static_value;
  86.       end;
  87.  
  88.    is_pre_computable: BOOLEAN is
  89.       do
  90.          Result := expression.is_pre_computable;
  91.       end;
  92.  
  93.    isa_dca_inline_argument: INTEGER is
  94.       do
  95.          Result := expression.isa_dca_inline_argument;
  96.       end;
  97.  
  98.    dca_inline_argument(formal_arg_type: TYPE) is
  99.       do
  100.          expression.dca_inline_argument(formal_arg_type);
  101.       end;
  102.  
  103.    frozen mapping_c_target(target_type: TYPE) is
  104.       do
  105.          expression.mapping_c_target(target_type);
  106.       end;
  107.  
  108.    frozen mapping_c_arg(formal_arg_type: TYPE) is
  109.       do
  110.          expression.mapping_c_arg(formal_arg_type);
  111.       end;
  112.  
  113.    afd_check is
  114.       do
  115.          expression.afd_check;
  116.       end;
  117.  
  118.    collect_c_tmp is
  119.       do
  120.           expression.collect_c_tmp;
  121.       end;
  122.  
  123.    compile_to_c is
  124.       do
  125.          expression.compile_to_c;
  126.       end;
  127.  
  128.    c_declare_for_old is
  129.       do
  130.          expression.c_declare_for_old;
  131.       end;
  132.  
  133.    compile_to_c_old is
  134.       do
  135.          expression.compile_to_c_old;
  136.       end;
  137.  
  138.    compile_to_jvm_old is
  139.       do
  140.          expression.compile_to_jvm_old;
  141.       end;
  142.  
  143.    compile_to_jvm is
  144.       local
  145.          space: INTEGER;
  146.       do
  147.          expression.compile_to_jvm;
  148.          space := expression.result_type.jvm_convert_to(result_type);
  149.       end;
  150.  
  151.    compile_target_to_jvm is
  152.       local
  153.          space: INTEGER;
  154.       do
  155.          expression.compile_target_to_jvm
  156.          space := expression.result_type.jvm_convert_to(result_type);
  157.       end;
  158.  
  159.    jvm_branch_if_false: INTEGER is
  160.       do
  161.          Result := expression.jvm_branch_if_false;
  162.       end;
  163.  
  164.    jvm_branch_if_true: INTEGER is
  165.       do
  166.          Result := expression.jvm_branch_if_true;
  167.       end;
  168.  
  169.    compile_to_jvm_into(dest: TYPE): INTEGER is
  170.       do
  171.          Result := expression.compile_to_jvm_into(dest);
  172.       end;
  173.  
  174.    use_current: BOOLEAN is
  175.       do
  176.          Result := expression.use_current;
  177.       end;
  178.  
  179.    c_simple: BOOLEAN is
  180.       do
  181.          Result := expression.c_simple;
  182.       end;
  183.  
  184.    can_be_dropped: BOOLEAN is
  185.       do
  186.          Result := expression.can_be_dropped;
  187.       end;
  188.  
  189.    to_runnable(ct: TYPE): like Current is
  190.       local
  191.          e: EXPRESSION;
  192.       do
  193.          e := expression.to_runnable(ct);
  194.          if expression = e then
  195.             Result := Current;
  196.          else
  197.             !!Result.make(e,result_type);
  198.          end;
  199.       end;
  200.  
  201.    start_position: POSITION is
  202.       do
  203.          Result := expression.start_position;
  204.       end;
  205.  
  206.    bracketed_pretty_print, pretty_print is
  207.       do
  208.          expression.pretty_print;
  209.       end;
  210.  
  211.    print_as_target is
  212.       do
  213.          expression.print_as_target;
  214.       end;
  215.  
  216.    short is
  217.       do
  218.          expression.short;
  219.       end;
  220.  
  221.    short_target is
  222.       do
  223.          expression.short_target;
  224.       end;
  225.  
  226.    precedence: INTEGER is
  227.       do
  228.          Result := expression.precedence;
  229.       end;
  230.  
  231.    jvm_assign is
  232.       do
  233.          expression.jvm_assign;
  234.       end;
  235.  
  236. end -- IMPLICIT_CAST
  237.  
  238.