Skip to content

Commit

Permalink
Apply suggestions from JuliaStaging#28 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
cscherrer committed Mar 17, 2022
1 parent 4d54e33 commit 78c93d2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/JuliaVariables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ SymRef(sym::Symbol, ana::Union{Nothing, Analyzer}) = SymRef(sym, ana, false)

struct Var
name::Symbol
unique_id::Symbol
unique_id:: Union{Ref{Bool}, Nothing} # nothing when it's a global variable
is_mutable::Bool
is_shared::Bool
is_global::Bool
Expand Down Expand Up @@ -444,8 +444,7 @@ function solve!(ast; toplevel=true)
end

function local_var_to_var(var::LocalVar)::Var
unique_id = Symbol(var.sym, "_", id[var.sym])
@show unique_id # Remove after demo
unique_id = var.is_shared
Var(var.sym, unique_id, var.is_mutable[], var.is_shared[], false)
end

Expand Down Expand Up @@ -483,9 +482,9 @@ function solve!(ast; toplevel=true)
function from_symref(s::SymRef)
id[s.sym] = get(id, s.sym, 0) + 1
s.as_non_sym && return s.sym
s.ana === nothing && return Var(s.sym, s.sym, true, true, true)
s.ana === nothing && return Var(s.sym, nothing, true, true, true)
var = s.ana.solved[s.sym]
var isa Symbol && return Var(var, var, true, true, true)
var isa Symbol && return Var(var, nothing, true, true, true)
local_var_to_var(var)
end

Expand Down

0 comments on commit 78c93d2

Please sign in to comment.