From 6ed590cce27edbdcc13cdd478d8a68c81da44596 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 24 Aug 2016 19:49:10 +0800 Subject: AST - More defensive `self: Box` code --- src/ast/ast.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ast/ast.cpp') diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp index 80182f85..70a61b32 100644 --- a/src/ast/ast.cpp +++ b/src/ast/ast.cpp @@ -320,6 +320,9 @@ Function::Function(Span sp, GenericParams params, TypeRef ret_type, Arglist args TU_IFLET( ::AST::Path::Class, e.path.m_class, Relative, pe, if( pe.nodes.size() == 1 && pe.nodes.front().name() == "Box" ) { + if( pe.nodes.front().args().m_types.size() != 1 ) { + ERROR(sp, E0000, "Box takes 1 argument - " << ty); + } // HACK: Assumes that the param is Self or equivalent m_receiver = Receiver::Box; } -- cgit v1.2.3