From 0893d513faed43174e331547429973d135f24dea Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Sun, 12 Nov 2023 00:34:02 +0100 Subject: respect //+private and the file/package variant --- src/common/ast.odin | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/common/ast.odin b/src/common/ast.odin index df78041..9adc57c 100644 --- a/src/common/ast.odin +++ b/src/common/ast.odin @@ -198,10 +198,10 @@ collect_value_decl :: proc( skip_private: bool, ) { if value_decl, ok := stmt.derived.(^ast.Value_Decl); ok { - is_deprecated := false + is_deprecated := false is_private_file := false - is_package_file := false - is_builtin := false + is_private_pkg := false + is_builtin := false for attribute in value_decl.attributes { for elem in attribute.elems { @@ -215,10 +215,10 @@ collect_value_decl :: proc( case "\"file\"": is_private_file = true case "package": - is_package_file = true + is_private_pkg = true } } else { - is_package_file = true + is_private_pkg = true } } } @@ -229,7 +229,7 @@ collect_value_decl :: proc( case "builtin": is_builtin = true case "private": - is_package_file = true + is_private_pkg = true } } } @@ -238,6 +238,25 @@ collect_value_decl :: proc( if is_private_file && skip_private { return } + + // If a private status is not explicitly set with an attribute above the declaration + // check the file comment. + if !is_private_file && !is_private_pkg && file.docs != nil { + for comment in file.docs.list { + txt := comment.text + if strings.has_prefix(txt, "//+private") { + txt = strings.trim_prefix(txt, "//+private") + is_private_pkg = true + + if strings.has_prefix(txt, " ") { + txt = strings.trim_space(txt) + if txt == "file" { + is_private_file = true + } + } + } + } + } for name, i in value_decl.names { str := get_ast_node_string(name, file.src) @@ -254,7 +273,7 @@ collect_value_decl :: proc( attributes = value_decl.attributes[:], deprecated = is_deprecated, builtin = is_builtin, - package_private = is_package_file, + package_private = is_private_pkg, }, ) } else { @@ -270,7 +289,7 @@ collect_value_decl :: proc( attributes = value_decl.attributes[:], deprecated = is_deprecated, builtin = is_builtin, - package_private = is_package_file, + package_private = is_private_pkg, }, ) } -- cgit v1.2.3 From 38c380e3c10fe74d39fee0339ee89f5c89916caf Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Sun, 12 Nov 2023 00:56:34 +0100 Subject: drop macos-11 support in CI, homebrew and Apple don't support it --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 915c1c0..7e1e15d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: macos: strategy: matrix: - os: [macos-11, macos-latest] + os: [macos-12, macos-latest] fail-fast: false runs-on: ${{ matrix.os }} timeout-minutes: 15 -- cgit v1.2.3 From e53da4ddeb79e43d0b2ff18461fd18a8191364c9 Mon Sep 17 00:00:00 2001 From: DanielGavin Date: Fri, 17 Nov 2023 11:27:01 +0100 Subject: Update nightly.yml --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a531140..8c789a5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -43,7 +43,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Download LLVM - run: sudo apt-get install llvm-11 clang-11 + run: sudo apt update && sudo apt purge -qq -y llvm-12 clang-12 - name: Download Odin run: | git clone https://github.com/odin-lang/Odin -- cgit v1.2.3