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

Allow to visit cond node in case #6032

Merged
merged 1 commit into from Apr 30, 2018

Conversation

veelenga
Copy link
Contributor

@veelenga veelenga commented Apr 30, 2018

For some reason, the compiler does not allow to traverse the nodes in Crystal::Case#cond. I guess it is a bug. Please suggest the place for the specs.

Example:

class Visitor < Crystal::Visitor
  def visit(node : Crystal::ASTNode)
    puts node.class
    true
  end
end

parser = Crystal::Parser.new %(
  case (a == 2 && b == 3) # cond expression is not expanded/visited
  when true then nil
  end
)

Visitor.new.accept parser.parse # Crystal::Case
                                # Crystal::When
                                # Crystal::BoolLiteral
                                # Crystal::NilLiteral

@RX14 RX14 requested a review from asterite April 30, 2018 21:30
@asterite asterite merged commit ee20101 into crystal-lang:master Apr 30, 2018
@asterite
Copy link
Member

Good catch, thank you!

@RX14 RX14 added this to the Next milestone Apr 30, 2018
@veelenga veelenga deleted the fix/visit-when-cond branch May 1, 2018 06:02
veelenga added a commit to crystal-ameba/ameba that referenced this pull request May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants