Code coverage for dta_rd_args.li


///////////////////////////////////////////////////////////////////////////////
//                             Lisaac Compiler                               //
//                                                                           //
//                   LSIIT - ULP - CNRS - INRIA - FRANCE                     //
//                                                                           //
//   This program is free software: you can redistribute it and/or modify    //
//   it under the terms of the GNU General Public License as published by    //
//   the Free Software Foundation, either version 3 of the License, or       //
//   (at your option) any later version.                                     //
//                                                                           //
//   This program is distributed in the hope that it will be useful,         //
//   but WITHOUT ANY WARRANTY; without even the implied warranty of          //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           //
//   GNU General Public License for more details.                            //
//                                                                           //
//   You should have received a copy of the GNU General Public License       //
//   along with this program.  If not, see <http://www.gnu.org/licenses/>.   //
//                                                                           //
//                     http://isaacproject.u-strasbg.fr/                     //
///////////////////////////////////////////////////////////////////////////////
Section Header

  + name        := DTA_RD_ARGS;

  - copyright   := "2003-2007 Benoit Sonntag";


  - author      := "Sonntag Benoit (bsonntag@loria.fr)";
  - comment     := "Read site with arguments";

Section Inherit

  + parent_dta_rd:Expanded DTA_RD;

Section Public

  - self_arg:EXPR <- argument_list.first;

  // Add.

  + argument_list:FAST_ARRAY(EXPR);

  + copy_argument:BOOLEAN;

  - parameter_to_type p:ITM_TYPE_PARAMETER :TYPE_FULL <-
  ( + result:TYPE_FULL;
    + idx:INTEGER;
    // For Genericity.
    result := slot.receiver_type.parameter_to_type p;
    (result = NULL).if {
      // For Self + type parametric.
      idx := slot.get_index_argument_type p;
      (idx != - 1).if {
        result := argument_list.item idx.static_type;
      }
;
    }
;
    result
  )
;

  //
  // Creation.
  //

  - create p:POSITION call sl:SLOT with args:FAST_ARRAY(EXPR) intern flag:BOOLEAN :SELF <-
  [ -? {p != 0}; ]
  ( + result:SELF;

    result := clone;
    result.make p call sl with args intern flag;
    result
  )
;

  - make p:POSITION call sl:SLOT with args:FAST_ARRAY(EXPR) intern flag:BOOLEAN <-
  (
    position      := p;
    slot          := sl;
    argument_list := args;
    result_expr   := get_expr_result;
    is_intern     := flag;
    (profil_current = NULL).if {
      context := context_main;
    }
 else {
      context := profil_current.context;
    }
;
  )
;

  //
  // Just for ITM_EXPRESSION
  //

  - create_partial p:POSITION call sl:SLOT :SELF <-
  ( + result:SELF;

    result := clone;
    result.make_partial p call sl;
    result
  )
;

  - make_partial p:POSITION call sl:SLOT <-
  (
    position := p;
    slot := sl;
  )
;

  //
  // Display.
  //

  - display buffer:STRING <-
  (
    buffer.append "DTA_RD_ARGS:";
    buffer.append (slot.name);
  )
;

  //
  // Service
  //

  - remove <-
  (
    (! copy_argument).if {
      (argument_list.lower).to (argument_list.upper) do { j:INTEGER;
        argument_list.item j.remove;
      }
;
      copy_argument := TRUE;
    }
;
  )
;

Section NODE_STYLE, SELF

  - get_argument:FAST_ARRAY(EXPR) <-
  ( + result:FAST_ARRAY(EXPR);

    (copy_argument).if {
      result := FAST_ARRAY(EXPR).create_with_capacity (argument_list.count);
      (argument_list.lower).to (argument_list.upper) do { j:INTEGER;
        result.add_last (argument_list.item j.my_copy);
      }
;
    }
 else {
      result := argument_list;
      copy_argument := TRUE;
    }
;
    result
  )
;