Commit 9899954
authored
[JuliaSyntax] Return generator from
Return a generator instead of a `Vector{Symbol}` from `attrnames` to
avoid unnecessary allocation. `attrnames` is called from
`hasproperty(::SyntaxTree, ::Symbol)` and similar hot-path queries, so
avoiding the allocation would be worthwhile. This is compatible with the
`propertynames` interface which accepts any iterable of properties,
although `node_string` needed to be updated since the return value is
now `Tuple{Vararg{Symbol}}` instead of a vector of the symbols.
Also wrap inference tests in a `@testset` and add a test for
`hasproperty` return type inference.
Follows up #61518.attrnames(::SyntaxTree) (#61522)1 parent a992d84 commit 9899954
2 files changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | 48 | | |
50 | | - | |
51 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
0 commit comments