Skip to content

Ripper comparison operators #6548

@kddnewton

Description

@kddnewton

Environment Information

jruby 9.2.14.0 (2.5.7) 2020-12-08 ebe64ba OpenJDK 64-Bit Server VM 25.265-b01 on 1.8.0_265-b01 +jit [darwin-x86_64]
Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64

Expected Behavior

ruby -rripper -e 'pp Ripper.sexp("1 < 2")'

On CRuby

[:program, [[:binary, [:@int, "1", [1, 0]], :<, [:@int, "2", [1, 4]]]]]

Actual Behavior

On JRuby:

[:program,
 [[:binary, [:@int, "1", [1, 0]], [:@op, "<", [1, 2]], [:@int, "2", [1, 4]]]]]

Note the difference is the comparison operator gets reported as an @op node, whereas on CRuby it's just a Symbol. Interestingly, if you change it to 1 + 2, it'll be a Symbol.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions