-
-
Notifications
You must be signed in to change notification settings - Fork 58
Bug formating code, possibly? #297
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
Comments
Yeah, generally we don't really test formatting inner nodes of the tree, just from the top down. But I can see this use case, so it'll be fixed by #300. |
Just so you know use it to see if you changed any assosiasions on any of our models. If you did it would require us to update some doc, sometimes. So I find all the calls to class AssosiationVisitor < SyntaxTree::Visitor
attr_reader :assosiations
def initialize
@assosiations = []
end
visit_method def visit_command(node)
if ASSOSIATION_RELATIONS.member?(node.message.value)
formatter = SyntaxTree::Formatter.new(node, [])
node.format(formatter)
formatter.flush
@assosiations.push(formatter.output.join)
end
super
end
end
def find_assisiations(source)
visitor = AssosiationVisitor.new
visitor.visit(SyntaxTree.parse(source))
visitor.assosiations
end |
Nice that's cool! A small thing, you can move a couple of things around in there and it might be a little more ergonomic. class AssosiationVisitor < SyntaxTree::Visitor
attr_reader :assosiations
def initialize
@assosiations = []
end
visit_method def visit_command(node)
if ASSOSIATION_RELATIONS.member?(node.message.value)
formatter = SyntaxTree::Formatter.new(node, [])
node.format(formatter)
formatter.flush
@assosiations.push(formatter.output.join)
end
super
end
def visit_program(node)
assosiations
end
end
def find_assisiations(source)
SyntaxTree.parse(source).accept(AssosiationVisitor.new)
end |
It should be ... right? def visit_program(node)
super
assosiations
end |
Ahh yeah, there should be a |
I think I have found a bug. I think this code should work.
right now I get
The text was updated successfully, but these errors were encountered: