-
-
Notifications
You must be signed in to change notification settings - Fork 949
semantic: Remove Option from parent_* methods #11946
Copy link
Copy link
Closed
Description
Originally suggested by @overlookmotel. Currently, all of the methods relating to getting a node's parent ID/kind/node return Option<&AstNode>. However, we know that all AST nodes should have a parent, with the exception of Program. In this case, we could have Program be self-referential: it will return its parent ID as itself, and then we can remove Option from the return type of all methods fetching parent data. This would remove a lot of boilerplate code in the linter and elsewhere. Could potentially improve performance as well by removing lots of unnecessary branches which means fewer instructions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackPriority
None yet