An ancestor list is an array of AST objects containing the currently projected AST object, ordered from its nearest parent toward the root. It lets Projection travel upward through containment relationships instead of receiving only one parent. section 5.4
Use the list while recursively projecting an AST:
- Start the root projection with ancestors={[]}. section 5.4
- Pass ancestors={[astObject, ...ancestors]} when projecting each contained object, preserving nearest-first order. section 5.4
- Find required context with ancestors.find, such as the enclosing Record Type or Data Attribute. section 5.4
Resolving an attribute reference
An Attribute Reference searches the ancestor list for a Record Type, reads its attributes, and uses those attributes to populate the reference dropdown. section 5.4
Figure 5.12 Finding all attributes in the record type by traversing up the example AST from the attribute reference
Trace the upward traversal from an attribute reference to its enclosing record type. section 5.4
