1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Don’t bother erasing the children collection.

This commit is contained in:
Rob Rix 2015-10-28 18:23:58 -04:00
parent e2e37a011d
commit dc148e31cb

View File

@ -13,16 +13,16 @@ extension TSNode {
return start..<(start + ts_node_size(self).chars)
}
var children: AnyRandomAccessCollection<TSNode> {
return AnyRandomAccessCollection(ChildrenCollection(node: self, count: ts_node_child_count(self), child: ts_node_child))
var children: ChildrenCollection {
return ChildrenCollection(node: self, count: ts_node_child_count(self), child: ts_node_child)
}
var namedChildren: AnyRandomAccessCollection<TSNode> {
return AnyRandomAccessCollection(ChildrenCollection(node: self, count: ts_node_named_child_count(self), child: ts_node_named_child))
var namedChildren: ChildrenCollection {
return ChildrenCollection(node: self, count: ts_node_named_child_count(self), child: ts_node_named_child)
}
private struct ChildrenCollection: CollectionType {
struct ChildrenCollection: CollectionType {
let node: TSNode
let count: Int
let child: (TSNode, Int) -> TSNode