Browse Source

Correct `//+private` for `odin doc`

gingerBill 3 years ago
parent
commit
cafb6e5587
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/checker.cpp

+ 7 - 0
src/checker.cpp

@@ -3446,6 +3446,13 @@ void check_collect_value_decl(CheckerContext *c, Ast *decl) {
 		}
 	}
 
+	if (entity_visibility_kind == EntityVisiblity_Public &&
+	    (c->scope->flags&ScopeFlag_File) &&
+	    c->scope->file &&
+	    (c->scope->file->flags & AstFile_IsPrivate)) {
+		entity_visibility_kind = EntityVisiblity_PrivateToPackage;
+	}
+
 	if (entity_visibility_kind != EntityVisiblity_Public && !(c->scope->flags&ScopeFlag_File)) {
 		error(decl, "Attribute 'private' is not allowed on a non file scope entity");
 	}