mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Cosmetics.
This commit is contained in:
parent
a21efaf92e
commit
6e96e21cf0
1 changed files with 17 additions and 17 deletions
|
@ -72,8 +72,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds in default constructor, copy constructor, copy assignment operator and destructor,
|
* Adds in default constructor, copy constructor, copy assignment operator and destructor,
|
||||||
* if appropriate.
|
* if appropriate. The method will be called after ambiguity resolution.
|
||||||
* Method will be called after ambiguity resolution.
|
|
||||||
*/
|
*/
|
||||||
public void createImplicitMembers() {
|
public void createImplicitMembers() {
|
||||||
// Create bindings for the implicit members, if the user declared them then those
|
// Create bindings for the implicit members, if the user declared them then those
|
||||||
|
@ -85,17 +84,17 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
if (!(binding instanceof ICPPClassType))
|
if (!(binding instanceof ICPPClassType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ICPPClassType clsType = (ICPPClassType) binding;
|
ICPPClassType classType = (ICPPClassType) binding;
|
||||||
if (clsType instanceof ICPPClassTemplate) {
|
if (classType instanceof ICPPClassTemplate) {
|
||||||
clsType= (ICPPClassType) ((ICPPClassTemplate) clsType).asDeferredInstance();
|
classType= (ICPPClassType) ((ICPPClassTemplate) classType).asDeferredInstance();
|
||||||
}
|
}
|
||||||
char[] className = name.getLookupKey();
|
char[] className = name.getLookupKey();
|
||||||
|
|
||||||
IType pType = new CPPReferenceType(SemanticUtil.constQualify(clsType), false);
|
IType pType = new CPPReferenceType(SemanticUtil.constQualify(classType), false);
|
||||||
ICPPParameter[] ps = new ICPPParameter[] { new CPPParameter(pType, 0) };
|
ICPPParameter[] params = new ICPPParameter[] { new CPPParameter(pType, 0) };
|
||||||
|
|
||||||
int i= 0;
|
int i= 0;
|
||||||
ImplicitsAnalysis ia= new ImplicitsAnalysis(compTypeSpec, clsType);
|
ImplicitsAnalysis ia= new ImplicitsAnalysis(compTypeSpec, classType);
|
||||||
implicits= new ICPPMethod[ia.getImplicitsToDeclareCount()];
|
implicits= new ICPPMethod[ia.getImplicitsToDeclareCount()];
|
||||||
|
|
||||||
if (!ia.hasUserDeclaredConstructor()) {
|
if (!ia.hasUserDeclaredConstructor()) {
|
||||||
|
@ -107,16 +106,16 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
|
|
||||||
if (!ia.hasUserDeclaredCopyConstructor()) {
|
if (!ia.hasUserDeclaredCopyConstructor()) {
|
||||||
// Copy constructor: A(const A &)
|
// Copy constructor: A(const A &)
|
||||||
ICPPMethod m = new CPPImplicitConstructor(this, className, ps);
|
ICPPMethod m = new CPPImplicitConstructor(this, className, params);
|
||||||
implicits[i++] = m;
|
implicits[i++] = m;
|
||||||
addBinding(m);
|
addBinding(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ia.hasUserDeclaredCopyAssignmentOperator()) {
|
if (!ia.hasUserDeclaredCopyAssignmentOperator()) {
|
||||||
// Copy assignment operator: A& operator = (const A &)
|
// Copy assignment operator: A& operator = (const A &)
|
||||||
IType refType = new CPPReferenceType(clsType, false);
|
IType refType = new CPPReferenceType(classType, false);
|
||||||
ICPPFunctionType ft= CPPVisitor.createImplicitFunctionType(refType, ps, false, false);
|
ICPPFunctionType ft= CPPVisitor.createImplicitFunctionType(refType, params, false, false);
|
||||||
ICPPMethod m = new CPPImplicitMethod(this, OverloadableOperator.ASSIGN.toCharArray(), ft, ps);
|
ICPPMethod m = new CPPImplicitMethod(this, OverloadableOperator.ASSIGN.toCharArray(), ft, params);
|
||||||
implicits[i++] = m;
|
implicits[i++] = m;
|
||||||
addBinding(m);
|
addBinding(m);
|
||||||
}
|
}
|
||||||
|
@ -197,7 +196,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
Object o = bindings.get(CONSTRUCTOR_KEY);
|
Object o = bindings.get(CONSTRUCTOR_KEY);
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
if (o instanceof ObjectSet) {
|
if (o instanceof ObjectSet) {
|
||||||
((ObjectSet)o).put(constructor);
|
((ObjectSet) o).put(constructor);
|
||||||
} else {
|
} else {
|
||||||
ObjectSet set = new ObjectSet(2);
|
ObjectSet set = new ObjectSet(2);
|
||||||
set.put(o);
|
set.put(o);
|
||||||
|
@ -219,7 +218,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
compName= ((ICPPASTTemplateId) compName).getTemplateName();
|
compName= ((ICPPASTTemplateId) compName).getTemplateName();
|
||||||
}
|
}
|
||||||
if (CharArrayUtils.equals(c, compName.getLookupKey())) {
|
if (CharArrayUtils.equals(c, compName.getLookupKey())) {
|
||||||
//9.2 ... The class-name is also inserted into the scope of the class itself
|
// 9.2 ... The class-name is also inserted into the scope of the class itself.
|
||||||
return compName.resolveBinding();
|
return compName.resolveBinding();
|
||||||
}
|
}
|
||||||
return super.getBinding(name, resolve, fileSet);
|
return super.getBinding(name, resolve, fileSet);
|
||||||
|
@ -242,7 +241,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
if (shallReturnConstructors(lookupName, prefixLookup)) {
|
if (shallReturnConstructors(lookupName, prefixLookup)) {
|
||||||
result = ArrayUtil.addAll(IBinding.class, result, getConstructors(lookupName, lookup.isResolve()));
|
result = ArrayUtil.addAll(IBinding.class, result, getConstructors(lookupName, lookup.isResolve()));
|
||||||
}
|
}
|
||||||
//9.2 ... The class-name is also inserted into the scope of the class itself
|
// 9.2 ... The class-name is also inserted into the scope of the class itself.
|
||||||
result = ArrayUtil.append(IBinding.class, result, compName.resolveBinding());
|
result = ArrayUtil.append(IBinding.class, result, compName.resolveBinding());
|
||||||
}
|
}
|
||||||
result = ArrayUtil.addAll(IBinding.class, result, super.getBindings(lookup));
|
result = ArrayUtil.addAll(IBinding.class, result, super.getBindings(lookup));
|
||||||
|
@ -333,10 +332,11 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
if (node instanceof ICPPASTTemplateId)
|
if (node instanceof ICPPASTTemplateId)
|
||||||
return false;
|
return false;
|
||||||
if (node instanceof ICPPASTQualifiedName) {
|
if (node instanceof ICPPASTQualifiedName) {
|
||||||
if (((ICPPASTQualifiedName) node).getLastName() == name)
|
if (((ICPPASTQualifiedName) node).getLastName() == name) {
|
||||||
node = node.getParent();
|
node = node.getParent();
|
||||||
else
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (node instanceof IASTDeclSpecifier) {
|
if (node instanceof IASTDeclSpecifier) {
|
||||||
IASTNode parent = node.getParent();
|
IASTNode parent = node.getParent();
|
||||||
|
|
Loading…
Add table
Reference in a new issue