Browse Source

Correct `//+private file` bug

gingerBill 3 years ago
parent
commit
3c2ed3bb69
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/checker.cpp

+ 4 - 4
src/checker.cpp

@@ -3477,11 +3477,11 @@ void check_collect_value_decl(CheckerContext *c, Ast *decl) {
 	if (entity_visibility_kind == EntityVisiblity_Public &&
 	    (c->scope->flags&ScopeFlag_File) &&
 	    c->scope->file) {
-	    	if (c->scope->file->flags & AstFile_IsPrivatePkg) {
-			entity_visibility_kind = EntityVisiblity_PrivateToPackage;
-	    	} else if (c->scope->file->flags & AstFile_IsPrivateFile) {
+	    	if (c->scope->file->flags & AstFile_IsPrivateFile) {
 			entity_visibility_kind = EntityVisiblity_PrivateToFile;
-		}
+		} else if (c->scope->file->flags & AstFile_IsPrivatePkg) {
+			entity_visibility_kind = EntityVisiblity_PrivateToPackage;
+	    	}
 	}
 
 	if (entity_visibility_kind != EntityVisiblity_Public && !(c->scope->flags&ScopeFlag_File)) {