Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix for bug 37002: Order of Offsetables is wrong

Title: Applied [ 1_1 & HEAD ] Outline view ordering incorrect

 The CModelBuilder assigns template classes and template functions the correct offsets.

Thanks,

Hoda

Index: parser/org/eclipse/cdt/internal/core/model/CModelBuilder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/model/CModelBuilder.java,v
retrieving revision 1.21
diff -u -r1.21 CModelBuilder.java
--- parser/org/eclipse/cdt/internal/core/model/CModelBuilder.java	27 Apr 2003 20:56:07 -0000	1.21
+++ parser/org/eclipse/cdt/internal/core/model/CModelBuilder.java	28 Apr 2003 16:59:05 -0000
@@ -175,6 +175,12 @@
 			if (typeSpec instanceof ClassSpecifier){
 				ClassSpecifier classSpecifier = (ClassSpecifier) typeSpec;
 				ITemplate classTemplate = (ClassTemplate)createClass(parent, simpleDeclaration, classSpecifier, true);
+				CElement element = (CElement) classTemplate;
+				// set the element position		
+				element.setPos(templateDeclaration.getStartingOffset(), templateDeclaration.getTotalLength());	
+				// set the element lines
+				element.setLines(templateDeclaration.getTopLine(), templateDeclaration.getBottomLine());
+				// set the template parameters				
 				String[] parameterTypes = getTemplateParameters(templateDeclaration);
 				classTemplate.setTemplateParameterTypes(parameterTypes);				
 
@@ -224,6 +230,12 @@
 		if (pdc != null){
 			// template of function or method
 			ITemplate template = (ITemplate) createFunctionSpecification(parent, simpleDeclaration, declarator, pdc, true);
+			CElement element = (CElement)template;
+			// set the element position		
+			element.setPos(templateDeclaration.getStartingOffset(), templateDeclaration.getTotalLength());	
+			// set the element lines
+			element.setLines(templateDeclaration.getTopLine(), templateDeclaration.getBottomLine());
+			// set the template parameters
 			String[] parameterTypes = getTemplateParameters(templateDeclaration);	
 			template.setTemplateParameterTypes(parameterTypes);				
 		}
@@ -362,9 +374,12 @@
 			
 		}
 		element.setTypeName( type );
-		element.setPos(classSpecifier.getStartingOffset(), classSpecifier.getTotalLength());
-		// set the element lines
-		element.setLines(classSpecifier.getTopLine(), classSpecifier.getBottomLine());
+		if(!isTemplate){
+			// set the element position
+			element.setPos(classSpecifier.getStartingOffset(), classSpecifier.getTotalLength());
+			// set the element lines
+			element.setLines(classSpecifier.getTopLine(), classSpecifier.getBottomLine());
+		}
 		
 		this.newElements.put(element, element.getElementInfo());
 		return element;
@@ -525,10 +540,13 @@
 		parent.addChild( element ); 	
 
 		// hook up the offsets
-		element.setIdPos( domName.getStartOffset(), domName.length() );		
-		element.setPos(simpleDeclaration.getStartingOffset(), simpleDeclaration.getTotalLength());	
-		// set the element lines
-		element.setLines(simpleDeclaration.getTopLine(), simpleDeclaration.getBottomLine());
+		element.setIdPos( domName.getStartOffset(), domName.length() );
+		if(!isTemplate){
+			// set the element position		
+			element.setPos(simpleDeclaration.getStartingOffset(), simpleDeclaration.getTotalLength());	
+			// set the element lines
+			element.setLines(simpleDeclaration.getTopLine(), simpleDeclaration.getBottomLine());
+		}
 
 		this.newElements.put(element, element.getElementInfo());
 		return element;

Back to the top