Skip to content

Commit aba96b3

Browse files
authored
allow CodeTracking v3 (#682)
1 parent de266ef commit aba96b3

File tree

11 files changed

+13
-13
lines changed

11 files changed

+13
-13
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ CthulhuCompilerExt = "Compiler"
2525

2626
[compat]
2727
Accessors = "0.1.42"
28-
CodeTracking = "0.5, 1, 2"
28+
CodeTracking = "0.5, 1, 2, 3"
2929
Compiler = "0.1"
3030
FoldingTrees = "1"
3131
InteractiveUtils = "1.9"

TypedSyntax/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
88
JuliaSyntax = "70703baa-626e-46a2-a12c-08ffd08c73b4"
99

1010
[compat]
11-
CodeTracking = "1.3, 2"
11+
CodeTracking = "1.3, 2, 3"
1212
JuliaSyntax = "1"
1313
julia = "1.12"
1414

TypedSyntax/src/TypedSyntax.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using JuliaSyntax: JuliaSyntax, AbstractSyntaxData, SyntaxData, SyntaxNode, Gree
55
head, kind, children, is_leaf, untokenize, first_byte, last_byte, source_line, source_location,
66
sourcetext, @K_str, @KSet_str, is_infix_op_call, is_prefix_op_call, is_prec_assignment, is_operator, is_literal
77
using Base.Meta: isexpr
8-
using CodeTracking
8+
using CodeTracking: CodeTracking
99

1010
export TypedSyntaxNode
1111

TypedSyntax/src/node.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ end
2727

2828
function tsn_and_mappings(mi::MethodInstance, src::CodeInfo, @nospecialize(rt); warn::Bool=true, strip_macros::Bool=false, kwargs...)
2929
m = mi.def::Method
30-
def = definition(String, m)
30+
def = CodeTracking.definition(String, m)
3131
if isnothing(def)
3232
warn && @warn "couldn't retrieve source of $m"
3333
return nothing, nothing

TypedSyntax/test/exhaustive.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using MethodAnalysis
33
using ProgressMeter
44
using Test
55
using Logging
6-
using CodeTracking
6+
using CodeTracking: CodeTracking
77

88
const missingmethods = Set{Method}()
99
const badmis = Core.MethodInstance[]
@@ -20,7 +20,7 @@ const goodmis = Core.MethodInstance[]
2020
src, rt = cis[1]
2121
# Can CodeTracking handle this?
2222
ret = with_logger(NullLogger()) do
23-
definition(String, m)
23+
CodeTracking.definition(String, m)
2424
end
2525
if ret === nothing
2626
push!(missingmethods, m)

ext/CthulhuCompilerExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using Cthulhu: Cthulhu
77
using Compiler.IRShow: IRShow
88

99
using Accessors
10-
using CodeTracking: CodeTracking, definition, whereis, maybe_fix_path
10+
using CodeTracking: CodeTracking
1111
using InteractiveUtils
1212
using UUIDs
1313
using REPL: REPL, AbstractTerminal

src/Cthulhu.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const CC = Base.Compiler
99
const IRShow = Base.IRShow
1010

1111
using Accessors
12-
using CodeTracking: CodeTracking, definition, whereis, maybe_fix_path
12+
using CodeTracking: CodeTracking
1313
using InteractiveUtils
1414
using InteractiveUtils: is_expected_union
1515
using UUIDs

src/ascend.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function ascend_impl(
2020
parent = Cthulhu.instance(node.parent.data.nd)
2121
ulocs = find_caller_of(provider, parent, mi; allow_unspecialized=true)
2222
if !isempty(ulocs)
23-
ulocs = [(k[1], maybe_fix_path(String(k[2])), k[3]) => v for (k, v) in ulocs]
23+
ulocs = [(k[1], CodeTracking.maybe_fix_path(String(k[2])), k[3]) => v for (k, v) in ulocs]
2424
strlocs = [string(" "^k[3] * '"', k[2], "\", ", k[1], ": lines ", v) for (k, v) in ulocs]
2525
explain_inlining = length(ulocs) > 1 ? "(including inlined callers represented by indentation) " : ""
2626
push!(strlocs, "Browse typed code")

src/compiler/codeview.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ end
5858
function cthulhu_ast(io::IO, provider::AbstractProvider, state::CthulhuState, result::LookupResult)
5959
def = state.mi.def
6060
!isa(def, Method) && @warn "Can't show the AST because the definition is not a method."
61-
ast = definition(Expr, def)
61+
ast = CodeTracking.definition(Expr, def)
6262
ast === nothing && return @warn "Could not retrieve AST of $def. AST display requires Revise.jl to be loaded."
6363
if !state.config.pretty_ast
6464
dump(io, ast; maxdepth=typemax(Int))

src/descend.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ function descend!(state::CthulhuState)
6969
@warn "Can't jump to source location because the definition is not a method."
7070
else
7171
if isdefined(Main, :VSCodeServer) && Main.VSCodeServer isa Module && isdefined(Main.VSCodeServer, :openfile)
72-
Main.VSCodeServer.openfile(whereis(def)...; preserve_focus=true)
72+
Main.VSCodeServer.openfile(CodeTracking.whereis(def)...; preserve_focus=true)
7373
else
74-
edit(whereis(def)...)
74+
edit(CodeTracking.whereis(def)...)
7575
end
7676
end
7777
end

0 commit comments

Comments
 (0)