irb icon indicating copy to clipboard operation
irb copied to clipboard

Handle keyword local variables correctly

Open tompng opened this issue 10 months ago • 0 comments

Local variable can be a keyword. Fix a bug that IRB doesn't work in this case.

irb(main):001> {if:1} => {if:}
=> nil
irb(main):002> 1+2
irb(main):003> 
irb(main):004> (Can't submit input)

IRB prepends local variable assignment code a=_=nil; to the input code. (Because Ruby code is parsed differently depending on local variable existence) Prepending if=_=nil; cause bug in this case.

tompng avatar Feb 13 '25 11:02 tompng