li_by_name_in_single_scope.cc

Go to the documentation of this file.
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 Lookup for name in single scope.
00030 
00031   Definition of class li_by_name_in_single_scope performing lookup of a name
00032   in a single scope, resolving all using declarations in the scope.
00033   Useful for checking object declarations and typedefs. 
00034   \author pt
00035 */
00036 
00037 #include <lestes/lang/cplus/sem/lu_filter.g.hh>
00038 #include <lestes/lang/cplus/sem/li_by_name_in_single_scope.g.hh>
00039 #include <lestes/lang/cplus/sem/lu_lu.g.hh>
00040 #include <lestes/lang/cplus/sem/ss_decl_name.g.hh>
00041 #include <lestes/lang/cplus/sem/ss_declaration.g.hh>
00042 #include <lestes/lang/cplus/sem/ss_misc.g.hh>
00043 #include <lestes/std/source_location.hh>
00044 #include <lestes/std/set.hh>
00045 #include <lestes/msg/logger.hh>
00046 #include <lestes/msg/logger_util.hh>
00047 
00048 package(lestes);
00049 package(lang);
00050 package(cplus);
00051 package(sem);
00052 
00053 /*!
00054   Performs lookup of name in a single scope.
00055   \pre name != NULL
00056   \pre scope != NULL
00057   \param name  The name to look up.
00058   \pre scope  The scope to search in.
00059 */
00060 ptr< ::lestes::std::set< srp< ss_declaration > > > li_by_name_in_single_scope::process(
00061         ptr<ss_decl_name> name, ptr<ss_decl_seq> scope)
00062 {
00063         lassert(name);
00064         lassert(scope);
00065 
00066         ptr<lu_name_filter> nf = lu_name_filter::create(name);
00067         ptr<lu_params> params = lu_params::create(lu_params::UDIR_IGNORE,
00068                         lu_params::UDECL_RESOLVE_BEFORE_FILTER, lu_params::SKIP_PARENTS,
00069                         ss_declaration_time::create(name->location_get()->order_get()), nf);
00070 
00071         ptr < ::lestes::std::set< srp<ss_declaration> > > res = lu_lookup::instance()->main(scope, params);
00072 
00073         return res;
00074 }
00075 
00076 /*!
00077   Performs lookup of name in a single scope. If an using declaration is found, it is preserved.
00078   Performs lookup of name in a single scope. If an using declaration is found, it is preserved.
00079 
00080   \pre name != NULL
00081   \pre scope != NULL
00082   \param name  The name to look up.
00083   \pre scope  The scope to search in.
00084 
00085   \author pt,TMA
00086 */
00087 ptr< ::lestes::std::set< srp< ss_declaration > > > li_by_name_in_single_scope::process_preserve_usings(
00088         ptr<ss_decl_name> name, ptr<ss_decl_seq> scope)
00089 {
00090         lassert(name);
00091         lassert(scope);
00092 
00093         ptr<lu_name_filter> nf = lu_name_filter::create(name);
00094         ptr<lu_params> params = lu_params::create(lu_params::UDIR_IGNORE,
00095                         lu_params::UDECL_THROUGH, lu_params::SKIP_PARENTS,
00096                         ss_declaration_time::create(name->location_get()->order_get()), nf);
00097 
00098         ptr < ::lestes::std::set< srp<ss_declaration> > > res = lu_lookup::instance()->main(scope, params);
00099 
00100         return res;
00101 }
00102 
00103 end_package(sem);
00104 end_package(cplus);
00105 end_package(lang);
00106 end_package(lestes);
00107 

Generated on Mon Feb 12 18:22:37 2007 for lestes by doxygen 1.5.1-20070107