Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2008-03-08 23:05:43 +0000
committerSergey Prigogin2008-03-08 23:05:43 +0000
commit2d4cd87741f9d1a1ddd51dbc5c902d4e931dacd6 (patch)
treeb4af8960d0afa7e1d6fb32901d0116fac9027cd9 /core/org.eclipse.cdt.core/parser
parent7cdbcfc0f9b61b1040feb1cd008db2c4c82d8416 (diff)
downloadorg.eclipse.cdt-2d4cd87741f9d1a1ddd51dbc5c902d4e931dacd6.tar.gz
org.eclipse.cdt-2d4cd87741f9d1a1ddd51dbc5c902d4e931dacd6.tar.xz
org.eclipse.cdt-2d4cd87741f9d1a1ddd51dbc5c902d4e931dacd6.zip
Use generics.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java45
1 files changed, 21 insertions, 24 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java
index 7a14b7e61d7..39f8331a8f5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java
@@ -50,49 +50,48 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
public CPPFunctionScope(IASTFunctionDeclarator physicalNode) {
super(physicalNode);
}
-
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#addBinding(org.eclipse.cdt.core.dom.ast.IBinding)
*/
public void addBinding(IBinding binding) {
//3.3.4 only labels have function scope
- if( !( binding instanceof ILabel ) )
+ if (!(binding instanceof ILabel))
return;
- if( labels == CharArrayObjectMap.EMPTY_MAP )
- labels = new CharArrayObjectMap( 2 );
+ if (labels == CharArrayObjectMap.EMPTY_MAP)
+ labels = new CharArrayObjectMap(2);
- labels.put( binding.getNameCharArray(), binding );
+ labels.put(binding.getNameCharArray(), binding);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getBinding(int, char[])
*/
- public IBinding getBinding( IASTName name ) {
- return (IBinding) labels.get( name.toCharArray() );
+ public IBinding getBinding(IASTName name) {
+ return (IBinding) labels.get(name.toCharArray());
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
*/
public IBinding[] find(String name) throws DOMException {
- char [] n = name.toCharArray();
- List bindings = new ArrayList();
+ char[] n = name.toCharArray();
+ List<IBinding> bindings = new ArrayList<IBinding>();
for (int i = 0; i < labels.size(); i++) {
char[] key = labels.keyAt(i);
if (CharArrayUtils.equals(key, n)) {
- bindings.add(labels.get(key));
+ bindings.add((IBinding) labels.get(key));
}
}
- IBinding[] additional = super.find( name );
+ IBinding[] additional = super.find(name);
for (int i = 0; i < additional.length; i++) {
bindings.add(additional[i]);
}
- return (IBinding[]) bindings.toArray(new IBinding[bindings.size()]);
+ return bindings.toArray(new IBinding[bindings.size()]);
}
public IScope getParent() throws DOMException {
@@ -100,48 +99,46 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
//could loop since resolving functions requires resolving their parameter types
IASTFunctionDeclarator fdtor = (IASTFunctionDeclarator) getPhysicalNode();
IASTName name = fdtor.getName();
- if( name instanceof ICPPASTQualifiedName ){
+ if (name instanceof ICPPASTQualifiedName) {
ICPPASTQualifiedName qual = (ICPPASTQualifiedName) name;
- IASTName [] ns = qual.getNames();
- if( ns.length > 1){
+ IASTName[] ns = qual.getNames();
+ if (ns.length > 1) {
IBinding binding = ns[ ns.length - 2 ].resolveBinding();
if (binding == null)
return null;
- else if( binding instanceof ICPPClassType )
+ else if (binding instanceof ICPPClassType)
return ((ICPPClassType)binding).getCompositeScope();
- else if( binding instanceof ICPPNamespace )
+ else if (binding instanceof ICPPNamespace)
return ((ICPPNamespace)binding).getNamespaceScope();
return binding.getScope();
- } else if( qual.isFullyQualified() ){
+ } else if (qual.isFullyQualified()) {
return qual.getTranslationUnit().getScope();
}
}
- return CPPVisitor.getContainingScope( name );
+ return CPPVisitor.getContainingScope(name);
}
-
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope#getBodyScope()
*/
public IScope getBodyScope() {
IASTFunctionDeclarator fnDtor = (IASTFunctionDeclarator) getPhysicalNode();
IASTNode parent = fnDtor.getParent();
- if( parent instanceof IASTFunctionDefinition ){
+ if (parent instanceof IASTFunctionDefinition) {
IASTStatement body = ((IASTFunctionDefinition)parent).getBody();
- if( body instanceof IASTCompoundStatement )
+ if (body instanceof IASTCompoundStatement)
return ((IASTCompoundStatement)body).getScope();
}
return null;
}
-
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName()
*/
public IName getScopeName() {
IASTNode node = getPhysicalNode();
- if( node instanceof ICPPASTFunctionDeclarator ){
+ if (node instanceof ICPPASTFunctionDeclarator) {
return ((ICPPASTFunctionDeclarator)node).getName();
}
return null;

Back to the top