Examines source and its ancestors and returns the "deepest"
Source having an SourceExtension with the given
extension_name.
If neither source nor any of its ancestors have such an extension, the function returns null
.
This function is useful in cases when an SourceExtension is meant to apply to both the Source it belongs to and the Source's descendants.
A common example is the SourceCollection extension, where
descendants of an Source having an
SourceCollection extension are implied to be members of that
collection. In that example, this function can be used to test whether source is a member of a collection.
The returned Source is referenced for thread-safety and must be unreferenced with unref when finished with it.
Note the function returns the Source containing the SourceExtension instead of the SourceExtension itself because extension instances are not to be referenced directly (see get_extension).
| this | |
| source |
an Source |
| extension_name |
the extension name to find |
|
an Source, or null if no match was found |