Closed malkoG closed 1 year ago
Here is intuitive example.
Code snippet:
impl Foo { } impl Foo for Bar { }
Syntax Tree:
source_file [0, 0] - [7, 0] impl_item [0, 0] - [2, 1] type: type_identifier [0, 5] - [0, 8] body: declaration_list [0, 9] - [2, 1] impl_item [4, 0] - [6, 1] trait: type_identifier [4, 5] - [4, 8] type: type_identifier [4, 13] - [4, 16] body: declaration_list [4, 17] - [6, 1]
That is, If we want to access name of impl for struct, we have to access named child node type. If we want to access name of impl for trait, we have to access named child node trait.
type
trait
Here is intuitive example.
Code snippet:
Syntax Tree:
That is, If we want to access name of impl for struct, we have to access named child node
type
. If we want to access name of impl for trait, we have to access named child nodetrait
.