1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

Enhance PDOMPrettyPrinter to print template specializations.

This commit is contained in:
Markus Schorn 2008-05-29 08:43:21 +00:00
parent 732a995791
commit a5e61e2f26
2 changed files with 7 additions and 3 deletions

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPClassTemplate;
import org.eclipse.core.runtime.CoreException;
/**
@ -38,6 +39,9 @@ public class PDOMPrettyPrinter implements IPDOMVisitor {
final String step = " "; //$NON-NLS-1$
public void leave(IPDOMNode node) throws CoreException {
if (node instanceof PDOMCPPClassTemplate) {
((PDOMCPPClassTemplate) node).specializationsAccept(this);
}
if(indent.length()>=step.length())
indent.setLength(indent.length()-step.length());
}
@ -76,8 +80,8 @@ public class PDOMPrettyPrinter implements IPDOMVisitor {
public static void dumpLinkage(IIndex index, final String linkageID) {
final IPDOMVisitor v= new PDOMPrettyPrinter();
IIndexFragment[] frg= ((CIndex)index).getPrimaryFragments();
for(int i=0; i<frg.length; i++) {
final PDOM pdom = (PDOM) frg[i];
for (IIndexFragment element : frg) {
final PDOM pdom = (PDOM) element;
try {
pdom.getLinkage(linkageID).getIndex().accept(
new IBTreeVisitor() {

View file

@ -54,7 +54,7 @@ import org.eclipse.core.runtime.CoreException;
/**
* @author Bryan Wilkinson
*/
class PDOMCPPClassTemplate extends PDOMCPPClassType
public class PDOMCPPClassTemplate extends PDOMCPPClassType
implements ICPPClassTemplate, ICPPInternalTemplateInstantiator, ICPPTemplateScope {
private static final int PARAMETERS = PDOMCPPClassType.RECORD_SIZE + 0;