tree-sitter/tree-sitter-php

type_name hides node type by alias

cfroystad opened this issue · 1 comments

Currently, we have _type_name defined as follows:

_type_name: $ => alias(choice($.name, $.qualified_name), $.type_name),

Example: (type_name) or (type_name (namespace_name_as_prefix) (name))

This could make usage harder, since the implementer would not only have to know that type_name could have those options, but would also need to know enough internals to detect which kind of node type_name is in each instance.

Therefore, I propose we change type_name from being an aliased anonymous node absorbing any child, to being a normal node named named_type or type_named:

named_type: $ => choice($.name, $.qualified_name),

Example: (named_type (name)) or (named_type (qualified_name (namespace_name_as_prefix) (name)))

This makes sense to me.