Code coverage for itm_type_block.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 := ITM_TYPE_BLOCK;
- copyright := "2003-2007 Benoit Sonntag";
- author := "Sonntag Benoit (bsonntag@loria.fr)";
- comment := "Type block definition";
Section Inherit
+ parent_itm_type_mono:Expanded ITM_TYPE_MONO;
Section ITM_TYPE_SIMPLE, ITM_TYPE_SELF
- dico:FAST_ARRAY(ITM_TYPE_BLOCK) := FAST_ARRAY(ITM_TYPE_BLOCK).create_with_capacity 32;
Section Private
- create typ_arg:ITM_TYPE and typ_res:ITM_TYPE :SELF <-
( + result:SELF;
result := clone;
result.make typ_arg and typ_res;
result
);
- make typ_arg:ITM_TYPE and typ_res:ITM_TYPE <-
(
type_argument := typ_arg;
type_result := typ_res;
);
Section Public
+ type_argument:ITM_TYPE;
+ type_result:ITM_TYPE;
- get typ_arg:ITM_TYPE and typ_res:ITM_TYPE :ITM_TYPE_BLOCK <-
( + result:ITM_TYPE_BLOCK;
+ idx:INTEGER;
idx := dico.lower;
{
(idx <= dico.upper) {
{dico.item idx.type_argument != typ_arg} ||
{dico.item idx.type_result != typ_res}
}
}.while_do {
idx := idx + 1;
};
(idx <= dico.upper).if {
result := dico.item idx;
} else {
result := create typ_arg and typ_res;
dico.add_last result;
};
result
);
- to_run_for p:PARAMETER_TO_TYPE :TYPE_FULL <-
(
TYPE_BLOCK.get Self with p
);
- append_in buffer:STRING <-
( + typ_mul:ITM_TYPE_MULTI;
buffer.add_last '{';
(type_argument != NULL).if {
type_argument.append_in buffer;
buffer.add_last ';';
buffer.add_last ' ';
};
(type_result != NULL).if {
typ_mul ?= type_result;
(typ_mul = NULL).if {
type_result.append_in buffer;
} else {
typ_mul.display_raw buffer;
};
};
buffer.add_last '}';
);
- shorter_in buf:STRING <-
( + typ_mul:ITM_TYPE_MULTI;
put "{" to buf like (ALIAS_STR.short_block);
(type_argument != NULL).if {
type_argument.shorter_in buf;
buf.add_last ';';
buf.add_last ' ';
};
(type_result != NULL).if {
typ_mul ?= type_result;
(typ_mul = NULL).if {
type_result.shorter_in buf;
} else {
typ_mul.shorter_raw_in buf;
};
};
put "}" to buf like (ALIAS_STR.short_block);
);
//
// Cast.
//
- append_cast_name_in buf:STRING <-
(
crash_with_message "ITM_TYPE_BLOCK.append_cast_name_in ";
);