summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/semantics/class.hxx4
-rw-r--r--cli/semantics/elements.hxx24
-rw-r--r--cli/semantics/expression.hxx4
-rw-r--r--cli/semantics/namespace.hxx4
-rw-r--r--cli/semantics/option.hxx12
-rw-r--r--cli/semantics/unit.hxx44
6 files changed, 24 insertions, 68 deletions
diff --git a/cli/semantics/class.hxx b/cli/semantics/class.hxx
index 1e6b59c..97717bc 100644
--- a/cli/semantics/class.hxx
+++ b/cli/semantics/class.hxx
@@ -12,9 +12,7 @@ namespace semantics
{
class class_: public scope
{
- protected:
- friend class graph<node, edge>;
-
+ public:
class_ (path const& file, size_t line, size_t column)
: node (file, line, column)
{
diff --git a/cli/semantics/elements.hxx b/cli/semantics/elements.hxx
index 504779a..ecca9ed 100644
--- a/cli/semantics/elements.hxx
+++ b/cli/semantics/elements.hxx
@@ -72,9 +72,6 @@ namespace semantics
return dynamic_cast<X const*> (this) != 0;
}
- protected:
- friend class graph<node, edge>;
-
private:
context_type context_;
};
@@ -123,9 +120,7 @@ namespace semantics
return dynamic_cast<X const*> (this) != 0;
}
- protected:
- friend class graph<node, edge>;
-
+ public:
node (path const& file, size_t line, size_t column)
: file_ (file), line_ (line), column_ (column)
{
@@ -202,9 +197,7 @@ namespace semantics
return *named_;
}
- protected:
- friend class graph<node, edge>;
-
+ public:
names (string const& name)
{
names_.push_back (name);
@@ -273,9 +266,7 @@ namespace semantics
return *named_;
}
- protected:
- friend class graph<node, edge>;
-
+ public:
nameable ()
: named_ (0)
{
@@ -350,9 +341,7 @@ namespace semantics
names_iterator
find (names&);
- protected:
- friend class graph<node, edge>;
-
+ public:
scope (path const& file, size_t line, size_t column)
: node (file, line, column)
{
@@ -368,7 +357,6 @@ namespace semantics
void
remove_edge_left (names&);
- protected:
using nameable::add_edge_right;
private:
@@ -388,9 +376,7 @@ namespace semantics
return name_;
}
- protected:
- friend class graph<node, edge>;
-
+ public:
type (path const& file, size_t line, size_t column, string const& name)
: node (file, line, column), name_ (name)
{
diff --git a/cli/semantics/expression.hxx b/cli/semantics/expression.hxx
index 00f62da..16d09c7 100644
--- a/cli/semantics/expression.hxx
+++ b/cli/semantics/expression.hxx
@@ -50,9 +50,7 @@ namespace semantics
return *initializes_;
}
- protected:
- friend class graph<node, edge>;
-
+ public:
expression (path const& file,
size_t line,
size_t column,
diff --git a/cli/semantics/namespace.hxx b/cli/semantics/namespace.hxx
index f05798e..466ad4f 100644
--- a/cli/semantics/namespace.hxx
+++ b/cli/semantics/namespace.hxx
@@ -12,9 +12,7 @@ namespace semantics
{
class namespace_: public scope
{
- protected:
- friend class graph<node, edge>;
-
+ public:
namespace_ (path const& file, size_t line, size_t column)
: node (file, line, column)
{
diff --git a/cli/semantics/option.hxx b/cli/semantics/option.hxx
index 21fc900..d5437e1 100644
--- a/cli/semantics/option.hxx
+++ b/cli/semantics/option.hxx
@@ -34,9 +34,7 @@ namespace semantics
return *type_;
}
- protected:
- friend class graph<node, edge>;
-
+ public:
void
set_left_node (option_type& n)
{
@@ -78,9 +76,7 @@ namespace semantics
return *expression_;
}
- protected:
- friend class graph<node, edge>;
-
+ public:
void
set_left_node (option_type& n)
{
@@ -139,9 +135,7 @@ namespace semantics
return initialized_->expression ();
}
- protected:
- friend class graph<node, edge>;
-
+ public:
option (path const& file, size_t line, size_t column)
: node (file, line, column), initialized_ (0)
{
diff --git a/cli/semantics/unit.hxx b/cli/semantics/unit.hxx
index a67e1ff..d7e6727 100644
--- a/cli/semantics/unit.hxx
+++ b/cli/semantics/unit.hxx
@@ -36,9 +36,7 @@ namespace semantics
return file_;
}
- protected:
- friend class graph<node, edge>;
-
+ public:
includes (string const& file)
: file_ (file)
{
@@ -66,9 +64,7 @@ namespace semantics
return *includee_;
}
- protected:
- friend class graph<node, edge>;
-
+ public:
cli_includes (string const& file)
: includes (file)
{
@@ -95,9 +91,7 @@ namespace semantics
return *includee_;
}
- protected:
- friend class graph<node, edge>;
-
+ public:
cxx_includes (string const& file)
: includes (file)
{
@@ -117,9 +111,7 @@ namespace semantics
//
class cxx_unit: public node
{
- protected:
- friend class graph<node, edge>;
-
+ public:
cxx_unit (path const& file, size_t line, size_t column)
: node (file, line, column)
{
@@ -156,7 +148,7 @@ namespace semantics
public:
cli_unit (path const& file)
- : node (file, 1, 1)
+ : node (file, 1, 1), graph_ (*this)
{
// Use a special edge to get this->name() return the global
// namespace name ("").
@@ -169,14 +161,14 @@ namespace semantics
T&
new_node (path const& file, size_t line, size_t column)
{
- return graph ().new_node<T> (file, line, column);
+ return graph_.new_node<T> (file, line, column);
}
template <typename T, typename A0>
T&
new_node (path const& file, size_t line, size_t column, A0 const& a0)
{
- return graph ().new_node<T> (file, line, column, a0);
+ return graph_.new_node<T> (file, line, column, a0);
}
template <typename T, typename A0, typename A1>
@@ -184,7 +176,7 @@ namespace semantics
new_node (path const& file, size_t line, size_t column,
A0 const& a0, A1 const& a1)
{
- return graph ().new_node<T> (file, line, column, a0, a1);
+ return graph_.new_node<T> (file, line, column, a0, a1);
}
template <typename T, typename A0, typename A1, typename A2>
@@ -192,7 +184,7 @@ namespace semantics
new_node (path const& file, size_t line, size_t column,
A0 const& a0, A1 const& a1, A2 const& a2)
{
- return graph ().new_node<T> (file, line, column, a0, a1, a2);
+ return graph_.new_node<T> (file, line, column, a0, a1, a2);
}
template <typename T, typename A0, typename A1, typename A2, typename A3>
@@ -200,7 +192,7 @@ namespace semantics
new_node (path const& file, size_t line, size_t column,
A0 const& a0, A1 const& a1, A2 const& a2, A3 const& a3)
{
- return graph ().new_node<T> (file, line, column, a0, a1, a2, a3);
+ return graph_.new_node<T> (file, line, column, a0, a1, a2, a3);
}
public:
@@ -219,9 +211,7 @@ namespace semantics
//
class global_names: public names
{
- protected:
- friend class graph<node, edge>;
-
+ public:
global_names ()
: names ("")
{
@@ -252,9 +242,7 @@ namespace semantics
}
};
- protected:
- friend class graph<node, edge>;
-
+ public:
void
add_edge_left (cli_includes& e)
{
@@ -280,16 +268,10 @@ namespace semantics
using namespace_::add_edge_right;
private:
- semantics::graph<node, edge>&
- graph ()
- {
- return *this;
- }
-
- private:
typedef std::map<string, type*> type_map;
private:
+ graph<node, edge>& graph_;
includes_list includes_;
type_map types_;
};