function createInheritanceTree() {

	function makeDoclet(longname, lines) {
		lines.push("@name " + longname);
		const newDoclet = new doclet.Doclet("/**\n * " + lines.join("\n * ") + "\n */", {});
		newDoclet.__ui5 = {};
		__longnames[longname] = newDoclet;
		__db.insert(newDoclet);
		return newDoclet;
	}

	info(`create inheritance tree (${__db().count()} symbols)`);

	const oTypes = __db(function() { return supportsInheritance(this); });
	const aRootTypes = [];

	let oObject = lookup("Object");
	if ( !oObject ) {
		oObject = makeDoclet("Object", [
			"@class",
			"@synthetic",
			"@public"
		]);
		aRootTypes.push(oObject);
	}

	function getOrCreateClass(sClass, sExtendingClass) {
		let oClass = lookup(sClass);
		if ( !oClass ) {
			let sKind = "class",
				sBaseClass = 'Object',
				sVisibility = "public";
			if ( externalSymbols[sClass] ) {
				sKind = externalSymbols[sClass].kind || sKind;
				sBaseClass = externalSymbols[sClass].extends || sBaseClass;
				sVisibility = externalSymbols[sClass].visibility || sVisibility;
				debug(`create doclet for external class ${sClass} (extended by ${sExtendingClass})`);
			} else {
				warning(`create missing class ${sClass} (extended by ${sExtendingClass})`);
			}
			let oBaseClass = getOrCreateClass(sBaseClass, sClass);
			oClass = makeDoclet(sClass, [
				"@extends " + sBaseClass,
				"@" + sKind,
				"@synthetic",
				sVisibility === "restricted" ? "@ui5-restricted" : "@" + sVisibility
			]);
			oClass.__ui5.base = oBaseClass;
			oBaseClass.__ui5.derived = oBaseClass.__ui5.derived || [];
			oBaseClass.__ui5.derived.push(oClass);
		}
		return oClass;
	}

	// link them according to the inheritance infos
	oTypes.each((oClass) => {

		if ( oClass.longname === 'Object') {
			return;
		}

		let sBaseClass = "Object";
		if ( oClass.augments && oClass.augments.length > 0 ) {
			if ( oClass.augments.length > 1 ) {
				warning(`multiple inheritance detected in ${oClass.longname}`);
			}
			sBaseClass = oClass.augments[0];
		} else {
			aRootTypes.push(oClass);
		}

		let oBaseClass = getOrCreateClass(sBaseClass, oClass.longname);
		oClass.__ui5.base = oBaseClass;
		oBaseClass.__ui5.derived = oBaseClass.__ui5.derived || [];
		oBaseClass.__ui5.derived.push(oClass);

		if ( oClass.implements ) {
			for (let j = 0; j < oClass.implements.length; j++) {
				let oInterface = lookup(oClass.implements[j]);
				if ( !oInterface ) {
					let sVisibility = "public";
					if ( externalSymbols[oClass.implements[j]] ) {
						sVisibility = externalSymbols[oClass.implements[j]] || sVisibility;
						debug(`create doclet for external interface ${oClass.implements[j]}`);
					}  else {
						warning(`create missing interface ${oClass.implements[j]}`);
					}
					oInterface = makeDoclet(oClass.implements[j], [
						"@interface",
						"@synthetic",
						sVisibility === "restricted" ? "@ui5-restricted" : "@" + sVisibility
					]);
					oInterface.__ui5.base = oObject;
					oObject.__ui5.derived = oObject.__ui5.derived || [];
					oObject.__ui5.derived.push(oInterface);
				}
				oInterface.__ui5.implementations = oInterface.__ui5.implementations || [];
				oInterface.__ui5.implementations.push(oClass);
			}
		}
	});

	function setStereotype(oSymbol, sStereotype) {
		if ( !oSymbol ) {
			return;
		}
		oSymbol.__ui5.stereotype = sStereotype;
		const derived = oSymbol.__ui5.derived;
		if ( derived ) {
			for (let i = 0; i < derived.length; i++ ) {
				if ( !derived[i].__ui5.stereotype ) {
					setStereotype(derived[i], sStereotype);
				}
			}
		}
	}

	setStereotype(lookup("sap.ui.core.Component"), "component");
	setStereotype(lookup("sap.ui.core.Control"), "control");
	setStereotype(lookup("sap.ui.core.Element"), "element");
	setStereotype(lookup("sap.ui.base.Object"), "object");

	// check for cyclic inheritance (not supported)
	// Note: the check needs to run bottom up, not top down as a typical cyclic dependency never will end at the root node
	oTypes.each((oStartClass) => {
		const visited = {};
		function visit(oClass) {
			if ( visited[oClass.longname] ) {
				throw new Error(`cyclic inheritance detected: ${JSON.stringify(Object.keys(visited))}`);
			}
			if ( oClass.__ui5.base ) {
				visited[oClass.longname] = true;
				visit(oClass.__ui5.base);
				delete visited[oClass.longname];
			}
		}
		visit(oStartClass);
	});

	// collect root nodes (and ignore pure packages)
	return aRootTypes;
}
/*
 * Calculates the inheritance hierarchy for all class/interface/namespace symbols.
 * Each node in the tree has the content
 *
 * Node : {
 *      longname  : {string}     // name of the node (usually equals symbol.longname)
 *      symbol    : {Symbol}     // backlink to the original symbol
 *      base      : {Node}       // parent node or undefined for root nodes
 *      derived   : {Node[]}     // subclasses/-types
 * }
 *
 */
