function groupByContributors(symbol, aBorrowedMembers) {

	let MAX_ORDER = 1000, // a sufficiently large number
		mContributors = {},
		aSortedContributors = [];

	aBorrowedMembers.forEach(function(borrowed) {
		let $ = lookup(borrowed.inherits);
		if ($) {
			if (mContributors[$.memberof] == null) {
				mContributors[$.memberof] = { order : MAX_ORDER, items : [$] };
			} else {
				mContributors[$.memberof].items.push($);
			}
		} else {
			future(`symbol '${borrowed.longname}' has 'inherited' flag set, but inherits missing symbol '${borrowed.inherits}' (skipped)`);
		}
	});

	// order contributors according to their distance in the inheritance hierarchy
	let order = 0;
	(function handleAugments(oSymbol) {
		if ( oSymbol.augments ) {
			const aParentsToVisit = [];
			// first assign an order
			for (let i = 0; i < oSymbol.augments.length; i++) {
				if ( mContributors[oSymbol.augments[i]] != null && mContributors[oSymbol.augments[i]].order === MAX_ORDER ) {
					mContributors[oSymbol.augments[i]].order = ++order;
					aParentsToVisit.push(oSymbol.augments[i]);
				}
			}
			// only then dive into parents (breadth first search)
			for (let i = 0; i < aParentsToVisit.length; i++) {
				const oTarget = lookup(aParentsToVisit);
				if ( oTarget ) {
					handleAugments(oTarget);
				}
			}
		}
	}(symbol));

	// convert to an array and sort by order
	for (let i in mContributors) {
		aSortedContributors.push(mContributors[i]);
	}
	aSortedContributors.sort((a,b) => a.order - b.order);

	return aSortedContributors;

}
/**
 * Determines the set of contributors of the given borrowed members.
 * The contributors are sorted according to the inheritance hierarchy:
 * first the base class of symbol, then the base class of the base class etc.
 * Any contributors that can not be found in the hierarchy are appended
 * to the set.
 *
 * @param {Symbol} symbol of which these are the members
 * @param {array} aBorrowedMembers set of borrowed members to determine the contributors for
 * @return {array} sorted array of contributors
 */
Determines the set of contributors of the given borrowed members.
The contributors are sorted according to the inheritance hierarchy:
first the base class of symbol, then the base class of the base class etc.
Any contributors that can not be found in the hierarchy are appended
to the set.

@param {Symbol} symbol of which these are the members
@param {array} aBorrowedMembers set of borrowed members to determine the contributors for
@return {array} sorted array of contributors
Determines the set of contributors of the given borrowed members . The contributors are sorted according to the inheritance hierarchy : first the base class of symbol then the base class of the base class etc . Any contributors that can not be found in the hierarchy are appended to the set . @param { Symbol } symbol of which these are the members @param { array } aBorrowedMembers set of borrowed members to determine the contributors for @return { array } sorted array of contributors
function groupByContributors(symbol, aBorrowedMembers) {
	let MAX_ORDER = 1000, 
		mContributors = {},
		aSortedContributors = [];
	aBorrowedMembers.forEach(function(borrowed) {
		let $ = lookup(borrowed.inherits);
		if ($) {
			if (mContributors[$.memberof] == null) {
				mContributors[$.memberof] = { order : MAX_ORDER, items : [$] };
			} else {
				mContributors[$.memberof].items.push($);
			}
		} else {
			future(`symbol '${borrowed.longname}' has 'inherited' flag set, but inherits missing symbol '${borrowed.inherits}' (skipped)`);
		}
	});
	let order = 0;
	(function handleAugments(oSymbol) {
		if ( oSymbol.augments ) {
			const aParentsToVisit = [];
			for (let i = 0; i < oSymbol.augments.length; i++) {
				if ( mContributors[oSymbol.augments[i]] != null && mContributors[oSymbol.augments[i]].order === MAX_ORDER ) {
					mContributors[oSymbol.augments[i]].order = ++order;
					aParentsToVisit.push(oSymbol.augments[i]);
				}
			}
			for (let i = 0; i < aParentsToVisit.length; i++) {
				const oTarget = lookup(aParentsToVisit);
				if ( oTarget ) {
					handleAugments(oTarget);
				}
			}
		}
	}(symbol));
	for (let i in mContributors) {
		aSortedContributors.push(mContributors[i]);
	}
	aSortedContributors.sort((a,b) => a.order - b.order);
	return aSortedContributors;
}
function groupByContributors ( symbol , aBorrowedMembers ) { let MAX_ORDER = 1000 , mContributors = { } , aSortedContributors = [ ] ; aBorrowedMembers . forEach ( function ( borrowed ) { let $ = lookup ( borrowed . inherits ) ; if ( $ ) { if ( mContributors [ $ . memberof ] == null ) { mContributors [ $ . memberof ] = { order : MAX_ORDER , items : [ $ ] } ; } else { mContributors [ $ . memberof ] . items . push ( $ ) ; } } else { future ( ` ${ borrowed . longname } ${ borrowed . inherits } ` ) ; } } ) ; let order = 0 ; ( function handleAugments ( oSymbol ) { if ( oSymbol . augments ) { const aParentsToVisit = [ ] ; for ( let i = 0 ; i < oSymbol . augments . length ; i ++ ) { if ( mContributors [ oSymbol . augments [ i ] ] != null && mContributors [ oSymbol . augments [ i ] ] . order === MAX_ORDER ) { mContributors [ oSymbol . augments [ i ] ] . order = ++ order ; aParentsToVisit . push ( oSymbol . augments [ i ] ) ; } } for ( let i = 0 ; i < aParentsToVisit . length ; i ++ ) { const oTarget = lookup ( aParentsToVisit ) ; if ( oTarget ) { handleAugments ( oTarget ) ; } } } } ( symbol ) ) ; for ( let i in mContributors ) { aSortedContributors . push ( mContributors [ i ] ) ; } aSortedContributors . sort ( ( a , b ) => a . order - b . order ) ; return aSortedContributors ; }
Determines the set of contributors of the given borrowed members.
Determines the set of contributors of the given borrowed members .
// a sufficiently large number // order contributors according to their distance in the inheritance hierarchy // first assign an order // only then dive into parents (breadth first search) // convert to an array and sort by order