Skip to content

Commit 68b3369

Browse files
committed
Refactored refresh_cache code
1 parent e8ef5ae commit 68b3369

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

lib/elixir_script.ex

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,24 @@ defmodule ElixirScript do
121121
end
122122

123123
defp get_compiler_cache(path, opts) do
124-
if Map.get(opts, :full_build) or empty?(opts.output) or old_version?(opts) do
124+
refresh_cache = cond do
125+
Map.get(opts, :full_build) ->
126+
true
127+
empty?(opts.output) ->
128+
true
129+
old_version?(opts) ->
130+
true
131+
Cache.get(path) == nil ->
132+
true
133+
true ->
134+
false
135+
end
136+
137+
if refresh_cache do
125138
Cache.delete(path)
126139
Cache.new(get_stdlib_state)
127140
else
128-
case Cache.get(path) do
129-
nil ->
130-
Cache.new(get_stdlib_state)
131-
x ->
132-
%{ x | full_build?: false }
133-
end
141+
%{ Cache.get(path) | full_build?: false }
134142
end
135143
end
136144

0 commit comments

Comments
 (0)