File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
5
5
6
6
[[CSTParser ]]
7
7
deps = [" LibGit2" , " Test" , " Tokenize" ]
8
- git-tree-sha1 = " 82be55a328f39a11849569815a9f49911d6d7b58 "
8
+ git-tree-sha1 = " d878de3315f9b6569851d919f7976fe527d00c24 "
9
9
repo-rev = " location"
10
10
repo-url = " https://github.com/MikeInnes/CSTParser.jl"
11
11
uuid = " 00ebfdb7-1f24-5e51-bd34-a7502290713f"
Original file line number Diff line number Diff line change 59
59
60
60
function replacement (src:: SourceFile , p:: Replace )
61
61
loc = exprloc (src. ast, p. idx)
62
+ if loc == nothing
63
+ @warn " No location found for $(repr (CSTParser. striploc (expridx (src. ast, p. idx)))) "
64
+ return
65
+ end
62
66
prec = precedence_level (src. cst, loc)
63
67
_, span = charrange (src. cst, loc)
64
68
span => sprint (Base. show_unquoted, p. new, 0 , prec)
@@ -90,7 +94,8 @@ function replacement(src::SourceFile, p::Delete)
90
94
span => " "
91
95
end
92
96
93
- replacement (src:: SourceFile , p:: Patch ) = [replacement (src, p) for p in p. ps]
97
+ replacement (src:: SourceFile , p:: Patch ) =
98
+ filter (x -> x != nothing , [replacement (src, p) for p in p. ps])
94
99
95
100
function patch (io:: IO , src:: SourceFile , rs)
96
101
rs = sort (rs, by= x-> first (x[1 ]))
You can’t perform that action at this time.
0 commit comments