From 6e0dfa94d9206d10514c337cee3d704f559381b3 Mon Sep 17 00:00:00 2001 From: "John Hodge (sonata)" Date: Wed, 14 Jan 2015 11:59:15 +0800 Subject: Path bind to struct (removed todo that wasn't needed in that location) --- src/ast/path.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/ast/path.cpp') diff --git a/src/ast/path.cpp b/src/ast/path.cpp index a868be5d..0bce09c1 100644 --- a/src/ast/path.cpp +++ b/src/ast/path.cpp @@ -213,7 +213,18 @@ void Path::bind_enum_var(const Enum& ent, const ::std::string& name, const ::std } void Path::bind_struct(const Struct& ent, const ::std::vector& args) { - throw ParseError::Todo("Path::resolve() bind to struct type"); + if( args.size() > 0 ) + { + if( args.size() != ent.params().size() ) + throw ParseError::Generic("Parameter count mismatch"); + // TODO: Is it the role of this section of code to ensure that the passed args are valid? + // - Probably not, it should instead be the type checker that does it + // - Count validation is OK here though + } + + DEBUG("Bound to struct"); + m_binding_type = STRUCT; + m_binding.struct_ = &ent; } void Path::bind_static(const Static& ent) { -- cgit v1.2.3