Skip to content

Commit 5c0766a

Browse files
committed
Support struct revision, really
1 parent ce0fa57 commit 5c0766a

File tree

18 files changed

+1073
-672
lines changed

18 files changed

+1073
-672
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ projects = ["docs", "test"]
88
[deps]
99
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
1010
FileWatching = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
11+
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
1112
JuliaInterpreter = "aa1ae85d-cabe-5617-a682-6adf51b2e16a"
1213
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
1314
LoweredCodeUtils = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
@@ -25,6 +26,7 @@ DistributedExt = "Distributed"
2526
[compat]
2627
CodeTracking = "3"
2728
Distributed = "1"
29+
InteractiveUtils = "1.10, 1.11"
2830
JuliaInterpreter = "0.10.8"
2931
LoweredCodeUtils = "3.5"
3032
OrderedCollections = "1"

docs/src/debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Currently, the best way to turn on logging is within a running Julia session:
2525

2626
```jldoctest; setup=(using Revise)
2727
julia> rlogger = Revise.debug_logger()
28-
Revise.ReviseLogger(Revise.LogRecord[], Debug)
28+
ReviseLogger with min_level=Debug
2929
```
3030
You'll use `rlogger` at the end to retrieve the logs.
3131

docs/src/dev_reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Revise.user_callbacks_by_key
4848

4949
```@docs
5050
Revise.RelocatableExpr
51-
Revise.ModuleExprsSigs
51+
Revise.ModuleExprsInfos
5252
Revise.FileInfo
5353
Revise.PkgData
5454
Revise.WatchList
@@ -118,7 +118,7 @@ This part of the package is not as well documented.
118118
```@docs
119119
Revise.minimal_evaluation!
120120
Revise.methods_by_execution!
121-
Revise.MethodInfo
121+
Revise.ExInfo
122122
```
123123

124124
### Modules and paths

docs/src/figures/diagram.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
\path [-latex] (methods.north west) edge node[midway,right] {\texttt{meth.sig}} (sigts.south east);
3939
\path [-latex] (sigts.south) edge node[midway,left] {\texttt{which}} (methods.west);
4040

41-
v \path [-latex] (exprs.south west) edge node[midway,left,color=green] {\texttt{ExprsSigs}} (sigts.north east);
41+
v \path [-latex] (exprs.south west) edge node[midway,left,color=green] {\texttt{ExprsInfos}} (sigts.north east);
4242
\path [-latex] (lowered.west) edge (sigts.east);
4343

4444
% \path[dashed] [-latex] (methods.south west) edge [bend left=100] node[pos=0.75,left] {file,line} (src.west);

docs/src/internals.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Most of Revise's magic comes down to just three internal variables:
224224
- [`Revise.pkgdatas`](@ref): the central repository of parsed code, used to "diff" for changes
225225
and then "patch" the running session.
226226

227-
Two "maps" are central to Revise's inner workings: `ExprsSigs` maps link
227+
Two "maps" are central to Revise's inner workings: `ExprsInfos` maps link
228228
definition=>signature-types (the forward workflow), while `CodeTracking` (specifically,
229229
its internal variable `method_info`) links from a
230230
method table/signature-type pair to the corresponding definition (the backward workflow).
@@ -234,7 +234,7 @@ of `sigt`; consequently, this information allows one to look up the correspondin
234234
`locationinfo` and `def`. (When methods move, the location information stored by CodeTracking
235235
gets updated by Revise.)
236236

237-
Some additional notes about Revise's `ExprsSigs` maps:
237+
Some additional notes about Revise's `ExprsInfos` maps:
238238

239239
- For expressions that do not define a method, it is just `def=>nothing`
240240
- For expressions that do define a method, it is `def=>[mt_sigt1, ...]`.
@@ -254,10 +254,10 @@ Some additional notes about Revise's `ExprsSigs` maps:
254254
Any discrepancy with the current line numbers in the file is handled through updates to
255255
the location information stored by `CodeTracking`.
256256

257-
`ExprsSigs` are organized by module and then file, so that one can map
257+
`ExprsInfos` are organized by module and then file, so that one can map
258258
`filename`=>`module`=>`def`=>`mt_sigts`.
259259
Importantly, single-file modules can be "reconstructed" from the keys of the corresponding
260-
`ExprsSigs` (and multi-file modules from a collection of such items), since they hold
260+
`ExprsInfos` (and multi-file modules from a collection of such items), since they hold
261261
the complete ordered set of expressions that would be `eval`ed to define the module.
262262

263263
The global variable that holds all this information is [`Revise.pkgdatas`](@ref), organized
@@ -303,8 +303,8 @@ Items [b24a5932-55ed-11e9-2a88-e52f99e65a0d]
303303
304304
julia> pkgdata = Revise.pkgdatas[id]
305305
PkgData(Items [b24a5932-55ed-11e9-2a88-e52f99e65a0d]:
306-
"src/Items.jl": FileInfo(Main=>ExprsSigs(<1 expressions>, <0 signatures>), Items=>ExprsSigs(<2 expressions>, <3 signatures>), )
307-
"src/indents.jl": FileInfo(Items=>ExprsSigs(<2 expressions>, <2 signatures>), )
306+
"src/Items.jl": FileInfo(Main=>ExprsInfos(<1 expressions>, <0 signatures>), Items=>ExprsInfos(<2 expressions>, <3 signatures>), )
307+
"src/indents.jl": FileInfo(Items=>ExprsInfos(<2 expressions>, <2 signatures>), )
308308
```
309309

