py-tree-sitter
                                
                                 py-tree-sitter copied to clipboard
                                
                                    py-tree-sitter copied to clipboard
                            
                            
                            
                        node.children_by_field_name returns unnamed children for bad input
expected result:
node.children_by_field_name('') should return an empty list
actual result:
node.children_by_field_name('') returns all unnamed children
ipdb> node.text
b'Foo: A = 1'
ipdb> node.children_by_field_name('left')
[<Node kind=identifier, start_point=(0, 0), end_point=(0, 3)>]
ipdb> node.children_by_field_name('')
[<Node kind=":", start_point=(0, 3), end_point=(0, 4)>, <Node kind="=", start_point=(0, 7), end_point=(0, 8)>]
ipdb> node.children_by_field_name(None)
*** TypeError: a bytes-like object is required, not 'NoneType'
ipdb> node.children_by_field_name('asdf')
[<Node kind=":", start_point=(0, 3), end_point=(0, 4)>, <Node kind="=", start_point=(0, 7), end_point=(0, 8)>]
@maxbrunsfeld thoughts?
I've stumbled across the same issue. I'm writing a grammar, and I'd like users to be able to do something like function_def.children_by_field_name("arg"), and have it return an empty list when there are no arguments.
#180 Fixes this