mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Code streamlining.
This commit is contained in:
parent
6f359aba30
commit
ed8a6ea120
2 changed files with 24 additions and 27 deletions
|
@ -630,7 +630,7 @@ public class TemplateArgumentDeduction {
|
|||
|
||||
private static ICPPClassType findBaseInstance(ICPPClassType a, ICPPClassTemplate pTemplate, int maxdepth, HashSet<Object> handled, IASTNode point) throws DOMException {
|
||||
if (a instanceof ICPPTemplateInstance) {
|
||||
final ICPPTemplateInstance inst = (ICPPTemplateInstance) a;
|
||||
ICPPTemplateInstance inst = (ICPPTemplateInstance) a;
|
||||
ICPPClassTemplate tmpl= getPrimaryTemplate(inst);
|
||||
if (pTemplate.isSameType(tmpl))
|
||||
return a;
|
||||
|
|
|
@ -505,7 +505,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
getPDOM().putCachedResult(inputBinding, pdomBinding);
|
||||
}
|
||||
|
||||
if (shouldUpdate(pdomBinding, fromName)) {
|
||||
if (fromName != null && shouldUpdate(pdomBinding, fromName)) {
|
||||
IBinding fromBinding = fromName.getBinding();
|
||||
|
||||
pdomBinding.update(this, fromBinding, null);
|
||||
|
@ -520,32 +520,29 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
}
|
||||
|
||||
private boolean shouldUpdate(PDOMBinding pdomBinding, IASTName fromName) throws CoreException {
|
||||
if (fromName != null) {
|
||||
if (pdomBinding instanceof IParameter || pdomBinding instanceof ICPPTemplateParameter)
|
||||
return false;
|
||||
if (fromName.isReference()) {
|
||||
return false;
|
||||
}
|
||||
if (pdomBinding instanceof ICPPMember) {
|
||||
IASTNode node= fromName.getParent();
|
||||
while (node != null) {
|
||||
if (node instanceof IASTCompositeTypeSpecifier) {
|
||||
return true;
|
||||
}
|
||||
node= node.getParent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (fromName.isDefinition()) {
|
||||
return true;
|
||||
}
|
||||
// Update opaque enums.
|
||||
if (pdomBinding instanceof ICPPEnumeration && fromName.isDeclaration()) {
|
||||
return true;
|
||||
}
|
||||
return !getPDOM().hasLastingDefinition(pdomBinding);
|
||||
if (pdomBinding instanceof IParameter || pdomBinding instanceof ICPPTemplateParameter)
|
||||
return false;
|
||||
if (fromName.isReference()) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
if (pdomBinding instanceof ICPPMember) {
|
||||
IASTNode node= fromName.getParent();
|
||||
while (node != null) {
|
||||
if (node instanceof IASTCompositeTypeSpecifier) {
|
||||
return true;
|
||||
}
|
||||
node= node.getParent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (fromName.isDefinition()) {
|
||||
return true;
|
||||
}
|
||||
// Update opaque enums.
|
||||
if (pdomBinding instanceof ICPPEnumeration && fromName.isDeclaration()) {
|
||||
return true;
|
||||
}
|
||||
return !getPDOM().hasLastingDefinition(pdomBinding);
|
||||
}
|
||||
|
||||
PDOMBinding createBinding(PDOMNode parent, IBinding binding, long fileLocalRec, IASTNode point)
|
||||
|
|
Loading…
Add table
Reference in a new issue