JuliaLang / JuliaSyntax.jl

The Julia compiler frontend
Other
272 stars 35 forks source link

Rename `haschildren()` to `is_leaf()` #483

Closed c42f closed 1 month ago

c42f commented 1 month ago

Unfortunately, haschildren(x) was a terrible name because it's not testing the same thing as numchildren(x) == 0!

In our ASTs

Occasionally we can have internal nodes which have no tokens and thus have numchildren(node) == 0. These are, however, still "internal nodes" and we have haschildren(node) === true for these which makes no sense!