Mangled names

Sjoerd van Leent svanleent at gmail.com
Thu May 25 04:34:56 PDT 2006


Walter, others,

Would it be possible to store the mangled name of a class/type in to the 
classinfo/typeinfo. This would ease a lot of problems I'm experiencing. 
Since I want to traverse through the classinfo class as follows:

public bool derivesFromIBase(in Interface iface) {
     ClassInfo info = iface.classinfo;
    	if(info == IBase.classinfo) {
		return true;
	} else if(info.interfaces.length > 0) {
		foreach(Interface base; info.interfaces) {
			if(derivesFromIBase(base)) return true;
		}
	}
     return false;
}

public char[] resolve(in ClassInfo clazz) {
	foreach(Interface iface; clazz.interfaces) {
		// should return the mangled name
		if(derivesFromIBase(iface)) return iface.classinfo.name;
	}
	if(clazz.base != Object.classinfo) {
		return resolve(clazz.base);
	}
	return null;
}

Regards,
Sjoerd



More information about the Digitalmars-d mailing list