summaryrefslogtreecommitdiff
path: root/cli/semantics/elements.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-04-08 14:51:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-04-27 11:38:53 +0300
commit720c5a33b6a49cf328fdd7611f49153cf8f60247 (patch)
tree9725f3d1f42ec90fde84520f49647edea013ce5e /cli/semantics/elements.cxx
parent3183f3bb927a90783ae0aeaf190a0919377aabe4 (diff)
Separate tests and examples into individual packages
Also make cli module to be explicitly enabled via the config.cli configuration variable.
Diffstat (limited to 'cli/semantics/elements.cxx')
-rw-r--r--cli/semantics/elements.cxx129
1 files changed, 0 insertions, 129 deletions
diff --git a/cli/semantics/elements.cxx b/cli/semantics/elements.cxx
deleted file mode 100644
index ed8eb7d..0000000
--- a/cli/semantics/elements.cxx
+++ /dev/null
@@ -1,129 +0,0 @@
-// file : cli/semantics/elements.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#include <cutl/compiler/type-info.hxx>
-
-#include <cli/semantics/elements.hxx>
-
-namespace semantics
-{
- // nameable
- //
- string nameable::
- fq_name () const
- {
- string const& n (name ());
-
- if (n.empty ())
- return n;
- else
- return scope ().fq_name () + "::" + n;
- }
-
- // scope
- //
-
- scope::names_iterator_pair scope::
- find (string const& name) const
- {
- names_map::const_iterator i (names_map_.find (name));
-
- if (i == names_map_.end ())
- return names_iterator_pair (names_.end (), names_.end ());
- else
- return names_iterator_pair (i->second.begin (), i->second.end ());
- }
-
- scope::names_iterator scope::
- find (names& e)
- {
- list_iterator_map::iterator i (iterator_map_.find (&e));
- return i != iterator_map_.end () ? i->second : names_.end ();
- }
-
- void scope::
- add_edge_left (names& e)
- {
- names_list::iterator it (names_.insert (names_.end (), &e));
- iterator_map_[&e] = it;
-
- for (names::name_iterator i (e.name_begin ()); i != e.name_end (); ++i)
- names_map_[*i].push_back (&e);
- }
-
- void scope::
- remove_edge_left (names& e)
- {
- list_iterator_map::iterator i (iterator_map_.find (&e));
- assert (i != iterator_map_.end ());
-
- names_.erase (i->second);
- iterator_map_.erase (i);
-
- for (names::name_iterator ni (e.name_begin ()); ni != e.name_end (); ++ni)
- {
- names_map::iterator j (names_map_.find (*ni));
-
- for (names_list::iterator i (j->second.begin ());
- i != j->second.end (); ++i)
- {
- if (*i == &e)
- i = j->second.erase (i);
- }
- }
- }
-
- // type info
- //
- namespace
- {
- struct init
- {
- init ()
- {
- using compiler::type_info;
-
- // node
- //
- insert (type_info (typeid (node)));
-
- // edge
- //
- insert (type_info (typeid (edge)));
-
- // names
- //
- {
- type_info ti (typeid (names));
- ti.add_base (typeid (edge));
- insert (ti);
- }
-
- // nameable
- //
- {
- type_info ti (typeid (nameable));
- ti.add_base (typeid (node));
- insert (ti);
- }
-
- // scope
- //
- {
- type_info ti (typeid (scope));
- ti.add_base (typeid (nameable));
- insert (ti);
- }
-
- // type
- //
- {
- type_info ti (typeid (type));
- ti.add_base (typeid (node));
- insert (ti);
- }
- }
- } init_;
- }
-}