From 8915883cf627c12a7e6da9bb813d456407ebb091 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 24 Dec 2015 13:25:54 -0700 Subject: add error for byvalue struct param on exported fn --- src/analyze.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index 3e990afac5..a05b064364 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1653,6 +1653,7 @@ static void analyze_top_level_declaration(CodeGen *g, ImportTableEntry *import, node->codegen_node->data.fn_def_node.block_context = context; AstNodeFnProto *fn_proto = &fn_proto_node->data.fn_proto; + bool is_exported = (fn_proto->visib_mod == FnProtoVisibModExport); for (int i = 0; i < fn_proto->params.length; i += 1) { AstNode *param_decl_node = fn_proto->params.at(i); assert(param_decl_node->type == NodeTypeParamDecl); @@ -1662,6 +1663,11 @@ static void analyze_top_level_declaration(CodeGen *g, ImportTableEntry *import, assert(param_decl->type->type == NodeTypeType); TypeTableEntry *type = param_decl->type->codegen_node->data.type_node.entry; + if (is_exported && type->id == TypeTableEntryIdStruct) { + add_node_error(g, param_decl_node, + buf_sprintf("byvalue struct parameters not yet supported on exported functions")); + } + VariableTableEntry *variable_entry = allocate(1); buf_init_from_buf(&variable_entry->name, ¶m_decl->name); variable_entry->type = type; -- cgit v1.2.3