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

Refactor interpret '==' and '!=' of MacroId #3577

Merged
merged 1 commit into from Nov 29, 2016

Conversation

makenowjust
Copy link
Contributor

@makenowjust makenowjust commented Nov 24, 2016

It is the best. Thanks @Sija.

Not the best, but a better.

I think the best is:

        if (arg = args.first?).is_a?(StringLiteral | SymbolLiteral)
          if method == "=="
            return BoolLiteral.new(@value == arg.value)
          else
            return BoolLiteral.new(@value != arg.value)
          end
        end
        return super

However, compiler doesn't accept this.

@Sija
Copy link
Contributor

Sija commented Nov 24, 2016

You can do:

case arg = args.first?
when StringLiteral, SymbolLiteral
  # ...
end

@makenowjust
Copy link
Contributor Author

@Sija Ah, thanks.

@asterite
Copy link
Member

Thank you!

@asterite asterite merged commit c94094c into crystal-lang:master Nov 29, 2016
@makenowjust makenowjust deleted the fix/macroid-eq-neq branch December 4, 2016 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants