mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Hoda Amer
The CModelBuilder assigns template classes and template functions the correct offsets.
This commit is contained in:
parent
771d05100d
commit
b918254917
1 changed files with 25 additions and 7 deletions
|
@ -175,6 +175,12 @@ public class CModelBuilder {
|
||||||
if (typeSpec instanceof ClassSpecifier){
|
if (typeSpec instanceof ClassSpecifier){
|
||||||
ClassSpecifier classSpecifier = (ClassSpecifier) typeSpec;
|
ClassSpecifier classSpecifier = (ClassSpecifier) typeSpec;
|
||||||
ITemplate classTemplate = (ClassTemplate)createClass(parent, simpleDeclaration, classSpecifier, true);
|
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);
|
String[] parameterTypes = getTemplateParameters(templateDeclaration);
|
||||||
classTemplate.setTemplateParameterTypes(parameterTypes);
|
classTemplate.setTemplateParameterTypes(parameterTypes);
|
||||||
|
|
||||||
|
@ -224,6 +230,12 @@ public class CModelBuilder {
|
||||||
if (pdc != null){
|
if (pdc != null){
|
||||||
// template of function or method
|
// template of function or method
|
||||||
ITemplate template = (ITemplate) createFunctionSpecification(parent, simpleDeclaration, declarator, pdc, true);
|
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);
|
String[] parameterTypes = getTemplateParameters(templateDeclaration);
|
||||||
template.setTemplateParameterTypes(parameterTypes);
|
template.setTemplateParameterTypes(parameterTypes);
|
||||||
}
|
}
|
||||||
|
@ -362,9 +374,12 @@ public class CModelBuilder {
|
||||||
|
|
||||||
}
|
}
|
||||||
element.setTypeName( type );
|
element.setTypeName( type );
|
||||||
|
if(!isTemplate){
|
||||||
|
// set the element position
|
||||||
element.setPos(classSpecifier.getStartingOffset(), classSpecifier.getTotalLength());
|
element.setPos(classSpecifier.getStartingOffset(), classSpecifier.getTotalLength());
|
||||||
// set the element lines
|
// set the element lines
|
||||||
element.setLines(classSpecifier.getTopLine(), classSpecifier.getBottomLine());
|
element.setLines(classSpecifier.getTopLine(), classSpecifier.getBottomLine());
|
||||||
|
}
|
||||||
|
|
||||||
this.newElements.put(element, element.getElementInfo());
|
this.newElements.put(element, element.getElementInfo());
|
||||||
return element;
|
return element;
|
||||||
|
@ -526,9 +541,12 @@ public class CModelBuilder {
|
||||||
|
|
||||||
// hook up the offsets
|
// hook up the offsets
|
||||||
element.setIdPos( domName.getStartOffset(), domName.length() );
|
element.setIdPos( domName.getStartOffset(), domName.length() );
|
||||||
|
if(!isTemplate){
|
||||||
|
// set the element position
|
||||||
element.setPos(simpleDeclaration.getStartingOffset(), simpleDeclaration.getTotalLength());
|
element.setPos(simpleDeclaration.getStartingOffset(), simpleDeclaration.getTotalLength());
|
||||||
// set the element lines
|
// set the element lines
|
||||||
element.setLines(simpleDeclaration.getTopLine(), simpleDeclaration.getBottomLine());
|
element.setLines(simpleDeclaration.getTopLine(), simpleDeclaration.getBottomLine());
|
||||||
|
}
|
||||||
|
|
||||||
this.newElements.put(element, element.getElementInfo());
|
this.newElements.put(element, element.getElementInfo());
|
||||||
return element;
|
return element;
|
||||||
|
|
Loading…
Add table
Reference in a new issue