Skip to content

Commit

Permalink
Merge pull request #168 from JunoLab/avi/type-tips
Browse files Browse the repository at this point in the history
small refactors:
  • Loading branch information
pfitzseb authored Sep 9, 2019
2 parents b95112e + 71d7b96 commit da604f8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
1 change: 1 addition & 0 deletions src/completions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ function makedescription(docs)
return strlimit(desc, 200)
end
end
return ""
end

completionurl(c) = ""
Expand Down
10 changes: 4 additions & 6 deletions src/debugger/stepper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ using MacroTools

mutable struct DebuggerState
frame::Union{Nothing, Frame}
result
broke_on_error::Bool
level::Int
end
DebuggerState(frame::Frame) = DebuggerState(frame, nothing, false, 1)
DebuggerState() = DebuggerState(nothing, nothing, false, 1)
DebuggerState(frame::Frame) = DebuggerState(frame, false, 1)
DebuggerState() = DebuggerState(nothing, false, 1)

function active_frame(state::DebuggerState)
frame = state.frame
Expand Down Expand Up @@ -97,8 +96,7 @@ function startdebugging(frame, initial_continue = false)
if initial_continue && !JuliaInterpreter.shouldbreak(frame, frame.pc)
ret = debug_command(_compiledMode[], frame, :c, true)
if ret === nothing
STATE.result = res = JuliaInterpreter.get_return(root(frame))
return res
return res = JuliaInterpreter.get_return(root(frame))
end
STATE.frame = frame = ret[1]
pc = ret[2]
Expand Down Expand Up @@ -157,7 +155,7 @@ function startdebugging(frame, initial_continue = false)
end

if ret === nothing
STATE.result = res = JuliaInterpreter.get_return(root(frame))
res = JuliaInterpreter.get_return(root(frame))
break
else
STATE.frame = frame = ret[1]
Expand Down
2 changes: 1 addition & 1 deletion src/frontend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ plotsize() = (@rpc plotsize()) .- 1
ploturl(url::String) = @msg ploturl(url)


SELECTORS = Dict(
const SELECTORS = Dict(
"number" => ["syntax--constant", "syntax--numeric", "syntax--julia"],
"symbol" => ["syntax--constant", "syntax--other", "syntax--symbol", "syntax--julia"],
"string" => ["syntax--string", "syntax--quoted", "syntax--double", "syntax--julia"],
Expand Down
25 changes: 13 additions & 12 deletions src/outline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,29 @@ function toplevel_bindings(expr, text, bindings = [], line = 1, pos = 1)
return bindings
end

struct LocalScope
name
span
children
expr
struct LocalBinding
name::String
span::UnitRange{Int}
expr::CSTParser.EXPR
end

struct LocalBinding
name
span
expr
struct LocalScope
name::String
span::UnitRange{Int}
children::Vector{Union{LocalBinding, LocalScope}}
expr::CSTParser.EXPR
end

function local_bindings(expr, bindings = [], pos = 1)
function local_bindings(expr, bindings = Vector{Union{LocalBinding, LocalScope}}([]), pos = 1)
bind = CSTParser.bindingof(expr)
scope = CSTParser.scopeof(expr)
if bind !== nothing && scope === nothing
push!(bindings, LocalBinding(bind.name, pos:pos+expr.span, expr))
end

if scope !== nothing
range = pos:pos+expr.span
localbindings = []
localbindings = Vector{Union{LocalBinding, LocalScope}}([])
if expr.args !== nothing
for arg in expr.args
local_bindings(arg, localbindings, pos)
Expand All @@ -114,8 +115,8 @@ function local_bindings(expr, bindings = [], pos = 1)
pos += arg.fullspan
end
end
return bindings

return bindings
end

function locals(text, line, col)
Expand Down
6 changes: 3 additions & 3 deletions src/path_matching.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
uri_regex = if Sys.iswindows()
const uri_regex = if Sys.iswindows()
r"((?:(?:[a-zA-Z]:|\.\.?|\~)|(?:[^\0<>\?\|\/\s!$`&*()\[\]+'\":;])+)?(?:(?:\\|\/)(?:[^\0<>\?\|\/\s!$`&*()\[\]+'\":;])+)+)(?:\:(\d+))?"
else
r"((?:(?:\.\.?|\~)|(?:[^\0\s!$`&*()\[\]+'\":;\\])+)?(?:\/(?:[^\0\s!$`&*()\[\]+'\":;\\])+)+)(?:\:(\d+))?"
end

buildbot_regex = if Sys.iswindows()
const buildbot_regex = if Sys.iswindows()
r"C:\\cygwin\home\\Admininstrator\\buildbot\\.*?(\\julia\\stdlib\\.*?\.jl)"
else
r"\/buildworker\/worker\/.*?(\/julia\/stdlib\/.*?\.jl)"
end

repl_at_regex = r"@ (?:[^\s]+)\s(.*?)\:(\d+)"
const repl_at_regex = r"@ (?:[^\s]+)\s(.*?)\:(\d+)"

function fullREPLpath(uri)
urimatch = match(repl_at_regex, uri)
Expand Down

0 comments on commit da604f8

Please sign in to comment.