File tree Expand file tree Collapse file tree 2 files changed +29
-11
lines changed Expand file tree Collapse file tree 2 files changed +29
-11
lines changed Original file line number Diff line number Diff line change @@ -188,20 +188,10 @@ function shouldbreak(frame::Frame, pc::Int)
188
188
end
189
189
190
190
function prepare_slotfunction (framecode:: FrameCode , body:: Union{Symbol,Expr} )
191
- uslotnames = Set {Symbol} ()
192
- slotnames = Symbol[]
193
- for name in framecode. src. slotnames
194
- if name ∉ uslotnames
195
- push! (slotnames, name)
196
- push! (uslotnames, name)
197
- end
198
- end
199
191
framename, dataname = gensym (" frame" ), gensym (" data" )
200
192
assignments = Expr[:($ dataname = $ framename. framedata)]
201
193
default = Unassigned ()
202
- for i = 1 : length (slotnames)
203
- slotname = framecode. src. slotnames[i]
204
- qslotname = QuoteNode (slotname)
194
+ for slotname in unique (framecode. src. slotnames)
205
195
list = framecode. slotnamelists[slotname]
206
196
if length (list) == 1
207
197
maxexpr = :($ dataname. last_reference[$ (list[1 ])] > 0 ? $ (list[1 ]) : 0 )
Original file line number Diff line number Diff line change @@ -433,3 +433,31 @@ empty!(breakpoint_update_hooks)
433
433
remove ()
434
434
end
435
435
end
436
+
437
+ @testset " duplicate slotnames" begin
438
+ tmp_dupl () = (1 ,2 ,3 ,4 )
439
+ ln = @__LINE__
440
+ function duplnames (x)
441
+ for iter in Iterators. CartesianIndices (x)
442
+ i = iter[1 ]
443
+ c = i
444
+ a, b, c, d = tmp_dupl ()
445
+ end
446
+ return x
447
+ end
448
+ bp = breakpoint (@__FILE__ , ln+ 5 , :(i == 1 ))
449
+ c = @code_lowered (duplnames ((1 ,2 )))
450
+ if length (unique (c. slotnames)) < length (c. slotnames)
451
+ f = JuliaInterpreter. enter_call (duplnames, (1 ,2 ))
452
+ ex = JuliaInterpreter. prepare_slotfunction (f. framecode, :(i== 1 ))
453
+ @test ex isa Expr
454
+ found = false
455
+ for arg in ex. args[end ]. args
456
+ if arg. args[1 ] == :i
457
+ found = true
458
+ end
459
+ end
460
+ @test found
461
+ @test last (JuliaInterpreter. debug_command (f, :c )) isa BreakpointRef
462
+ end
463
+ end
You can’t perform that action at this time.
0 commit comments