summaryrefslogtreecommitdiff
path: root/src/ast
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast')
-rw-r--r--src/ast/ast.cpp8
-rw-r--r--src/ast/ast.hpp9
-rw-r--r--src/ast/expr.hpp1
3 files changed, 12 insertions, 6 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp
index be4c9400..c8cf8188 100644
--- a/src/ast/ast.cpp
+++ b/src/ast/ast.cpp
@@ -68,6 +68,10 @@ SERIALISE_TYPE_S(Pattern, {
});
+::std::ostream& operator<<(::std::ostream& os, const Impl& impl)
+{
+ return os << "impl<" << impl.m_params << "> " << impl.m_trait << " for " << impl.m_type << "";
+}
SERIALISE_TYPE(Impl::, "AST_Impl", {
s << m_params;
s << m_trait;
@@ -247,13 +251,13 @@ void operator>>(::Deserialiser& s, Function::Class& fc)
}
SERIALISE_TYPE(Function::, "AST_Function", {
s << m_fcn_class;
- s << m_generic_params;
+ s << m_params;
s << m_rettype;
s << m_args;
s << m_code;
},{
s >> m_fcn_class;
- s.item(m_generic_params);
+ s.item(m_params);
s.item(m_rettype);
s.item(m_args);
s.item(m_code);
diff --git a/src/ast/ast.hpp b/src/ast/ast.hpp
index af797e7b..0ed83ec9 100644
--- a/src/ast/ast.hpp
+++ b/src/ast/ast.hpp
@@ -212,7 +212,7 @@ public:
private:
Class m_fcn_class;
- TypeParams m_generic_params;
+ TypeParams m_params;
Expr m_code;
TypeRef m_rettype;
Arglist m_args;
@@ -222,19 +222,19 @@ public:
{}
Function(TypeParams params, Class fcn_class, TypeRef ret_type, Arglist args, Expr code):
m_fcn_class(fcn_class),
- m_generic_params(params),
+ m_params(params),
m_code( ::std::move(code) ),
m_rettype( move(ret_type) ),
m_args( move(args) )
{
}
- TypeParams& generic_params() { return m_generic_params; }
+ TypeParams& params() { return m_params; }
Expr& code() { return m_code; }
TypeRef& rettype() { return m_rettype; }
Arglist& args() { return m_args; }
- const TypeParams& generic_params() const { return m_generic_params; }
+ const TypeParams& params() const { return m_params; }
const Expr& code() const { return m_code; }
const TypeRef& rettype() const { return m_rettype; }
const Arglist& args() const { return m_args; }
@@ -330,6 +330,7 @@ public:
TypeRef& type() { return m_type; }
::std::vector<Item<Function> >& functions() { return m_functions; }
+ friend ::std::ostream& operator<<(::std::ostream& os, const Impl& impl);
SERIALISABLE_PROTOTYPES();
};
diff --git a/src/ast/expr.hpp b/src/ast/expr.hpp
index d7cdb791..60ed6f2f 100644
--- a/src/ast/expr.hpp
+++ b/src/ast/expr.hpp
@@ -435,6 +435,7 @@ public:
{
}
+ ExprNode& node() { assert(m_node.get()); return *m_node; }
::std::shared_ptr<ExprNode> take_node() { assert(m_node.get()); return ::std::move(m_node); }
void visit_nodes(NodeVisitor& v);