From a8d2de3db9d9f92013d0ac6e52319b55590efea4 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 29 May 2016 08:50:39 +0800 Subject: AST - Remove dead code, add lifetime params, fix param clobber --- src/ast/ast.cpp | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src/ast/ast.cpp') diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp index 802bde37..77981a4d 100644 --- a/src/ast/ast.cpp +++ b/src/ast/ast.cpp @@ -495,34 +495,6 @@ SERIALISE_TYPE(Enum::, "AST_Enum", { s.item(m_variants); }) -TypeRef Struct::get_field_type(const char *name, const ::std::vector& args) -{ - if( args.size() != m_params.ty_params().size() ) - { - throw ::std::runtime_error("Incorrect parameter count for struct"); - } - // TODO: Should the bounds be checked here? Or is the count sufficient? - for(const auto& f : m_data.as_Struct().ents) - { - if( f.m_name == name ) - { - // Found it! - if( args.size() ) - { - TypeRef res = f.m_type; - res.resolve_args( GenericResolveClosure(m_params, args) ); - return res; - } - else - { - return f.m_type; - } - } - } - - throw ::std::runtime_error(FMT("No such field " << name)); -} - SERIALISE_TYPE(Struct::, "AST_Struct", { s << m_params; s << m_data; -- cgit v1.2.3