allocNodeSlice returns a zero-length slice with the given capacity, backed by the pre-allocated nodeArena. This avoids a heap allocation per NodeList.
(capacity int)
| 98 | // allocNodeSlice returns a zero-length slice with the given capacity, backed by |
| 99 | // the pre-allocated nodeArena. This avoids a heap allocation per NodeList. |
| 100 | func (d *astDecoder) allocNodeSlice(capacity int) []*ast.Node { |
| 101 | start := len(d.nodeArena) |
| 102 | d.nodeArena = d.nodeArena[:start+capacity] |
| 103 | return d.nodeArena[start : start : start+capacity] |
| 104 | } |
| 105 | |
| 106 | // nodeField reads a uint32 field from node i at the given field offset. |
| 107 | func (d *astDecoder) nodeField(i int, field int) uint32 { |
no test coverage detected