File tree Expand file tree Collapse file tree 2 files changed +31
-10
lines changed Expand file tree Collapse file tree 2 files changed +31
-10
lines changed Original file line number Diff line number Diff line change @@ -189,19 +189,18 @@ end
189
189
190
190
function prepare_slotfunction (framecode:: FrameCode , body:: Union{Symbol,Expr} )
191
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
192
framename, dataname = gensym (" frame" ), gensym (" data" )
200
193
assignments = Expr[:($ dataname = $ framename. framedata)]
201
194
default = Unassigned ()
202
- for i = 1 : length (slotnames)
203
- slotname = framecode. src. slotnames[i]
204
- qslotname = QuoteNode (slotname)
195
+ for slotname in framecode. src. slotnames
196
+ if slotname === Symbol (" " )
197
+ continue
198
+ end
199
+ if slotname ∉ uslotnames
200
+ push! (uslotnames, slotname)
201
+ else
202
+ continue
203
+ end
205
204
list = framecode. slotnamelists[slotname]
206
205
if length (list) == 1
207
206
maxexpr = :($ dataname. last_reference[$ (list[1 ])] > 0 ? $ (list[1 ]) : 0 )
Original file line number Diff line number Diff line change @@ -433,3 +433,25 @@ 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
+ @test ex. args[end ]. args[end - 1 ]. args[1 ] == :i
455
+ @test last (JuliaInterpreter. debug_command (f, :c )) isa BreakpointRef
456
+ end
457
+ end
You can’t perform that action at this time.
0 commit comments