Skip to content

Commit

Permalink
hack 2
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Oct 12, 2017
1 parent 7353cac commit 73b9afc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
44 changes: 22 additions & 22 deletions src/Revise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function parse_pkg_files(modsym::Symbol)
mod = Base.root_module(Symbol(modname))
# For precompiled packages, we can read the source later (whenever we need it)
# from the *.ji cachefile.
fname = normpath(fname)
# fname = normpath(fname)
push!(file2modules, fname=>FileModules(mod, ModDict(), paths[1]))
push!(files, fname)
end
Expand All @@ -149,7 +149,7 @@ function parse_pkg_files(modsym::Symbol)
if isa(pr, Pair)
push!(file2modules, pr)
end
push!(files, normpath(fname))
push!(files, fname) #normpath(fname))
deleteat!(included_files, i)
else
i += 1
Expand Down Expand Up @@ -247,7 +247,7 @@ function revise_dir_queued(dirname)
end

function revise_file_now(file0)
file = normpath(file0)
file = file0 #normpath(file0)
if !haskey(file2modules, file)
println("Revise is currently tracking the following files: ", keys(file2modules))
error(file, " is not currently being tracked.")
Expand Down Expand Up @@ -311,7 +311,7 @@ it defaults to `Main`.
"""
function track(mod::Module, file::AbstractString)
isfile(file) || error(file, " is not a file")
file = normpath(abspath(file))
file = abspath(file) # normpath(abspath(file))
pr = parse_source(file, mod)
if isa(pr, Pair)
push!(file2modules, pr)
Expand Down Expand Up @@ -437,7 +437,7 @@ function __init__()
end
push!(Base.package_callbacks, watch_package)
push!(Base.include_callbacks,
(mod::Module, fn::AbstractString) -> push!(included_files, (mod, String(fn))))
(mod::Module, fn::AbstractString) -> push!(included_files, (mod, normpath(String(fn)))))
mode = get(ENV, "JULIA_REVISE", "auto")
if mode == "auto"
if isdefined(Base, :active_repl_backend)
Expand Down Expand Up @@ -465,23 +465,23 @@ Base.push!(wl::WatchList, filename) = push!(wl.trackedfiles, filename)
WatchList() = WatchList(Dates.datetime2unix(now()), Set{String}())
Base.in(file, wl::WatchList) = in(file, wl.trackedfiles)

@eval Base function read_dependency_src(io::IO, filename::AbstractString)
modules, files, required_modules, srctextpos = parse_cache_header(io)
srctextpos == 0 && error("no source-text stored in cache file")
seek(io, srctextpos)
while !eof(io)
filenamelen = ntoh(read(io, Int32))
filenamelen == 0 && break
fn = String(read(io, filenamelen))
@show fn
len = ntoh(read(io, UInt64))
if normpath(fn) == normpath(filename)
return String(read(io, len))
end
seek(io, position(io) + len)
end
error(filename, " is not stored in the source-text cache")
end
# @eval Base function read_dependency_src(io::IO, filename::AbstractString)
# modules, files, required_modules, srctextpos = parse_cache_header(io)
# srctextpos == 0 && error("no source-text stored in cache file")
# seek(io, srctextpos)
# while !eof(io)
# filenamelen = ntoh(read(io, Int32))
# filenamelen == 0 && break
# fn = String(read(io, filenamelen))
# @show fn
# len = ntoh(read(io, UInt64))
# if normpath(fn) == normpath(filename)
# return String(read(io, len))
# end
# seek(io, position(io) + len)
# end
# error(filename, " is not stored in the source-text cache")
# end


end # module
2 changes: 1 addition & 1 deletion src/parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ If parsing `file` fails, `nothing` is returned.
function parse_source(file::AbstractString, mod::Module)
# Create a blank ModDict to store the expressions. Parsing will "fill" this.
md = ModDict(mod=>OrderedSet{RelocatableExpr}())
nfile = normpath(file)
nfile = file # normpath(file)
parse_source!(md, file, mod) || return nothing
fm = FileModules(mod, md)
nfile => fm
Expand Down

0 comments on commit 73b9afc

Please sign in to comment.