mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
45e67ddcf2
commit
12cca1e9b2
1 changed files with 23 additions and 22 deletions
|
@ -224,7 +224,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPack) {
|
if (isPack) {
|
||||||
int packOffset= numParams-1;
|
int packOffset= numParams - 1;
|
||||||
int packSize= numArgs - packOffset;
|
int packSize= numArgs - packOffset;
|
||||||
ICPPTemplateArgument[] pack= new ICPPTemplateArgument[packSize];
|
ICPPTemplateArgument[] pack= new ICPPTemplateArgument[packSize];
|
||||||
System.arraycopy(arguments, packOffset, pack, 0, packSize);
|
System.arraycopy(arguments, packOffset, pack, 0, packSize);
|
||||||
|
@ -401,7 +401,7 @@ public class CPPTemplates {
|
||||||
for (int i = 0; i < arguments.length; i++) {
|
for (int i = 0; i < arguments.length; i++) {
|
||||||
ICPPTemplateArgument arg = arguments[i];
|
ICPPTemplateArgument arg = arguments[i];
|
||||||
if (arg.isPackExpansion()) {
|
if (arg.isPackExpansion()) {
|
||||||
if (i != arguments.length-1) {
|
if (i != arguments.length - 1) {
|
||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
havePackExpansion= true;
|
havePackExpansion= true;
|
||||||
|
@ -420,10 +420,10 @@ public class CPPTemplates {
|
||||||
|
|
||||||
// More arguments allowed if we have a parameter pack.
|
// More arguments allowed if we have a parameter pack.
|
||||||
if (tparCount < argCount) {
|
if (tparCount < argCount) {
|
||||||
if (tpars[tparCount-1].isParameterPack())
|
if (tpars[tparCount - 1].isParameterPack())
|
||||||
return arguments;
|
return arguments;
|
||||||
|
|
||||||
if (havePackExpansion && tparCount+1 == argCount)
|
if (havePackExpansion && tparCount + 1 == argCount)
|
||||||
return arguments;
|
return arguments;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -433,7 +433,7 @@ public class CPPTemplates {
|
||||||
return arguments;
|
return arguments;
|
||||||
|
|
||||||
// Fewer arguments are allowed with default arguments
|
// Fewer arguments are allowed with default arguments
|
||||||
if (tpars[tparCount-1].isParameterPack())
|
if (tpars[tparCount - 1].isParameterPack())
|
||||||
tparCount--;
|
tparCount--;
|
||||||
|
|
||||||
if (tparCount == argCount)
|
if (tparCount == argCount)
|
||||||
|
@ -1024,7 +1024,7 @@ public class CPPTemplates {
|
||||||
} else if (packSize == PACK_SIZE_DEFER) {
|
} else if (packSize == PACK_SIZE_DEFER) {
|
||||||
newType= origType;
|
newType= origType;
|
||||||
} else {
|
} else {
|
||||||
IType[] newResult= new IType[result.length+packSize-1];
|
IType[] newResult= new IType[result.length + packSize - 1];
|
||||||
System.arraycopy(result, 0, newResult, 0, j);
|
System.arraycopy(result, 0, newResult, 0, j);
|
||||||
result= newResult;
|
result= newResult;
|
||||||
for (int k= 0; k < packSize; k++) {
|
for (int k= 0; k < packSize; k++) {
|
||||||
|
@ -1167,7 +1167,7 @@ public class CPPTemplates {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
// The parameter types need to be adjusted.
|
// The parameter types need to be adjusted.
|
||||||
for (int i=0; i<params.length; i++) {
|
for (int i= 0; i < params.length; i++) {
|
||||||
IType p= params[i];
|
IType p= params[i];
|
||||||
if (!isDependentType(p)) {
|
if (!isDependentType(p)) {
|
||||||
params[i]= CPPVisitor.adjustParameterType(p, true);
|
params[i]= CPPVisitor.adjustParameterType(p, true);
|
||||||
|
@ -1395,7 +1395,7 @@ public class CPPTemplates {
|
||||||
int depIDCount= 0;
|
int depIDCount= 0;
|
||||||
IASTName owner= null;
|
IASTName owner= null;
|
||||||
final IASTName[] ns= qname.getNames();
|
final IASTName[] ns= qname.getNames();
|
||||||
for (int i = 0; i < ns.length-1; i++) {
|
for (int i = 0; i < ns.length - 1; i++) {
|
||||||
IASTName n= ns[i];
|
IASTName n= ns[i];
|
||||||
if (n instanceof ICPPASTTemplateId) {
|
if (n instanceof ICPPASTTemplateId) {
|
||||||
if (depIDCount > 0 || usesTemplateParameter((ICPPASTTemplateId) n, tparnames)) {
|
if (depIDCount > 0 || usesTemplateParameter((ICPPASTTemplateId) n, tparnames)) {
|
||||||
|
@ -1438,17 +1438,17 @@ public class CPPTemplates {
|
||||||
b= b.getOwner();
|
b= b.getOwner();
|
||||||
}
|
}
|
||||||
if (depIDCount > 0) {
|
if (depIDCount > 0) {
|
||||||
nestingLevel+= depIDCount;
|
nestingLevel += depIDCount;
|
||||||
} else if (consumesTDecl < tdeclCount && !lastIsTemplate) {
|
} else if (consumesTDecl < tdeclCount && !lastIsTemplate) {
|
||||||
nestingLevel++;
|
nestingLevel++;
|
||||||
lastIsTemplate= true;
|
lastIsTemplate= true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nestingLevel+= depIDCount;
|
nestingLevel += depIDCount;
|
||||||
node= outerMostTDecl.getParent();
|
node= outerMostTDecl.getParent();
|
||||||
while (node != null) {
|
while (node != null) {
|
||||||
if (node instanceof ICPPASTInternalTemplateDeclaration) {
|
if (node instanceof ICPPASTInternalTemplateDeclaration) {
|
||||||
nestingLevel+= ((ICPPASTInternalTemplateDeclaration) node).getNestingLevel() + 1;
|
nestingLevel += ((ICPPASTInternalTemplateDeclaration) node).getNestingLevel() + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
node= node.getParent();
|
node= node.getParent();
|
||||||
|
@ -1461,7 +1461,7 @@ public class CPPTemplates {
|
||||||
node= outerMostTDecl.getParent();
|
node= outerMostTDecl.getParent();
|
||||||
while (node != null) {
|
while (node != null) {
|
||||||
if (node instanceof ICPPASTInternalTemplateDeclaration) {
|
if (node instanceof ICPPASTInternalTemplateDeclaration) {
|
||||||
nestingLevel+= ((ICPPASTInternalTemplateDeclaration) node).getNestingLevel() + 1;
|
nestingLevel += ((ICPPASTInternalTemplateDeclaration) node).getNestingLevel() + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
node= node.getParent();
|
node= node.getParent();
|
||||||
|
@ -1470,7 +1470,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
node= innerMostTDecl;
|
node= innerMostTDecl;
|
||||||
while(node instanceof ICPPASTInternalTemplateDeclaration) {
|
while (node instanceof ICPPASTInternalTemplateDeclaration) {
|
||||||
if (--nestingLevel < 0)
|
if (--nestingLevel < 0)
|
||||||
nestingLevel= 0;
|
nestingLevel= 0;
|
||||||
tdecl= (ICPPASTInternalTemplateDeclaration) node;
|
tdecl= (ICPPASTInternalTemplateDeclaration) node;
|
||||||
|
@ -1500,7 +1500,7 @@ public class CPPTemplates {
|
||||||
|
|
||||||
private static CharArraySet collectTemplateParameterNames(ICPPASTTemplateDeclaration tdecl) {
|
private static CharArraySet collectTemplateParameterNames(ICPPASTTemplateDeclaration tdecl) {
|
||||||
CharArraySet set= new CharArraySet(4);
|
CharArraySet set= new CharArraySet(4);
|
||||||
while(true) {
|
while (true) {
|
||||||
ICPPASTTemplateParameter[] pars = tdecl.getTemplateParameters();
|
ICPPASTTemplateParameter[] pars = tdecl.getTemplateParameters();
|
||||||
for (ICPPASTTemplateParameter par : pars) {
|
for (ICPPASTTemplateParameter par : pars) {
|
||||||
IASTName name= CPPTemplates.getTemplateParameterName(par);
|
IASTName name= CPPTemplates.getTemplateParameterName(par);
|
||||||
|
@ -1520,7 +1520,7 @@ public class CPPTemplates {
|
||||||
private static boolean usesTemplateParameter(final ICPPASTTemplateId id, final CharArraySet names) {
|
private static boolean usesTemplateParameter(final ICPPASTTemplateId id, final CharArraySet names) {
|
||||||
final boolean[] result= {false};
|
final boolean[] result= {false};
|
||||||
ASTVisitor v= new ASTVisitor(false) {
|
ASTVisitor v= new ASTVisitor(false) {
|
||||||
{ shouldVisitNames= true; shouldVisitAmbiguousNodes=true;}
|
{ shouldVisitNames= true; shouldVisitAmbiguousNodes= true; }
|
||||||
@Override
|
@Override
|
||||||
public int visit(IASTName name) {
|
public int visit(IASTName name) {
|
||||||
if (name instanceof ICPPASTTemplateId)
|
if (name instanceof ICPPASTTemplateId)
|
||||||
|
@ -1612,7 +1612,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICPPASTInternalTemplateDeclaration getDirectlyEnclosingTemplateDeclaration(
|
private static ICPPASTInternalTemplateDeclaration getDirectlyEnclosingTemplateDeclaration(
|
||||||
ICPPASTInternalTemplateDeclaration tdecl ) {
|
ICPPASTInternalTemplateDeclaration tdecl) {
|
||||||
final IASTNode parent= tdecl.getParent();
|
final IASTNode parent= tdecl.getParent();
|
||||||
if (parent instanceof ICPPASTInternalTemplateDeclaration)
|
if (parent instanceof ICPPASTInternalTemplateDeclaration)
|
||||||
return (ICPPASTInternalTemplateDeclaration) parent;
|
return (ICPPASTInternalTemplateDeclaration) parent;
|
||||||
|
@ -1680,7 +1680,7 @@ public class CPPTemplates {
|
||||||
if (args.length != specArgs.length) {
|
if (args.length != specArgs.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i=0; i < args.length; i++) {
|
for (int i= 0; i < args.length; i++) {
|
||||||
if (!specArgs[i].isSameValue(args[i]))
|
if (!specArgs[i].isSameValue(args[i]))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1792,7 +1792,7 @@ public class CPPTemplates {
|
||||||
static ICPPFunction[] instantiateConversionTemplates(ICPPFunction[] functions, IType conversionType, IASTNode point) {
|
static ICPPFunction[] instantiateConversionTemplates(ICPPFunction[] functions, IType conversionType, IASTNode point) {
|
||||||
boolean checkedForDependentType= false;
|
boolean checkedForDependentType= false;
|
||||||
ICPPFunction[] result= functions;
|
ICPPFunction[] result= functions;
|
||||||
int i=0;
|
int i= 0;
|
||||||
boolean done= false;
|
boolean done= false;
|
||||||
for (ICPPFunction f : functions) {
|
for (ICPPFunction f : functions) {
|
||||||
ICPPFunction inst = f;
|
ICPPFunction inst = f;
|
||||||
|
@ -1993,7 +1993,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IType[] concat(final IType t, IType[] types) {
|
private static IType[] concat(final IType t, IType[] types) {
|
||||||
IType[] result= new IType[types.length+1];
|
IType[] result= new IType[types.length + 1];
|
||||||
result[0]= t;
|
result[0]= t;
|
||||||
System.arraycopy(types, 0, result, 1, types.length);
|
System.arraycopy(types, 0, result, 1, types.length);
|
||||||
return result;
|
return result;
|
||||||
|
@ -2216,8 +2216,8 @@ public class CPPTemplates {
|
||||||
|
|
||||||
private static boolean matchTemplateTemplateParameters(ICPPTemplateParameter[] pParams,
|
private static boolean matchTemplateTemplateParameters(ICPPTemplateParameter[] pParams,
|
||||||
ICPPTemplateParameter[] aParams) throws DOMException {
|
ICPPTemplateParameter[] aParams) throws DOMException {
|
||||||
int pi=0;
|
int pi= 0;
|
||||||
int ai=0;
|
int ai= 0;
|
||||||
while (pi < pParams.length && ai < aParams.length) {
|
while (pi < pParams.length && ai < aParams.length) {
|
||||||
final ICPPTemplateParameter pp = pParams[pi];
|
final ICPPTemplateParameter pp = pParams[pi];
|
||||||
final ICPPTemplateParameter ap = aParams[ai];
|
final ICPPTemplateParameter ap = aParams[ai];
|
||||||
|
@ -2250,8 +2250,9 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!matchTemplateTemplateParameters(((ICPPTemplateTemplateParameter) pp).getTemplateParameters(),
|
if (!matchTemplateTemplateParameters(((ICPPTemplateTemplateParameter) pp).getTemplateParameters(),
|
||||||
((ICPPTemplateTemplateParameter) ap).getTemplateParameters()) )
|
((ICPPTemplateTemplateParameter) ap).getTemplateParameters())) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!pp.isParameterPack())
|
if (!pp.isParameterPack())
|
||||||
|
|
Loading…
Add table
Reference in a new issue