Branch: Tag:

2014-09-28

2014-09-28 23:26:47 by Chris Angelico <rosuav@gmail.com>

Document Program.all_inherits and give an example

14:   }       - //! @fixme - //! Document this function. + //! Enumerate all programs this program inherits, directly or indirectly. + //! Similar to inherit_tree() but returns a flat array. + //! + //! @example + //! > class a{} + //! > class b{} + //! > class c{ inherit a; } + //! > class d{ inherit b; inherit c; } + //! > Program.inherit_tree(d); + //! Result: ({ /* 3 elements */ + //! b, + //! c, + //! a + //! })   array(program) all_inherits(program p)   {    array(program) ret = inherit_list(p); -  +  // Iterate over a mutated array to catch all inherits to infinite depth    for(int e=0;e<sizeof(ret);e++) ret+=inherit_list(ret[e]);    return ret;   }