aboutsummaryrefslogtreecommitdiff
path: root/src/checker.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-03-24 11:58:26 +0000
committergingerBill <bill@gingerbill.org>2019-03-24 11:58:26 +0000
commitb1684fe455985b1dd7caf0b1be7ff91447dabd59 (patch)
tree7ce675aed40110a031e7ca95b538550cb46cfd59 /src/checker.cpp
parent886054f0f87217a47c7a18098bc708eaf0179447 (diff)
`@(private)` for `foreign` blocks; Improve foreign signature similarity rules
Diffstat (limited to 'src/checker.cpp')
-rw-r--r--src/checker.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index 130c4aee5..971c714b2 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -1993,6 +1993,12 @@ DECL_ATTRIBUTE_PROC(foreign_block_decl_attribute) {
error(elem, "Expected a string value for '%.*s'", LIT(name));
}
return true;
+ } else if (name == "private") {
+ if (ev.kind != ExactValue_Invalid) {
+ error(value, "'%.*s' does not expect a value", LIT(name));
+ }
+ c->foreign_context.is_private = true;
+ return true;
}
return false;
@@ -2414,7 +2420,7 @@ void check_collect_value_decl(CheckerContext *c, Ast *decl) {
ast_node(vd, ValueDecl, decl);
- bool entity_is_private = false;
+ bool entity_is_private = c->foreign_context.is_private;
for_array(i, vd->attributes) {
Ast *attr = vd->attributes[i];
if (attr->kind != Ast_Attribute) continue;