nikic/php-ast

Idea: Make ast\Node->endLineno a declared property?

TysonAndre opened this issue · 5 comments

Historically, ast\Node\Decl was a subclass of ast\Node, but in the latest AST parsing versions, everything is combined.

Alternately, php-ast could add an attributes array property to which a field endLineno could be added in AST versions exceeding some minimum value (and stop setting endLineno in older AST versions)

nikic commented

Hm, maybe we can make it part of children for the few nodes that need it?

That's probably simpler and more memory efficient. I guess target the next AST "major" version (current =90, next $version=100?)

We're already adding __declId to children

nikic commented

Yeah, exactly.

nikic commented

With #[AllowDynamicProperties], I guess we can just leave this as-is?

With #[AllowDynamicProperties], I guess we can just leave this as-is?

I agree