diff options
Diffstat (limited to 'src/ast')
-rw-r--r-- | src/ast/ast.hpp | 2 | ||||
-rw-r--r-- | src/ast/path.cpp | 4 | ||||
-rw-r--r-- | src/ast/path.hpp | 7 |
3 files changed, 11 insertions, 2 deletions
diff --git a/src/ast/ast.hpp b/src/ast/ast.hpp index b684379f..b4ccf582 100644 --- a/src/ast/ast.hpp +++ b/src/ast/ast.hpp @@ -206,6 +206,8 @@ public: m_value( move(value) )
{}
+ const TypeRef& type() const { return m_type; }
+
SERIALISABLE_PROTOTYPES();
};
diff --git a/src/ast/path.cpp b/src/ast/path.cpp index fd543120..6d5e50b2 100644 --- a/src/ast/path.cpp +++ b/src/ast/path.cpp @@ -143,7 +143,9 @@ void Path::resolve(const Crate& root_crate) { DEBUG("Found function"); if( is_last ) { - throw ParseError::Todo("Path::resolve() bind to function"); + m_binding_type = FUNCTION; + m_binding.func_ = &it->data; + return ; } else { throw ParseError::Generic("Import of function, too many extra nodes"); diff --git a/src/ast/path.hpp b/src/ast/path.hpp index 01c8ed03..02e028d7 100644 --- a/src/ast/path.hpp +++ b/src/ast/path.hpp @@ -160,9 +160,14 @@ public: _(Module, module, MODULE) _(Trait, trait, TRAIT) _(Struct, struct, STRUCT) - _(Enum, enum, ENUM) + //_(Enum, enum, ENUM) _(Function, func, FUNCTION) + _(Static, static, STATIC) #undef _ + const Enum& bound_enum() const { + assert(m_binding_type == ENUM || m_binding_type == ENUM_VAR); + return *m_binding.enum_; + } ::std::vector<PathNode>& nodes() { return m_nodes; } const ::std::vector<PathNode>& nodes() const { return m_nodes; } |