typegraph/scripts/treenode/hasParentNode.gml

18 lines
448 B
Plaintext

///hasParentNode(id, ind)
/**
* hasParentNode :: TreeNode -> Class -> Bool
*
* Returns whether `id` has a parent node of type `ind` somewhere up the tree.
*
* @param id the node to check
* @param ind the node type type to look for
* @returns true if id has a parent of type ind, false otherwise
*/
for (var node = argument0.parent; node != noone; node = node.parent)
if (node.object_index == argument1)
return true;
return false;