Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix != operator definition #264

Merged

Commits on Aug 1, 2024

  1. Fix != operator definition

    Problem: If a class declare the not-equal operator `!=`, the parsing
    is wrong. For instance, the folowing program:
    
    class A
      def !=(other); end
    end
    
    is parsed as if the method `!` was a defined with the body expression
    syntax leading to the following tree:
    
    (program [0, 0] - [3, 0]
      (class [0, 0] - [1, 20]
        name: (constant [0, 6] - [0, 7])
        body: (body_statement [1, 2] - [1, 16]
          (method [1, 2] - [1, 15]
            name: (operator [1, 6] - [1, 7])
            body: (parenthesized_statements [1, 8] - [1, 15]
              (identifier [1, 9] - [1, 14])))))
      (identifier [2, 0] - [2, 3]))
    
    Solution: Declare `!=` as a possible operator definition.
    stac47 committed Aug 1, 2024
    Configuration menu
    Copy the full SHA
    2d2887f View commit details
    Browse the repository at this point in the history