Skip to content

Commit c62e473

Browse files
committed
Some 0.7 compatibility
1 parent f6b9361 commit c62e473

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/DebuggerFramework.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ module DebuggerFramework
155155
current_line = line
156156
stoplinelength = length(string(stopline))
157157

158-
code = split(code[(startoffset:stopoffset)+1],'\n')
158+
code = split(code[(startoffset:stopoffset).+1],'\n')
159159
lineno = startline
160160

161161
if !isempty(code) && isempty(code[end])
@@ -180,7 +180,13 @@ module DebuggerFramework
180180
print_with_color(:bold, outbuf, "In ", locdesc(frame), "\n")
181181
loc = locinfo(frame)
182182
if loc !== nothing
183-
print_sourcecode(outbuf, isa(loc, BufferLocInfo) ? loc.data : readstring(loc.filepath),
183+
data = if isa(loc, BufferLocInfo)
184+
loc.data
185+
else
186+
VERSION < v"0.7" ? read(loc.filepath, String) :
187+
readstring(loc.filepath)
188+
end
189+
print_sourcecode(outbuf, data,
184190
loc.line, loc.defline)
185191
else
186192
buf = IOBuffer()
@@ -276,8 +282,8 @@ module DebuggerFramework
276282
return true
277283
end
278284

279-
const key = '`'
280-
const repl_switch = Dict{Any,Any}(
285+
key = '`'
286+
repl_switch = Dict{Any,Any}(
281287
key => function (s,args...)
282288
if isempty(s) || position(LineEdit.buffer(s)) == 0
283289
prompt = language_specific_prompt(state, state.stack[1])

src/LineNumbers.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function SourceFile(data)
2121
if !isempty(offsets) && line[end] == '\n'
2222
push!(offsets, position(buf))
2323
end
24-
SourceFile(data,offsets)
24+
SourceFile(Vector{UInt8}(data), offsets)
2525
end
2626

2727
function compute_line(file::SourceFile, offset)
@@ -78,4 +78,4 @@ function setindex!(lb::LineBreaking, y, x::AbstractArray)
7878
end
7979
end
8080

81-
end # module
81+
end # module

0 commit comments

Comments
 (0)