From 1ac5429531c195755c7e1690912291e20e9a1717 Mon Sep 17 00:00:00 2001 From: "John Hodge (bugs)" Date: Fri, 5 Dec 2014 20:35:11 +0800 Subject: Pattern and impl parsing working --- ast/ast.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'ast/ast.cpp') diff --git a/ast/ast.cpp b/ast/ast.cpp index bf86649b..1683bf91 100644 --- a/ast/ast.cpp +++ b/ast/ast.cpp @@ -13,11 +13,17 @@ Path::Path(Path::TagAbsolute) { } + +PathNode::PathNode(::std::string name, ::std::vector args): + m_name(name), + m_params(args) +{ +} const ::std::string& PathNode::name() const { return m_name; } -const TypeParams& PathNode::args() const +const ::std::vector& PathNode::args() const { return m_params; } @@ -28,6 +34,21 @@ Pattern::Pattern(TagMaybeBind, ::std::string name) Pattern::Pattern(TagValue, ExprNode node) { } +Pattern::Pattern(TagEnumVariant, Path path, ::std::vector sub_patterns) +{ +} + + +Function::Function(::std::string name, TypeParams params, TypeRef ret_type, ::std::vector args, Expr code) +{ +} + +Impl::Impl(TypeRef impl_type, TypeRef trait_type) +{ +} +void Impl::add_function(bool is_public, Function fcn) +{ +} void Module::add_constant(bool is_public, ::std::string name, TypeRef type, Expr val) { @@ -41,7 +62,10 @@ void Module::add_global(bool is_public, bool is_mut, ::std::string name, TypeRef void Module::add_struct(bool is_public, ::std::string name, TypeParams params, ::std::vector items) { } -void Module::add_function(bool is_public, ::std::string name, TypeParams params, TypeRef ret_type, ::std::vector args, Expr code) +void Module::add_function(bool is_public, Function func) +{ +} +void Module::add_impl(Impl impl) { } -- cgit v1.2.3