1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Formatting.

This commit is contained in:
Sergey Prigogin 2008-12-22 02:53:53 +00:00
parent 9549322f5d
commit 692c985d53

View file

@ -166,7 +166,8 @@ public class CPPSemantics {
*/ */
public static final int MAX_INHERITANCE_DEPTH= 10; public static final int MAX_INHERITANCE_DEPTH= 10;
public static final ASTNodeProperty STRING_LOOKUP_PROPERTY = new ASTNodeProperty("CPPSemantics.STRING_LOOKUP_PROPERTY - STRING_LOOKUP"); //$NON-NLS-1$ public static final ASTNodeProperty STRING_LOOKUP_PROPERTY =
new ASTNodeProperty("CPPSemantics.STRING_LOOKUP_PROPERTY - STRING_LOOKUP"); //$NON-NLS-1$
public static final char[] EMPTY_NAME_ARRAY = new char[0]; public static final char[] EMPTY_NAME_ARRAY = new char[0];
public static final String EMPTY_NAME = ""; //$NON-NLS-1$ public static final String EMPTY_NAME = ""; //$NON-NLS-1$
public static final char[] OPERATOR_ = new char[] {'o','p','e','r','a','t','o','r',' '}; public static final char[] OPERATOR_ = new char[] {'o','p','e','r','a','t','o','r',' '};
@ -269,7 +270,7 @@ public class CPPSemantics {
* followed by <, it is equivalent to the name followed by the template parameters enclosed in <>. * followed by <, it is equivalent to the name followed by the template parameters enclosed in <>.
*/ */
if (binding instanceof ICPPClassTemplate && !(binding instanceof ICPPClassSpecialization) && if (binding instanceof ICPPClassTemplate && !(binding instanceof ICPPClassSpecialization) &&
!(data.astName instanceof ICPPASTTemplateId)) { !(binding instanceof ICPPTemplateParameter) && !(data.astName instanceof ICPPASTTemplateId)) {
ASTNodeProperty prop = data.astName.getPropertyInParent(); ASTNodeProperty prop = data.astName.getPropertyInParent();
if (prop != ICPPASTTemplateId.TEMPLATE_NAME && prop != ICPPASTQualifiedName.SEGMENT_NAME) { if (prop != ICPPASTTemplateId.TEMPLATE_NAME && prop != ICPPASTQualifiedName.SEGMENT_NAME) {
// You cannot use a class template name outside of the class template scope, // You cannot use a class template name outside of the class template scope,
@ -472,7 +473,8 @@ public class CPPSemantics {
return namespaces; return namespaces;
} }
static private void getAssociatedScopes(IType t, ObjectSet<IScope> namespaces, ObjectSet<ICPPClassType> classes, CPPASTTranslationUnit tu) throws DOMException{ static private void getAssociatedScopes(IType t, ObjectSet<IScope> namespaces,
ObjectSet<ICPPClassType> classes, CPPASTTranslationUnit tu) throws DOMException{
//3.4.2-2 //3.4.2-2
if (t instanceof ICPPClassType) { if (t instanceof ICPPClassType) {
ICPPClassType ct= (ICPPClassType) t; ICPPClassType ct= (ICPPClassType) t;
@ -511,7 +513,8 @@ public class CPPSemantics {
return; return;
} }
static private ICPPNamespaceScope getContainingNamespaceScope(IBinding binding, CPPASTTranslationUnit tu) throws DOMException{ static private ICPPNamespaceScope getContainingNamespaceScope(IBinding binding,
CPPASTTranslationUnit tu) throws DOMException{
if (binding == null) return null; if (binding == null) return null;
IScope scope = binding.getScope(); IScope scope = binding.getScope();
while (scope != null && !(scope instanceof ICPPNamespaceScope)) { while (scope != null && !(scope instanceof ICPPNamespaceScope)) {
@ -539,10 +542,12 @@ public class CPPSemantics {
} else { } else {
scope = CPPVisitor.getContainingScope(name); scope = CPPVisitor.getContainingScope(name);
} }
if (scope instanceof ICPPScope) if (scope instanceof ICPPScope) {
return (ICPPScope)scope; return (ICPPScope)scope;
else if (scope instanceof IProblemBinding) } else if (scope instanceof IProblemBinding) {
return new CPPScope.CPPScopeProblem(((IProblemBinding) scope).getASTNode(), IProblemBinding.SEMANTIC_BAD_SCOPE, ((IProblemBinding)scope).getNameCharArray()); return new CPPScope.CPPScopeProblem(((IProblemBinding) scope).getASTNode(),
IProblemBinding.SEMANTIC_BAD_SCOPE, ((IProblemBinding)scope).getNameCharArray());
}
return new CPPScope.CPPScopeProblem(name, IProblemBinding.SEMANTIC_BAD_SCOPE, name.toCharArray()); return new CPPScope.CPPScopeProblem(name, IProblemBinding.SEMANTIC_BAD_SCOPE, name.toCharArray());
} }
@ -829,7 +834,6 @@ public class CPPSemantics {
Object inherited = null; Object inherited = null;
Object result = null; Object result = null;
//use data to detect circular inheritance //use data to detect circular inheritance
if (data.inheritanceChain == null) if (data.inheritanceChain == null)
data.inheritanceChain = new ObjectSet<IScope>(2); data.inheritanceChain = new ObjectSet<IScope>(2);
@ -2237,10 +2241,11 @@ public class CPPSemantics {
ft = e.getProblem(); ft = e.getProblem();
} }
if (type.isSameType(ft)) { if (type.isSameType(ft)) {
if (result == null) if (result != null) {
return new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP,
data.name());
}
result = fn; result = fn;
else
return new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name());
} }
} }
@ -2251,7 +2256,9 @@ public class CPPSemantics {
} }
} }
return (result != null) ? result : new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name()); return result != null ?
result :
new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name());
} }
private static Object getTargetType(LookupData data) { private static Object getTargetType(LookupData data) {