aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-12-24 13:25:54 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-12-24 13:25:54 -0700
commit8915883cf627c12a7e6da9bb813d456407ebb091 (patch)
treee940326978476e284ed7e9565bd806f0e943524f /src/analyze.cpp
parent4e52281142c80230e1c60ece2824656dd08afcbd (diff)
downloadzig-8915883cf627c12a7e6da9bb813d456407ebb091.tar.gz
zig-8915883cf627c12a7e6da9bb813d456407ebb091.zip
add error for byvalue struct param on exported fn
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp6
1 files changed, 6 insertions, 0 deletions
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<VariableTableEntry>(1);
buf_init_from_buf(&variable_entry->name, &param_decl->name);
variable_entry->type = type;