Calculates the inheritance hierarchy for all class/interface/namespace symbols.
Each node in the tree has the content


Calculates the inheritance hierarchy for all class / interface / namespace symbols . Each node in the tree has the content
function createInheritanceTree() {
	function makeDoclet(longname, lines) {
		lines.push("@name " + longname);
		const newDoclet = new doclet.Doclet("/**\n * " + lines.join("\n * ") + "\n */", {});
		newDoclet.__ui5 = {};
		__longnames[longname] = newDoclet;
		__db.insert(newDoclet);
		return newDoclet;
	}
	info(`create inheritance tree (${__db().count()} symbols)`);
	const oTypes = __db(function() { return supportsInheritance(this); });
	const aRootTypes = [];
	let oObject = lookup("Object");
	if ( !oObject ) {
		oObject = makeDoclet("Object", [
			"@class",
			"@synthetic",
			"@public"
		]);
		aRootTypes.push(oObject);
	}
	function getOrCreateClass(sClass, sExtendingClass) {
		let oClass = lookup(sClass);
		if ( !oClass ) {
			let sKind = "class",
				sBaseClass = 'Object',
				sVisibility = "public";
			if ( externalSymbols[sClass] ) {
				sKind = externalSymbols[sClass].kind || sKind;
				sBaseClass = externalSymbols[sClass].extends || sBaseClass;
				sVisibility = externalSymbols[sClass].visibility || sVisibility;
				debug(`create doclet for external class ${sClass} (extended by ${sExtendingClass})`);
			} else {
				warning(`create missing class ${sClass} (extended by ${sExtendingClass})`);
			}
			let oBaseClass = getOrCreateClass(sBaseClass, sClass);
			oClass = makeDoclet(sClass, [
				"@extends " + sBaseClass,
				"@" + sKind,
				"@synthetic",
				sVisibility === "restricted" ? "@ui5-restricted" : "@" + sVisibility
			]);
			oClass.__ui5.base = oBaseClass;
			oBaseClass.__ui5.derived = oBaseClass.__ui5.derived || [];
			oBaseClass.__ui5.derived.push(oClass);
		}
		return oClass;
	}
	oTypes.each((oClass) => {
		if ( oClass.longname === 'Object') {
			return;
		}
		let sBaseClass = "Object";
		if ( oClass.augments && oClass.augments.length > 0 ) {
			if ( oClass.augments.length > 1 ) {
				warning(`multiple inheritance detected in ${oClass.longname}`);
			}
			sBaseClass = oClass.augments[0];
		} else {
			aRootTypes.push(oClass);
		}
		let oBaseClass = getOrCreateClass(sBaseClass, oClass.longname);
		oClass.__ui5.base = oBaseClass;
		oBaseClass.__ui5.derived = oBaseClass.__ui5.derived || [];
		oBaseClass.__ui5.derived.push(oClass);
		if ( oClass.implements ) {
			for (let j = 0; j < oClass.implements.length; j++) {
				let oInterface = lookup(oClass.implements[j]);
				if ( !oInterface ) {
					let sVisibility = "public";
					if ( externalSymbols[oClass.implements[j]] ) {
						sVisibility = externalSymbols[oClass.implements[j]] || sVisibility;
						debug(`create doclet for external interface ${oClass.implements[j]}`);
					}  else {
						warning(`create missing interface ${oClass.implements[j]}`);
					}
					oInterface = makeDoclet(oClass.implements[j], [
						"@interface",
						"@synthetic",
						sVisibility === "restricted" ? "@ui5-restricted" : "@" + sVisibility
					]);
					oInterface.__ui5.base = oObject;
					oObject.__ui5.derived = oObject.__ui5.derived || [];
					oObject.__ui5.derived.push(oInterface);
				}
				oInterface.__ui5.implementations = oInterface.__ui5.implementations || [];
				oInterface.__ui5.implementations.push(oClass);
			}
		}
	});
	function setStereotype(oSymbol, sStereotype) {
		if ( !oSymbol ) {
			return;
		}
		oSymbol.__ui5.stereotype = sStereotype;
		const derived = oSymbol.__ui5.derived;
		if ( derived ) {
			for (let i = 0; i < derived.length; i++ ) {
				if ( !derived[i].__ui5.stereotype ) {
					setStereotype(derived[i], sStereotype);
				}
			}
		}
	}
	setStereotype(lookup("sap.ui.core.Component"), "component");
	setStereotype(lookup("sap.ui.core.Control"), "control");
	setStereotype(lookup("sap.ui.core.Element"), "element");
	setStereotype(lookup("sap.ui.base.Object"), "object");
	oTypes.each((oStartClass) => {
		const visited = {};
		function visit(oClass) {
			if ( visited[oClass.longname] ) {
				throw new Error(`cyclic inheritance detected: ${JSON.stringify(Object.keys(visited))}`);
			}
			if ( oClass.__ui5.base ) {
				visited[oClass.longname] = true;
				visit(oClass.__ui5.base);
				delete visited[oClass.longname];
			}
		}
		visit(oStartClass);
	});
	return aRootTypes;
}
function createInheritanceTree ( ) { function makeDoclet ( longname , lines ) { lines . push ( "@name " + longname ) ; const newDoclet = new doclet . Doclet ( "/**\n * " + lines . join ( "\n * " ) + "\n */" , { } ) ; newDoclet . __ui5 = { } ; __longnames [ longname ] = newDoclet ; __db . insert ( newDoclet ) ; return newDoclet ; } info ( ` ${ __db ( ) . count ( ) } ` ) ; const oTypes = __db ( function ( ) { return supportsInheritance ( this ) ; } ) ; const aRootTypes = [ ] ; let oObject = lookup ( "Object" ) ; if ( ! oObject ) { oObject = makeDoclet ( "Object" , [ "@class" , "@synthetic" , "@public" ] ) ; aRootTypes . push ( oObject ) ; } function getOrCreateClass ( sClass , sExtendingClass ) { let oClass = lookup ( sClass ) ; if ( ! oClass ) { let sKind = "class" , sBaseClass = 'Object' , sVisibility = "public" ; if ( externalSymbols [ sClass ] ) { sKind = externalSymbols [ sClass ] . kind || sKind ; sBaseClass = externalSymbols [ sClass ] . extends || sBaseClass ; sVisibility = externalSymbols [ sClass ] . visibility || sVisibility ; debug ( ` ${ sClass } ${ sExtendingClass } ` ) ; } else { warning ( ` ${ sClass } ${ sExtendingClass } ` ) ; } let oBaseClass = getOrCreateClass ( sBaseClass , sClass ) ; oClass = makeDoclet ( sClass , [ "@extends " + sBaseClass , "@" + sKind , "@synthetic" , sVisibility === "restricted" ? "@ui5-restricted" : "@" + sVisibility ] ) ; oClass . __ui5 . base = oBaseClass ; oBaseClass . __ui5 . derived = oBaseClass . __ui5 . derived || [ ] ; oBaseClass . __ui5 . derived . push ( oClass ) ; } return oClass ; } oTypes . each ( ( oClass ) => { if ( oClass . longname === 'Object' ) { return ; } let sBaseClass = "Object" ; if ( oClass . augments && oClass . augments . length > 0 ) { if ( oClass . augments . length > 1 ) { warning ( ` ${ oClass . longname } ` ) ; } sBaseClass = oClass . augments [ 0 ] ; } else { aRootTypes . push ( oClass ) ; } let oBaseClass = getOrCreateClass ( sBaseClass , oClass . longname ) ; oClass . __ui5 . base = oBaseClass ; oBaseClass . __ui5 . derived = oBaseClass . __ui5 . derived || [ ] ; oBaseClass . __ui5 . derived . push ( oClass ) ; if ( oClass . implements ) { for ( let j = 0 ; j < oClass . implements . length ; j ++ ) { let oInterface = lookup ( oClass . implements [ j ] ) ; if ( ! oInterface ) { let sVisibility = "public" ; if ( externalSymbols [ oClass . implements [ j ] ] ) { sVisibility = externalSymbols [ oClass . implements [ j ] ] || sVisibility ; debug ( ` ${ oClass . implements [ j ] } ` ) ; } else { warning ( ` ${ oClass . implements [ j ] } ` ) ; } oInterface = makeDoclet ( oClass . implements [ j ] , [ "@interface" , "@synthetic" , sVisibility === "restricted" ? "@ui5-restricted" : "@" + sVisibility ] ) ; oInterface . __ui5 . base = oObject ; oObject . __ui5 . derived = oObject . __ui5 . derived || [ ] ; oObject . __ui5 . derived . push ( oInterface ) ; } oInterface . __ui5 . implementations = oInterface . __ui5 . implementations || [ ] ; oInterface . __ui5 . implementations . push ( oClass ) ; } } } ) ; function setStereotype ( oSymbol , sStereotype ) { if ( ! oSymbol ) { return ; } oSymbol . __ui5 . stereotype = sStereotype ; const derived = oSymbol . __ui5 . derived ; if ( derived ) { for ( let i = 0 ; i < derived . length ; i ++ ) { if ( ! derived [ i ] . __ui5 . stereotype ) { setStereotype ( derived [ i ] , sStereotype ) ; } } } } setStereotype ( lookup ( "sap.ui.core.Component" ) , "component" ) ; setStereotype ( lookup ( "sap.ui.core.Control" ) , "control" ) ; setStereotype ( lookup ( "sap.ui.core.Element" ) , "element" ) ; setStereotype ( lookup ( "sap.ui.base.Object" ) , "object" ) ; oTypes . each ( ( oStartClass ) => { const visited = { } ; function visit ( oClass ) { if ( visited [ oClass . longname ] ) { throw new Error ( ` ${ JSON . stringify ( Object . keys ( visited ) ) } ` ) ; } if ( oClass . __ui5 . base ) { visited [ oClass . longname ] = true ; visit ( oClass . __ui5 . base ) ; delete visited [ oClass . longname ] ; } } visit ( oStartClass ) ; } ) ; return aRootTypes ; }
Calculates the inheritance hierarchy for all class/interface/namespace symbols.
Calculates the inheritance hierarchy for all class / interface / namespace symbols .
// link them according to the inheritance infos // check for cyclic inheritance (not supported) // Note: the check needs to run bottom up, not top down as a typical cyclic dependency never will end at the root node // collect root nodes (and ignore pure packages)