kddnewton / parser-prism

A prism backend for the whitequark/parser gem
MIT License
24 stars 4 forks source link

Fix self assignment node with global vars #10

Closed takaram closed 10 months ago

takaram commented 10 months ago

$foo &&= 1 and $foo ||= 1 was not parsed correctly. This PR fixes it.

On main branch:

$ bin/parse -e '$foo ||= 1'
warning: parser/current is loading parser/ruby33, which recognizes 3.3.0-dev-compliant syntax, but you are running 3.3.0.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
-e
expected:
s(:or_asgn,
  s(:gvasgn, :$foo),
  s(:int, 1))
actual:
s(:op_asgn,
  s(:gvasgn, :$foo), :"||=",
  s(:int, 1))
kddnewton commented 10 months ago

Thank you!