1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

Don't create unnecessary objects.

This commit is contained in:
Sergey Prigogin 2009-04-15 06:02:50 +00:00
parent f126984c7a
commit 4bef03dc3e

View file

@ -75,9 +75,9 @@ public class SemanticUtil {
* @return an array of conversion operators. * @return an array of conversion operators.
*/ */
public static final ICPPMethod[] getDeclaredConversionOperators(ICPPClassType clazz) throws DOMException { public static final ICPPMethod[] getDeclaredConversionOperators(ICPPClassType clazz) throws DOMException {
ICPPMethod[] methods= new ICPPMethod[0]; ICPPMethod[] methods= ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
if (clazz instanceof ICPPDeferredClassInstance) { if (clazz instanceof ICPPDeferredClassInstance) {
clazz= (ICPPClassType) ((ICPPDeferredClassInstance)clazz).getTemplateDefinition(); clazz= (ICPPClassType) ((ICPPDeferredClassInstance) clazz).getTemplateDefinition();
} }
ICPPMethod[] decs= clazz.getDeclaredMethods(); ICPPMethod[] decs= clazz.getDeclaredMethods();
if (decs != null) { if (decs != null) {
@ -98,7 +98,7 @@ public class SemanticUtil {
* @return an array of conversion operators. * @return an array of conversion operators.
*/ */
public static ICPPMethod[] getConversionOperators(ICPPClassType clazz) throws DOMException { public static ICPPMethod[] getConversionOperators(ICPPClassType clazz) throws DOMException {
ICPPMethod[] methods= new ICPPMethod[0]; ICPPMethod[] methods= ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
ObjectSet<ICPPClassType> ancestry= inheritanceClosure(clazz); ObjectSet<ICPPClassType> ancestry= inheritanceClosure(clazz);
for (int i = 0; i < ancestry.size(); i++) { for (int i = 0; i < ancestry.size(); i++) {
methods= (ICPPMethod[]) ArrayUtil.addAll(ICPPMethod.class, methods, getDeclaredConversionOperators(ancestry.keyAt(i))); methods= (ICPPMethod[]) ArrayUtil.addAll(ICPPMethod.class, methods, getDeclaredConversionOperators(ancestry.keyAt(i)));
@ -403,5 +403,4 @@ public class SemanticUtil {
} }
return baseType; return baseType;
} }
} }