00001 /* 00002 The lestes compiler suite 00003 Copyright (C) 2002, 2003, 2004, 2005 Miroslav Tichy 00004 Copyright (C) 2002, 2003, 2004, 2005 Petr Zika 00005 Copyright (C) 2002, 2003, 2004, 2005 Vojtech Hala 00006 Copyright (C) 2002, 2003, 2004, 2005 Jiri Kosina 00007 Copyright (C) 2002, 2003, 2004, 2005 Pavel Sanda 00008 Copyright (C) 2002, 2003, 2004, 2005 Jan Zouhar 00009 Copyright (C) 2002, 2003, 2004, 2005 Rudolf Thomas 00010 00011 This program is free software; you can redistribute it and/or modify 00012 it under the terms of the GNU General Public License as published by 00013 the Free Software Foundation; version 2 of the License. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 See the full text of the GNU General Public License version 2, and 00021 the limitations in the file doc/LICENSE. 00022 00023 By accepting the license the licensee waives any and all claims 00024 against the copyright holder(s) related in whole or in part to the 00025 work, its use, and/or the inability to use it. 00026 00027 */ 00028 /*! \file 00029 \brief Type information for SS. 00030 00031 Definition of visitor providing type information for certain ss_type classes. 00032 */ 00033 #include <lestes/common.hh> 00034 #include <lestes/lang/cplus/sem/ss_type2info.g.hh> 00035 #include <lestes/lang/cplus/sem/ss_type.g.hh> 00036 00037 package(lestes); 00038 package(lang); 00039 package(cplus); 00040 package(sem); 00041 00042 /* 00043 TODO pt appropriate cast preparation 00044 ss_const_volatile_object = NULL; 00045 ss_pointer_object = NULL; 00046 ss_member_pointer_object = NULL; 00047 ss_reference_object = NULL; 00048 */ 00049 00050 /*! 00051 Visits object of any class in ss_struct_base hierarchy. 00052 Sets type information appropriately. 00053 \pre obj != NULL; 00054 \param obj The object to visit. 00055 */ 00056 void ss_type2info::default_ss_struct_base(ptr<ss_struct_base> obj) 00057 { 00058 lassert(obj); 00059 ss_const_object = NULL; 00060 ss_volatile_object = NULL; 00061 info = UNKNOWN; 00062 } 00063 00064 /*! 00065 Visits object of any class in ss_builtin_type hierarchy. 00066 Sets type information appropriately. 00067 \pre obj != NULL 00068 \param obj The object to visit. 00069 */ 00070 void ss_type2info::default_ss_builtin_type(ptr<ss_builtin_type> obj) 00071 { 00072 lassert(obj); 00073 ss_const_object = NULL; 00074 ss_volatile_object = NULL; 00075 info = UNKNOWN; 00076 } 00077 00078 /*! 00079 Visits object of class ss_member_function. 00080 Sets type information appropriately. 00081 \pre obj != NULL 00082 \param obj The object to visit. 00083 */ 00084 void ss_type2info::visit_ss_member_function(ptr<ss_member_function> obj) 00085 { 00086 lassert(obj); 00087 ss_const_object = NULL; 00088 ss_volatile_object = NULL; 00089 info = UNKNOWN; 00090 } 00091 00092 /*! 00093 Visits object of class ss_array. 00094 Sets type information appropriately. 00095 \pre obj != NULL 00096 \param obj The object to visit. 00097 */ 00098 void ss_type2info::visit_ss_array(ptr<ss_array> obj) 00099 { 00100 lassert(obj); 00101 ss_const_object = NULL; 00102 ss_volatile_object = NULL; 00103 info = UNKNOWN; 00104 } 00105 00106 /*! 00107 Visits object of class ss_function. 00108 Sets type information appropriately. 00109 \pre obj != NULL 00110 \param obj The object to visit. 00111 */ 00112 void ss_type2info::visit_ss_function(ptr<ss_function> obj) 00113 { 00114 lassert(obj); 00115 ss_const_object = NULL; 00116 ss_volatile_object = NULL; 00117 info = SS_FUNCTION; 00118 } 00119 00120 /*! 00121 Visits object of class ss_enum. 00122 Sets type information appropriately. 00123 \pre obj != NULL 00124 \param obj The object to visit. 00125 */ 00126 void ss_type2info::visit_ss_enum(ptr<ss_enum> obj) 00127 { 00128 lassert(obj); 00129 ss_const_object = NULL; 00130 ss_volatile_object = NULL; 00131 info = UNKNOWN; 00132 } 00133 00134 /*! 00135 Visits object of class ss_const. 00136 Sets type information appropriately. 00137 \pre obj != NULL 00138 \param obj The object to visit. 00139 */ 00140 void ss_type2info::visit_ss_const(ptr<ss_const> obj) 00141 { 00142 lassert(obj); 00143 ss_const_object = obj; 00144 ss_volatile_object = NULL; 00145 info = SS_CONST; 00146 } 00147 00148 /*! 00149 Visits object of class ss_volatile. 00150 Sets type information appropriately. 00151 \pre obj != NULL 00152 \param obj The object to visit. 00153 */ 00154 void ss_type2info::visit_ss_volatile(ptr<ss_volatile> obj) 00155 { 00156 lassert(obj); 00157 ss_const_object = NULL; 00158 ss_volatile_object = obj; 00159 info = SS_VOLATILE; 00160 } 00161 00162 /*! 00163 Visits object of class ss_const_volatile. 00164 Sets type information appropriately. 00165 \pre obj != NULL 00166 \param obj The object to visit. 00167 */ 00168 void ss_type2info::visit_ss_const_volatile(ptr<ss_const_volatile> obj) 00169 { 00170 lassert(obj); 00171 ss_const_object = NULL; 00172 ss_volatile_object = NULL; 00173 info = SS_CONST_VOLATILE; 00174 } 00175 00176 /*! 00177 Visits object of class ss_pointer. 00178 Sets type information appropriately. 00179 \pre obj != NULL 00180 \param obj The object to visit. 00181 */ 00182 void ss_type2info::visit_ss_pointer(ptr<ss_pointer> obj) 00183 { 00184 lassert(obj); 00185 ss_const_object = NULL; 00186 ss_volatile_object = NULL; 00187 info = SS_POINTER; 00188 } 00189 00190 /*! 00191 Visits object of class ss_member_pointer. 00192 Sets type information appropriately. 00193 \pre obj != NULL 00194 \param obj The object to visit. 00195 */ 00196 void ss_type2info::visit_ss_member_pointer(ptr<ss_member_pointer> obj) 00197 { 00198 lassert(obj); 00199 ss_const_object = NULL; 00200 ss_volatile_object = NULL; 00201 info = SS_MEMBER_POINTER; 00202 } 00203 00204 /*! 00205 Visits object of class ss_reference. 00206 Sets type information appropriately. 00207 \pre obj != NULL 00208 \param obj The object to visit. 00209 */ 00210 void ss_type2info::visit_ss_reference(ptr<ss_reference> obj) 00211 { 00212 lassert(obj); 00213 ss_const_object = NULL; 00214 ss_volatile_object = NULL; 00215 info = SS_REFERENCE; 00216 } 00217 00218 /*! 00219 Visits object of class ss_pseudoreference. 00220 Sets type information appropriately. 00221 \param obj The object to visit. 00222 \author TMA 00223 */ 00224 void ss_type2info::visit_ss_pseudoreference(ptr<ss_pseudoreference> obj) 00225 { 00226 lassert(obj); 00227 ss_const_object = NULL; 00228 ss_volatile_object = NULL; 00229 info = SS_PSEUDOREFERENCE; 00230 } 00231 00232 end_package(sem); 00233 end_package(cplus); 00234 end_package(lang); 00235 end_package(lestes);
1.5.1-20070107