Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kwargs... to module_recursive_globals(), to allow imported modules #10

Merged
merged 5 commits into from
Sep 2, 2021

Conversation

NHDaly
Copy link
Owner

@NHDaly NHDaly commented Sep 2, 2021

Add kwargs... to module_recursive_globals(), to allow imported modules

julia> module TestMod42092
       module M1
           const m1_x = 1
           export m1_x
       end
       module M2
           const m2_x = 1
           export m2_x
       end
       module A
           module B
               f(x) = 1
               secret = 1
               module Inner2 end
           end
           module C
               x = 1
               y = 2
               export y
           end
           using .B: f
           using .C
           using ..M1
           import ..M2
       end
       end # module TestMod42092
Main.TestMod42092

julia> LookingGlass.module_recursive_globals(TestMod42092.A, imported=true, usings=true)
Dict{Tuple{Module, Symbol}, Int64} with 7 entries:
  (Main.TestMod42092.M2, :m2_x)    => 1
  (Main.TestMod42092.A, :y)        => 2
  (Main.TestMod42092.A.C, :y)      => 2
  (Main.TestMod42092.A.B, :secret) => 1
  (Main.TestMod42092.A.C, :x)      => 1
  (Main.TestMod42092.A, :m1_x)     => 1
  (Main.TestMod42092.M1, :m1_x)    => 1

NOTE: the usings=true option is in PR against Julia 1.8. See:
JuliaLang/julia#42092

…dules

```julia
julia> module TestMod42092
       module M1
           const m1_x = 1
           export m1_x
       end
       module M2
           const m2_x = 1
           export m2_x
       end
       module A
           module B
               f(x) = 1
               secret = 1
               module Inner2 end
           end
           module C
               x = 1
               y = 2
               export y
           end
           using .B: f
           using .C
           using ..M1
           import ..M2
       end
       end # module TestMod42092
Main.TestMod42092

julia> LookingGlass.module_recursive_globals(TestMod42092.A, imported=true, usings=true)
Dict{Tuple{Module, Symbol}, Int64} with 7 entries:
  (Main.TestMod42092.M2, :m2_x)    => 1
  (Main.TestMod42092.A, :y)        => 2
  (Main.TestMod42092.A.C, :y)      => 2
  (Main.TestMod42092.A.B, :secret) => 1
  (Main.TestMod42092.A.C, :x)      => 1
  (Main.TestMod42092.A, :m1_x)     => 1
  (Main.TestMod42092.M1, :m1_x)    => 1
```

NOTE: the `usings=true` option is in PR against Julia 1.8. See:
JuliaLang/julia#42092
@NHDaly
Copy link
Owner Author

NHDaly commented Sep 2, 2021

I'm not sure why ci isn't working...

name: CI
on:
push:
branches: [master]
tags: ["*"]
pull_request:
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.0'
- '1' # automatically expands to the latest stable 1.x release of Julia
- nightly
os:
- ubuntu-latest
arch:
- x64
- x86
include:
# test macOS and Windows with latest Julia only
- os: macOS-latest
arch: x64
version: 1
- os: windows-latest
arch: x64
version: 1
- os: windows-latest
arch: x86
version: 1
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info
# docs:
# name: Documentation
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: julia-actions/julia-buildpkg@latest
# - uses: julia-actions/julia-docdeploy@latest
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

@NHDaly NHDaly merged commit 8a9c0ef into master Sep 2, 2021
@NHDaly NHDaly deleted the nhd-module-recursive-globals-args branch September 2, 2021 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant