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

I885 #886

Merged
merged 3 commits into from
Sep 19, 2021
Merged

I885 #886

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Franklin"
uuid = "713c75ef-9fc9-4b05-94a9-213340da978e"
authors = ["Thibaut Lienart <[email protected]>"]
version = "0.10.54"
version = "0.10.55"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
8 changes: 4 additions & 4 deletions src/converter/html/blocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function process_html_cond(hs::AS, qblocks::Vector{AbstractBlock},
k ⊻= βi isa HIsNotDef
elseif βi isa Union{HIsEmpty, HIsNotEmpty}
v = locvar(βi.vname)
e = _isempty(v)
e = _isemptyvar(v)
k = ifelse(βi isa HIsEmpty, e, !e)
end
else
Expand Down Expand Up @@ -155,9 +155,9 @@ function process_html_cond(hs::AS, qblocks::Vector{AbstractBlock},
end

# used for the HIsEmpty, HIsNotEmpty
_isempty(v::T) where T = hasmethod(isempty, (T,)) ? isempty(v) : false
_isempty(::Nothing) = true
_isempty(v::Date) = (v == Date(1,1,1))
_isemptyvar(v::T) where T = hasmethod(isempty, (T,)) ? isempty(v) : false
_isemptyvar(::Nothing) = true
_isemptyvar(v::Date) = (v == Date(1,1,1))


"""
Expand Down
8 changes: 8 additions & 0 deletions src/eval/run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ function run_code(mod::Module, code::AS, out_path::AS;
err = nothing
stacktrace = nothing
ispath(out_path) || mkpath(dirname(out_path))

# we do this here so that `out_path` is still generated to avoid
# issue #885
if isempty(exs)
write(out_path, "")
return nothing
end

open(out_path, "w") do outf
if !FD_ENV[:SILENT_MODE]::Bool
rprint("→ evaluating code [$(out_path |> basename |> splitext |> first)] in ($(locvar("fd_rpath")))")
Expand Down
2 changes: 1 addition & 1 deletion test/eval/run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ end
Random.seed!(555)
println("hello")
b = randn()
b > 0
iszero(b)
"""
r = F.run_code(mod1, c, junk)

Expand Down