Documentation improvement: Can Node be null?
Nobody has claimed this yet.
- Dominant language
- Ada
- Stars
- 171
- Forks
- 48
- PR merge metrics
- No merged PRs in 30d
Description
Dear LibAdaLang developers,
Libadalang is nicely documented.
For example, the function F_Suffix is documented in libadalang-analysis.adsas follows
function F_Suffix
(Node : Call_Expr'Class) return Ada_Node;
-- This field can contain one of the following nodes:
-- :ada:ref:`Attribute_Ref`, :ada:ref:`Basic_Assoc_List`,
-- :ada:ref:`Bin_Op`, :ada:ref:`Call_Expr`, :ada:ref:`Char_Literal`,
-- :ada:ref:`Discrete_Subtype_Indication`, :ada:ref:`Dotted_Name`,
-- :ada:ref:`Explicit_Deref`, :ada:ref:`Identifier`, :ada:ref:`Qual_Expr`,
-- :ada:ref:`Reduce_Attribute_Ref`, :ada:ref:`String_Literal`,
-- :ada:ref:`Target_Name`, :ada:ref:`Update_Attribute_Ref`
--% belongs-to: Call_Expr
Yet, I think there is room for improvement.
Suppose, I want to call Kind on the result of X.F_Suffix.
Kind requires that for its argument Y holds that Y.Is_Null returns false.
However, the documentation of F_Suffix states nothing about whether the node returned by F_Suffix can be null.
So, it is unclear whether a check like not X.F_Suffix.Is_Null is
- necessary before calling
Kindor - just hampering performance and wasting energy?
Can the documentation be extended with information about an Ada_Node being a nullnode?
Greetings,
Pierre
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in libadalang-analysis.ads with the F_Suffix declaration and its referenced Kind contract. Determine how the documentation represents whether an Ada_Node may be null, then document the nullability of F_Suffix clearly, including when callers must check Is_Null. Done means users can tell whether calling Kind directly is valid.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100