310310
(Your specific UUID may differ.)
@@ -325,7 +325,7 @@ package manager.
325325

326326
```julia-repl
327327
julia> pkgdata.fileinfos[2]
328-
FileInfo(Items=>ExprsSigs with the following expressions:
328+
FileInfo(Items=>ExprsInfos with the following expressions:
329329
:(indent(::UInt16) = begin
330330
2
331331
end)
@@ -337,7 +337,7 @@ FileInfo(Items=>ExprsSigs with the following expressions:
337337
This is just a summary; to see the actual `def=>mt_sigts` map, do the following:
338338

339339
```julia-repl
340-
julia> pkgdata.fileinfos[2].mod_exs_sigs[Items]
340+
julia> pkgdata.fileinfos[2].mod_exs_infos[Items]
341341
OrderedCollections.OrderedDict{Module, OrderedCollections.OrderedDict{Revise.RelocatableExpr, Union{Nothing, Vector{CodeTracking.MethodInfoKey}}}} with 2 entries:
342342
:(indent(::UInt16) = begin… => CodeTracking.MethodInfoKey[CodeTracking.MethodInfoKey(nothing, Tuple{typeof(indent),UInt16})]
343343
:(indent(::UInt8) = begin… => CodeTracking.MethodInfoKey[CodeTracking.MethodInfoKey(nothing, Tuple{typeof(indent),UInt8})]
@@ -361,21 +361,21 @@ and other expressions that are `eval`ed in `Items`.
361361

362362
When the file system notifies Revise that a file has been modified, Revise re-parses
363363
the file and assigns the expressions to the appropriate modules, creating a
364-
[`Revise.ModuleExprsSigs`](@ref) `mod_exs_sigs_new`.
365-
It then compares `mod_exs_sigs_new` against `mod_exs_sigs_ref`,
364+
[`Revise.ModuleExprsInfos`](@ref) `mod_exs_infos_new`.
365+
It then compares `mod_exs_infos_new` against `mod_exs_infos_ref`,
366366
the reference object that is synchronized to code as it was `eval`ed.
367367

368368
The following actions are taken:
369-
- if a `def` entry in `mod_exs_sigs_ref` is equal to one in `mod_exs_sigs_new`, the expression is "unchanged"
369+
- if a `def` entry in `mod_exs_infos_ref` is equal to one in `mod_exs_infos_new`, the expression is "unchanged"
370370
except possibly for line number. The `locationinfo` in `CodeTracking` is updated as needed.
371-
- if a `def` entry in `mod_exs_sigs_ref` is not present in `mod_exs_sigs_new`, that entry is deleted and
371+
- if a `def` entry in `mod_exs_infos_ref` is not present in `mod_exs_infos_new`, that entry is deleted and
372372
any corresponding methods are also deleted.
373-
- if a `def` entry in `mod_exs_sigs_new` is not present in `mod_exs_sigs_ref`, it is `eval`ed and then added to
374-
`mod_exs_sigs_ref`.
373+
- if a `def` entry in `mod_exs_infos_new` is not present in `mod_exs_infos_ref`, it is `eval`ed and then added to
374+
`mod_exs_infos_ref`.
375375

376-
Technically, a new `mod_exs_sigs_ref` is generated every time to ensure that the expressions are
377-
ordered as in `mod_exs_sigs_new`; however, conceptually this is better thought of as an updating of
378-
`mod_exs_sigs_ref`, after which `mod_exs_sigs_new` is discarded.
376+
Technically, a new `mod_exs_infos_ref` is generated every time to ensure that the expressions are
377+
ordered as in `mod_exs_infos_new`; however, conceptually this is better thought of as an updating of
378+
`mod_exs_infos_ref`, after which `mod_exs_infos_new` is discarded.
379379

380380
Note that one consequence is that modifying a method causes two actions, the deletion of
381381
the original followed by `eval`ing a new version.

src/logging.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ function Base.show(io::IO, l::LogRecord; kwargs...)
7373
elseif kw === :deltainfo
7474
keepitem = nothing
7575
for item in val
76-
if isa(item, DataType) || isa(item, Union{MethodSummary,Vector{MethodSummary}}) || (keepitem === nothing && isa(item, Union{RelocatableExpr,Expr}))
76+
if isa(item, Type) || isa(item, Union{MethodSummary,Vector{MethodSummary}}) || (keepitem === nothing && isa(item, Union{RelocatableExpr,Expr}))
7777
keepitem = item
7878
end
7979
end
8080
if isa(keepitem, Union{MethodSummary,Vector{MethodSummary}})
8181
print(io, ": ", keepitem)
8282
elseif isa(keepitem, Union{RelocatableExpr,Expr})
8383
print(io, ": ", firstline(keepitem))
84-
elseif isa(keepitem, DataType)
84+
elseif isa(keepitem, Type)
8585
print(io, ": ", keepitem)
8686
end
8787
end

0 commit comments

Comments
 (0)