mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Improve API of ICPPTemplateParameter, see bug 253080.
This commit is contained in:
parent
793eff3eb2
commit
55049d6b86
15 changed files with 129 additions and 62 deletions
|
@ -315,7 +315,7 @@ public class ASTTypeUtil {
|
||||||
final ICPPTemplateParameter tpar = (ICPPTemplateParameter) type;
|
final ICPPTemplateParameter tpar = (ICPPTemplateParameter) type;
|
||||||
if (normalize) {
|
if (normalize) {
|
||||||
result.append('#');
|
result.append('#');
|
||||||
result.append(Integer.toString(tpar.getParameterPosition(), 16));
|
result.append(Integer.toString(tpar.getParameterID(), 16));
|
||||||
} else {
|
} else {
|
||||||
result.append(tpar.getName());
|
result.append(tpar.getName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,38 +18,44 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
*/
|
*/
|
||||||
public interface ICPPTemplateParameter extends ICPPBinding {
|
public interface ICPPTemplateParameter extends ICPPBinding {
|
||||||
public static final ICPPTemplateParameter[] EMPTY_TEMPLATE_PARAMETER_ARRAY = new ICPPTemplateParameter[0];
|
public static final ICPPTemplateParameter[] EMPTY_TEMPLATE_PARAMETER_ARRAY = new ICPPTemplateParameter[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The position of the template parameter is determined by the nesting level of the template
|
* Returns the zero-based position of this parameter within the template parameter list it belongs to.
|
||||||
* declaration and the offset of this parameter within the template parameter list.
|
* @since 5.1
|
||||||
* In every context where a template parameter can be referenced (i.e. within a template declaration)
|
*/
|
||||||
* the parameter position is unique.
|
short getParameterPosition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the nesting-level of the template declaration this parameter belongs to.
|
||||||
* <p>
|
* <p>
|
||||||
* The nesting level is determined by counting the template declarations that enclose the one that
|
* The nesting level is determined by counting enclosing template declarations,
|
||||||
* declares this parameter. The position is then computed by
|
* for example:
|
||||||
* <code>(nesting-level << 16) + position-in-parameter-list</code>.
|
|
||||||
* <p>
|
|
||||||
* Example:
|
|
||||||
* <pre>
|
* <pre>
|
||||||
* namespace ns {
|
* namespace ns {
|
||||||
* template<typename T> class X { // parameter position: 0x00000000
|
* template<typename T> class X { // nesting level 0
|
||||||
* template<typename U> class Y1 { // parameter position: 0x00010000
|
* template<typename U> class Y1 { // nesting level 1
|
||||||
* };
|
* };
|
||||||
* class Y2 {
|
* class Y2 {
|
||||||
* template typename<V> class Z { // parameter position: 0x00010000
|
* template typename<V> class Z { // nesting level 1
|
||||||
* void m();
|
* void m();
|
||||||
* };
|
* };
|
||||||
* };
|
* };
|
||||||
* };
|
* };
|
||||||
* }
|
* }
|
||||||
* template<typename T> // parameter position 0x00000000
|
* template<typename T> // nesting level 0
|
||||||
* template <typename V> // parameter position 0x00010000
|
* template <typename V> // nesting level 1
|
||||||
* void ns::X<T>::Y2::Z<V>::m() {}
|
* void ns::X<T>::Y2::Z<V>::m() {}
|
||||||
* </pre>
|
* </pre>
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
int getParameterPosition();
|
short getTemplateNestingLevel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns {@code (getTemplateNestingLevel() << 16) + getParameterPosition()}.
|
||||||
|
* @since 5.1
|
||||||
|
*/
|
||||||
|
int getParameterID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default value for this template parameter, or <code>null</code>.
|
* Returns the default value for this template parameter, or <code>null</code>.
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class Value implements IValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether the value is a template parameter, returns the parameter position of the
|
* Tests whether the value is a template parameter, returns the parameter id of the
|
||||||
* parameter, or <code>null</code> if it is not a template parameter.
|
* parameter, or <code>null</code> if it is not a template parameter.
|
||||||
*/
|
*/
|
||||||
public static int isTemplateParameter(IValue tval) {
|
public static int isTemplateParameter(IValue tval) {
|
||||||
|
@ -265,7 +265,7 @@ public class Value implements IValue {
|
||||||
|
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
private static String evaluate(ICPPTemplateParameter param) {
|
private static String evaluate(ICPPTemplateParameter param) {
|
||||||
return "#" + Integer.toHexString(param.getParameterPosition());
|
return "#" + Integer.toHexString(param.getParameterID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
|
|
|
@ -247,7 +247,7 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBinding resolveTemplateParameter(ICPPTemplateParameter templateParameter) {
|
public IBinding resolveTemplateParameter(ICPPTemplateParameter templateParameter) {
|
||||||
int pos= templateParameter.getParameterPosition() & 0xffff;
|
int pos= templateParameter.getParameterPosition();
|
||||||
|
|
||||||
int tdeclLen= declarations == null ? 0 : declarations.length;
|
int tdeclLen= declarations == null ? 0 : declarations.length;
|
||||||
for (int i= -1; i < tdeclLen; i++) {
|
for (int i= -1; i < tdeclLen; i++) {
|
||||||
|
|
|
@ -38,11 +38,11 @@ import org.eclipse.core.runtime.PlatformObject;
|
||||||
public abstract class CPPTemplateParameter extends PlatformObject
|
public abstract class CPPTemplateParameter extends PlatformObject
|
||||||
implements ICPPTemplateParameter, ICPPInternalBinding, ICPPTwoPhaseBinding {
|
implements ICPPTemplateParameter, ICPPInternalBinding, ICPPTwoPhaseBinding {
|
||||||
private IASTName[] declarations;
|
private IASTName[] declarations;
|
||||||
private final int position;
|
private final int fParameterID;
|
||||||
|
|
||||||
public CPPTemplateParameter(IASTName name) {
|
public CPPTemplateParameter(IASTName name) {
|
||||||
declarations = new IASTName[] {name};
|
declarations = new IASTName[] {name};
|
||||||
position= computeParameterPosition(name);
|
fParameterID= computeParameterPosition(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int computeParameterPosition(IASTName name) {
|
private int computeParameterPosition(IASTName name) {
|
||||||
|
@ -105,8 +105,16 @@ public abstract class CPPTemplateParameter extends PlatformObject
|
||||||
return declarations[0].toCharArray();
|
return declarations[0].toCharArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getParameterPosition() {
|
public int getParameterID() {
|
||||||
return position;
|
return fParameterID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getParameterPosition() {
|
||||||
|
return (short) fParameterID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getTemplateNestingLevel() {
|
||||||
|
return (short) (fParameterID >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTName getPrimaryDeclaration () {
|
public IASTName getPrimaryDeclaration () {
|
||||||
|
@ -239,7 +247,7 @@ public abstract class CPPTemplateParameter extends PlatformObject
|
||||||
// use parameter from the index
|
// use parameter from the index
|
||||||
try {
|
try {
|
||||||
ICPPTemplateParameter[] params = template.getTemplateParameters();
|
ICPPTemplateParameter[] params = template.getTemplateParameters();
|
||||||
final int pos= position & 0xffff;
|
final int pos= getParameterPosition();
|
||||||
if (pos < params.length)
|
if (pos < params.length)
|
||||||
return params[pos];
|
return params[pos];
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
|
|
|
@ -35,36 +35,36 @@ public class CPPTemplateParameterMap implements ICPPTemplateParameterMap {
|
||||||
* Returns whether the map contains the given parameter
|
* Returns whether the map contains the given parameter
|
||||||
*/
|
*/
|
||||||
public boolean contains(ICPPTemplateParameter templateParameter) {
|
public boolean contains(ICPPTemplateParameter templateParameter) {
|
||||||
return fMap.containsKey(templateParameter.getParameterPosition());
|
return fMap.containsKey(templateParameter.getParameterID());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the mapping to the map.
|
* Adds the mapping to the map.
|
||||||
*/
|
*/
|
||||||
public void put(ICPPTemplateParameter param, ICPPTemplateArgument value) {
|
public void put(ICPPTemplateParameter param, ICPPTemplateArgument value) {
|
||||||
fMap.put(param.getParameterPosition(), value);
|
fMap.put(param.getParameterID(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the mapping to the map.
|
* Adds the mapping to the map.
|
||||||
*/
|
*/
|
||||||
public void put(int parameterPos, ICPPTemplateArgument value) {
|
public void put(int parameterID, ICPPTemplateArgument value) {
|
||||||
fMap.put(parameterPos, value);
|
fMap.put(parameterID, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value for the given parameter.
|
* Returns the value for the given parameter.
|
||||||
*/
|
*/
|
||||||
public ICPPTemplateArgument getArgument(ICPPTemplateParameter param) {
|
public ICPPTemplateArgument getArgument(ICPPTemplateParameter param) {
|
||||||
return (ICPPTemplateArgument) fMap.get(param.getParameterPosition());
|
return (ICPPTemplateArgument) fMap.get(param.getParameterID());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value for the template parameter at the given position.
|
* Returns the value for the template parameter with the given id.
|
||||||
* @see ICPPTemplateParameter#getParameterPosition()
|
* @see ICPPTemplateParameter#getParameterID()
|
||||||
*/
|
*/
|
||||||
public ICPPTemplateArgument getArgument(int paramPosition) {
|
public ICPPTemplateArgument getArgument(int paramID) {
|
||||||
return (ICPPTemplateArgument) fMap.get(paramPosition);
|
return (ICPPTemplateArgument) fMap.get(paramID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
||||||
if (!(type instanceof ICPPTemplateTemplateParameter))
|
if (!(type instanceof ICPPTemplateTemplateParameter))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return getParameterPosition() == ((ICPPTemplateParameter) type).getParameterPosition();
|
return getParameterID() == ((ICPPTemplateParameter) type).getParameterID();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException {
|
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() throws DOMException {
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class CPPTemplateTypeParameter extends CPPTemplateParameter implements
|
||||||
if (!(type instanceof ICPPTemplateTypeParameter))
|
if (!(type instanceof ICPPTemplateTypeParameter))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return getParameterPosition() == ((ICPPTemplateParameter) type).getParameterPosition();
|
return getParameterID() == ((ICPPTemplateParameter) type).getParameterID();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTName getUnknownName() {
|
public IASTName getUnknownName() {
|
||||||
|
|
|
@ -253,7 +253,7 @@ public class CPPTemplates {
|
||||||
|
|
||||||
private static boolean argIsParameter(ICPPTemplateArgument arg, ICPPTemplateParameter param) {
|
private static boolean argIsParameter(ICPPTemplateArgument arg, ICPPTemplateParameter param) {
|
||||||
if (param instanceof ICPPTemplateNonTypeParameter) {
|
if (param instanceof ICPPTemplateNonTypeParameter) {
|
||||||
return arg.isNonTypeValue() && Value.isTemplateParameter(arg.getNonTypeValue()) == param.getParameterPosition();
|
return arg.isNonTypeValue() && Value.isTemplateParameter(arg.getNonTypeValue()) == param.getParameterID();
|
||||||
}
|
}
|
||||||
if (param instanceof IType) {
|
if (param instanceof IType) {
|
||||||
return arg.isTypeValue() && ((IType) param).isSameType(arg.getTypeValue());
|
return arg.isTypeValue() && ((IType) param).isSameType(arg.getTypeValue());
|
||||||
|
@ -1917,7 +1917,7 @@ public class CPPTemplates {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
int parpos= Value.isTemplateParameter(arg.getNonTypeValue());
|
int parpos= Value.isTemplateParameter(arg.getNonTypeValue());
|
||||||
if (parpos != par.getParameterPosition())
|
if (parpos != par.getParameterID())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,18 @@ public class CompositeCPPTemplateNonTypeParameter extends CompositeCPPVariable i
|
||||||
fail(); return null;
|
fail(); return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getParameterPosition() {
|
public short getParameterPosition() {
|
||||||
return ((ICPPTemplateParameter)rbinding).getParameterPosition();
|
return ((ICPPTemplateParameter)rbinding).getParameterPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public short getTemplateNestingLevel() {
|
||||||
|
return ((ICPPTemplateParameter)rbinding).getTemplateNestingLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getParameterID() {
|
||||||
|
return ((ICPPTemplateParameter)rbinding).getParameterID();
|
||||||
|
}
|
||||||
|
|
||||||
public ICPPTemplateArgument getDefaultValue() {
|
public ICPPTemplateArgument getDefaultValue() {
|
||||||
try {
|
try {
|
||||||
return TemplateInstanceUtil.convert(cf, ((ICPPTemplateTypeParameter)rbinding).getDefaultValue());
|
return TemplateInstanceUtil.convert(cf, ((ICPPTemplateTypeParameter)rbinding).getDefaultValue());
|
||||||
|
|
|
@ -37,10 +37,18 @@ public class CompositeCPPTemplateTypeParameter extends CompositeCPPBinding
|
||||||
return cf.getCompositeType(preresult);
|
return cf.getCompositeType(preresult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getParameterPosition() {
|
public short getParameterPosition() {
|
||||||
return ((ICPPTemplateParameter)rbinding).getParameterPosition();
|
return ((ICPPTemplateParameter)rbinding).getParameterPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public short getTemplateNestingLevel() {
|
||||||
|
return ((ICPPTemplateParameter)rbinding).getTemplateNestingLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getParameterID() {
|
||||||
|
return ((ICPPTemplateParameter)rbinding).getParameterID();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSameType(IType type) {
|
public boolean isSameType(IType type) {
|
||||||
return ((IType)rbinding).isSameType(type);
|
return ((IType)rbinding).isSameType(type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
||||||
|
|
||||||
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
|
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
|
||||||
// Template parameters are identified by their position in the parameter list.
|
// Template parameters are identified by their position in the parameter list.
|
||||||
int pos = param.getParameterPosition() & 0xFFFF;
|
int pos = param.getParameterPosition();
|
||||||
if (params != null) {
|
if (params != null) {
|
||||||
return pos < params.length ? params[pos] : null;
|
return pos < params.length ? params[pos] : null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction
|
||||||
|
|
||||||
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
|
public ICPPTemplateParameter adaptTemplateParameter(ICPPTemplateParameter param) {
|
||||||
// Template parameters are identified by their position in the parameter list.
|
// Template parameters are identified by their position in the parameter list.
|
||||||
int pos = param.getParameterPosition() & 0xFFFF;
|
int pos = param.getParameterPosition();
|
||||||
try {
|
try {
|
||||||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + TEMPLATE_PARAMS, getLinkageImpl());
|
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + TEMPLATE_PARAMS, getLinkageImpl());
|
||||||
return (ICPPTemplateParameter) list.getNodeAt(pos);
|
return (ICPPTemplateParameter) list.getNodeAt(pos);
|
||||||
|
|
|
@ -37,9 +37,10 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPVariable implements IPDOMMe
|
||||||
ICPPTemplateNonTypeParameter {
|
ICPPTemplateNonTypeParameter {
|
||||||
|
|
||||||
private static final int MEMBERLIST = PDOMCPPVariable.RECORD_SIZE;
|
private static final int MEMBERLIST = PDOMCPPVariable.RECORD_SIZE;
|
||||||
private static final int PARAMETERPOS= PDOMCPPVariable.RECORD_SIZE + 4;
|
private static final int PARAMETERID= PDOMCPPVariable.RECORD_SIZE + 4;
|
||||||
private static final int DEFAULTVAL= PDOMCPPVariable.RECORD_SIZE + 8;
|
private static final int DEFAULTVAL= PDOMCPPVariable.RECORD_SIZE + 8;
|
||||||
|
|
||||||
|
private int fCachedParamID= -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The size in bytes of a PDOMCPPTemplateTypeParameter record in the database.
|
* The size in bytes of a PDOMCPPTemplateTypeParameter record in the database.
|
||||||
|
@ -51,7 +52,7 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPVariable implements IPDOMMe
|
||||||
ICPPTemplateNonTypeParameter param) throws CoreException {
|
ICPPTemplateNonTypeParameter param) throws CoreException {
|
||||||
super(pdom, parent, param);
|
super(pdom, parent, param);
|
||||||
final Database db = pdom.getDB();
|
final Database db = pdom.getDB();
|
||||||
db.putInt(record + PARAMETERPOS, param.getParameterPosition());
|
db.putInt(record + PARAMETERID, param.getParameterID());
|
||||||
ICPPTemplateArgument val= param.getDefaultValue();
|
ICPPTemplateArgument val= param.getDefaultValue();
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
IValue sval= val.getNonTypeValue();
|
IValue sval= val.getNonTypeValue();
|
||||||
|
@ -92,13 +93,30 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPVariable implements IPDOMMe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getParameterPosition() {
|
public short getParameterPosition() {
|
||||||
try {
|
readParamID();
|
||||||
final Database db = pdom.getDB();
|
return (short) fCachedParamID;
|
||||||
return db.getInt(record + PARAMETERPOS);
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
CCorePlugin.log(e);
|
public short getTemplateNestingLevel() {
|
||||||
return -1;
|
readParamID();
|
||||||
|
return (short)(fCachedParamID >> 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getParameterID() {
|
||||||
|
readParamID();
|
||||||
|
return fCachedParamID;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readParamID() {
|
||||||
|
if (fCachedParamID == -1) {
|
||||||
|
try {
|
||||||
|
final Database db = pdom.getDB();
|
||||||
|
fCachedParamID= db.getInt(record + PARAMETERID);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
fCachedParamID= -2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,14 +43,16 @@ class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMember
|
||||||
|
|
||||||
private static final int DEFAULT_TYPE = PDOMCPPBinding.RECORD_SIZE + 0;
|
private static final int DEFAULT_TYPE = PDOMCPPBinding.RECORD_SIZE + 0;
|
||||||
private static final int MEMBERLIST = PDOMCPPBinding.RECORD_SIZE + 4;
|
private static final int MEMBERLIST = PDOMCPPBinding.RECORD_SIZE + 4;
|
||||||
private static final int PARAMETERPOS= PDOMCPPBinding.RECORD_SIZE + 8;
|
private static final int PARAMETERID= PDOMCPPBinding.RECORD_SIZE + 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The size in bytes of a PDOMCPPTemplateTypeParameter record in the database.
|
* The size in bytes of a PDOMCPPTemplateTypeParameter record in the database.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("hiding")
|
@SuppressWarnings("hiding")
|
||||||
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 12;
|
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 12;
|
||||||
|
|
||||||
private ICPPScope fUnknownScope;
|
private ICPPScope fUnknownScope;
|
||||||
|
private int fCachedParamID= -1;
|
||||||
|
|
||||||
public PDOMCPPTemplateTypeParameter(PDOM pdom, PDOMNode parent,
|
public PDOMCPPTemplateTypeParameter(PDOM pdom, PDOMNode parent,
|
||||||
ICPPTemplateTypeParameter param) throws CoreException {
|
ICPPTemplateTypeParameter param) throws CoreException {
|
||||||
|
@ -58,7 +60,7 @@ class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMember
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Database db = pdom.getDB();
|
final Database db = pdom.getDB();
|
||||||
db.putInt(record + PARAMETERPOS, param.getParameterPosition());
|
db.putInt(record + PARAMETERID, param.getParameterID());
|
||||||
IType dflt = param.getDefault();
|
IType dflt = param.getDefault();
|
||||||
if (dflt != null) {
|
if (dflt != null) {
|
||||||
PDOMNode typeNode = getLinkageImpl().addType(this, dflt);
|
PDOMNode typeNode = getLinkageImpl().addType(this, dflt);
|
||||||
|
@ -85,13 +87,30 @@ class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMember
|
||||||
return IIndexCPPBindingConstants.CPP_TEMPLATE_TYPE_PARAMETER;
|
return IIndexCPPBindingConstants.CPP_TEMPLATE_TYPE_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getParameterPosition() {
|
public short getParameterPosition() {
|
||||||
try {
|
readParamID();
|
||||||
final Database db = pdom.getDB();
|
return (short) fCachedParamID;
|
||||||
return db.getInt(record + PARAMETERPOS);
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
CCorePlugin.log(e);
|
public short getTemplateNestingLevel() {
|
||||||
return -1;
|
readParamID();
|
||||||
|
return (short)(fCachedParamID >> 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getParameterID() {
|
||||||
|
readParamID();
|
||||||
|
return fCachedParamID;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readParamID() {
|
||||||
|
if (fCachedParamID == -1) {
|
||||||
|
try {
|
||||||
|
final Database db = pdom.getDB();
|
||||||
|
fCachedParamID= db.getInt(record + PARAMETERID);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
fCachedParamID= -2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +134,7 @@ class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMember
|
||||||
if (!(type instanceof ICPPTemplateTypeParameter))
|
if (!(type instanceof ICPPTemplateTypeParameter))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return getParameterPosition() == ((ICPPTemplateParameter) type).getParameterPosition();
|
return getParameterID() == ((ICPPTemplateParameter) type).getParameterID();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IType getDefault() {
|
public IType getDefault() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue