mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Cosmetics.
This commit is contained in:
parent
da85a41850
commit
773eb90b41
13 changed files with 105 additions and 117 deletions
|
@ -20,13 +20,13 @@ import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
|||
*/
|
||||
public interface ICCompositeTypeScope extends ICScope {
|
||||
/**
|
||||
* get the binding for the member that has been previous added to this scope
|
||||
* Returns the binding for the member that has been previous added to this scope
|
||||
* and that matches the given name.
|
||||
*/
|
||||
public IBinding getBinding(char[] name);
|
||||
|
||||
/**
|
||||
* Get the type this scope is associated with
|
||||
* Returns the type this scope is associated with.
|
||||
* @since 4.0
|
||||
*/
|
||||
public ICompositeType getCompositeType();
|
||||
|
|
|
@ -131,8 +131,8 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
public IASTTranslationUnit getASTTranslationUnit(org.eclipse.cdt.core.parser.CodeReader reader,
|
||||
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory codeReaderFactory,
|
||||
IIndex index, int options, IParserLogService log) throws CoreException {
|
||||
return getASTTranslationUnit(FileContent.adapt(reader), scanInfo, IncludeFileContentProvider
|
||||
.adapt(codeReaderFactory), index, options, log);
|
||||
return getASTTranslationUnit(FileContent.adapt(reader), scanInfo,
|
||||
IncludeFileContentProvider.adapt(codeReaderFactory), index, options, log);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -167,7 +167,7 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
IASTTranslationUnit ast= parser.parse();
|
||||
ast.setIsHeaderUnit((options & OPTION_IS_SOURCE_UNIT) == 0);
|
||||
return ast;
|
||||
} catch(ParseError e) {
|
||||
} catch (ParseError e) {
|
||||
// Only the TOO_MANY_TOKENS error can be handled here.
|
||||
if (e.getErrorKind() != ParseErrorKind.TOO_MANY_TOKENS)
|
||||
throw e;
|
||||
|
@ -178,7 +178,7 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
if (scanner.getLocationResolver() != null)
|
||||
tuName = scanner.getLocationResolver().getTranslationUnitPath();
|
||||
|
||||
log.traceLog(e.getMessage() + (tuName == null ? new String() : (" while parsing " + tuName))); //$NON-NLS-1$
|
||||
log.traceLog(e.getMessage() + (tuName == null ? "" : (" while parsing " + tuName))); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
|
@ -241,7 +241,8 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
* @return an instance of ISourceCodeParser
|
||||
* @since 5.6
|
||||
*/
|
||||
protected ISourceCodeParser createParser(IScanner scanner, IParserLogService log, IIndex index, boolean forCompletion, int options, IParserSettings settings) {
|
||||
protected ISourceCodeParser createParser(IScanner scanner, IParserLogService log, IIndex index,
|
||||
boolean forCompletion, int options, IParserSettings settings) {
|
||||
ParserMode mode = createParserMode(forCompletion, options);
|
||||
return createParser(scanner, mode, log, index, options, settings);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2014 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2015 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
@ -149,24 +150,24 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
|
|||
return ParserLanguage.CPP;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getLinkage()
|
||||
*/
|
||||
@Override
|
||||
public ILinkage getLinkage() {
|
||||
return Linkage.CPP_LINKAGE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.scanner.ISkippedIndexedFilesListener#skippedFile(org.eclipse.cdt.internal.core.parser.scanner.IncludeFileContent)
|
||||
*/
|
||||
@Override
|
||||
public void skippedFile(int offset, InternalFileContent fileContent) {
|
||||
super.skippedFile(offset, fileContent);
|
||||
fScopeMapper.registerAdditionalDirectives(offset, fileContent.getUsingDirectives());
|
||||
}
|
||||
|
||||
// Namespace scopes from the index have to be mapped back to the AST (bug 217102).
|
||||
/**
|
||||
* Maps an index scope to the AST.
|
||||
*
|
||||
* @param scope a scope, possibly from index
|
||||
* @return the corresponding scope in the AST, or the original scope if it doesn't have
|
||||
* a counterpart in the AST.
|
||||
*/
|
||||
public IScope mapToASTScope(IScope scope) {
|
||||
if (scope instanceof IIndexScope) {
|
||||
return fScopeMapper.mapToASTScope((IIndexScope) scope);
|
||||
|
@ -174,7 +175,14 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
|
|||
return scope;
|
||||
}
|
||||
|
||||
// Class types from the index have to be mapped back to the AST (bug 262719).
|
||||
/**
|
||||
* Maps a class type to the AST.
|
||||
*
|
||||
* @param binding a class type, possibly from index
|
||||
* @param point a lookup point in the AST
|
||||
* @return the corresponding class in the AST, or the original class type if it doesn't have
|
||||
* a counterpart in the AST.
|
||||
*/
|
||||
public ICPPClassType mapToAST(ICPPClassType binding, IASTNode point) {
|
||||
return fScopeMapper.mapToAST(binding, point);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
@ -26,7 +26,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
|||
* Represents a using-directive found in the AST.
|
||||
*/
|
||||
public class CPPUsingDirective implements ICPPUsingDirective {
|
||||
|
||||
private IASTName fNamespaceName;
|
||||
|
||||
/**
|
||||
|
@ -43,9 +42,6 @@ public class CPPUsingDirective implements ICPPUsingDirective {
|
|||
fNamespaceName= nsdef.getName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective#getNamespaceScope()
|
||||
*/
|
||||
@Override
|
||||
public ICPPNamespaceScope getNominatedScope() throws DOMException {
|
||||
IBinding binding= fNamespaceName.resolveBinding();
|
||||
|
@ -55,18 +51,12 @@ public class CPPUsingDirective implements ICPPUsingDirective {
|
|||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective#getPointOfDeclaration()
|
||||
*/
|
||||
@Override
|
||||
public int getPointOfDeclaration() {
|
||||
final ASTNode astNode = (ASTNode) fNamespaceName;
|
||||
return astNode.getOffset() + astNode.getLength();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective#getContainingScope()
|
||||
*/
|
||||
@Override
|
||||
public IScope getContainingScope() {
|
||||
return CPPVisitor.getContainingScope(fNamespaceName);
|
||||
|
|
|
@ -1005,14 +1005,14 @@ public class CPPSemantics {
|
|||
|
||||
// Nominate using-directives found in this block or namespace.
|
||||
if (scope instanceof ICPPNamespaceScope) {
|
||||
final ICPPNamespaceScope blockScope= (ICPPNamespaceScope) scope;
|
||||
final ICPPNamespaceScope namespaceScope= (ICPPNamespaceScope) scope;
|
||||
|
||||
if (data.qualified && blockScope.getKind() != EScopeKind.eLocal) {
|
||||
lookupInlineNamespaces(data, blockScope);
|
||||
if (data.qualified && namespaceScope.getKind() != EScopeKind.eLocal) {
|
||||
lookupInlineNamespaces(data, namespaceScope);
|
||||
}
|
||||
if (data.contentAssist || !data.hasResults() || !data.qualified) {
|
||||
// Nominate namespaces
|
||||
nominateNamespaces(data, blockScope);
|
||||
nominateNamespaces(data, namespaceScope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index;
|
||||
|
||||
|
@ -15,7 +15,6 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
|||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
import org.eclipse.cdt.core.index.IIndexName;
|
||||
|
||||
|
||||
/**
|
||||
* Interface for scopes returned via the index
|
||||
* @since 4.0
|
||||
|
@ -24,12 +23,12 @@ public interface IIndexScope extends IScope {
|
|||
IIndexScope[] EMPTY_INDEX_SCOPE_ARRAY = {};
|
||||
|
||||
/**
|
||||
* Get the binding associated with scope
|
||||
* Returns the binding associated with the scope.
|
||||
*/
|
||||
IIndexBinding getScopeBinding();
|
||||
|
||||
/**
|
||||
* Returns the parent scope or <code>null</code> if the scope is nested in the global scope.
|
||||
* Returns the parent scope or {@code null} if the scope is nested in the global scope.
|
||||
*/
|
||||
@Override
|
||||
IIndexScope getParent();
|
||||
|
|
|
@ -38,7 +38,9 @@ public abstract class CompositeScope implements IIndexScope {
|
|||
protected final IIndexFragmentBinding rbinding;
|
||||
|
||||
public CompositeScope(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
||||
if (cf == null || rbinding == null)
|
||||
if (cf == null)
|
||||
throw new NullPointerException();
|
||||
if (rbinding == null)
|
||||
throw new NullPointerException();
|
||||
this.cf = cf;
|
||||
this.rbinding = rbinding;
|
||||
|
@ -66,7 +68,6 @@ public abstract class CompositeScope implements IIndexScope {
|
|||
throw new CompositingNotImplementedError();
|
||||
}
|
||||
|
||||
|
||||
public IBinding getRawScopeBinding() {
|
||||
return rbinding;
|
||||
}
|
||||
|
@ -84,8 +85,7 @@ public abstract class CompositeScope implements IIndexScope {
|
|||
return binding;
|
||||
} else if (binding instanceof CPPCompositeBinding /* AST composite */) {
|
||||
return new CPPCompositeBinding(
|
||||
processUncertainBindings(((CPPCompositeBinding) binding).getBindings())
|
||||
);
|
||||
processUncertainBindings(((CPPCompositeBinding) binding).getBindings()));
|
||||
} else if (binding instanceof CPPUsingDeclaration) {
|
||||
return binding;
|
||||
} else if (binding == null) {
|
||||
|
@ -98,8 +98,10 @@ public abstract class CompositeScope implements IIndexScope {
|
|||
}
|
||||
|
||||
/**
|
||||
* A convenience method for processing an array of bindings with {@link CompositeScope#processUncertainBinding(IBinding)}
|
||||
* Returns an empty array if the input parameter is null
|
||||
* A convenience method for processing an array of bindings with
|
||||
* {@link CompositeScope#processUncertainBinding(IBinding)}.
|
||||
* Returns an empty array if the input parameter is null.
|
||||
*
|
||||
* @param frgBindings
|
||||
* @return a non-null IBinding[]
|
||||
*/
|
||||
|
@ -125,19 +127,19 @@ public abstract class CompositeScope implements IIndexScope {
|
|||
}
|
||||
|
||||
/**
|
||||
* The c++-name resolution stores scopes in hash-maps, we need to make sure equality is detected
|
||||
* The c++ name resolution stores scopes in hash-maps, we need to make sure equality is detected
|
||||
* in order to prevent infinite loops.
|
||||
*/
|
||||
@Override
|
||||
public final boolean equals(Object other) {
|
||||
if (other instanceof CompositeScope) {
|
||||
return rbinding.equals(((CompositeScope)other).rbinding);
|
||||
return rbinding.equals(((CompositeScope) other).rbinding);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The c++-name resolution stores scopes in hash-maps, we need to make sure equality is detected
|
||||
* The c++ name resolution stores scopes in hash-maps, we need to make sure equality is detected
|
||||
* in order to prevent infinite loops.
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.c;
|
||||
|
||||
|
@ -46,27 +46,20 @@ public class CCompositesFactory extends AbstractCompositeFactory {
|
|||
super(index);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.internal.core.index.composite.cpp.ICompositesFactory#getCompositeScope(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.core.dom.ast.IScope)
|
||||
*/
|
||||
@Override
|
||||
public IIndexScope getCompositeScope(IIndexScope rscope) {
|
||||
if(rscope==null)
|
||||
if (rscope == null)
|
||||
return null;
|
||||
if(rscope instanceof ICCompositeTypeScope) {
|
||||
if (rscope instanceof ICCompositeTypeScope) {
|
||||
ICCompositeTypeScope cscope = (ICCompositeTypeScope) rscope;
|
||||
IIndexFragmentBinding rbinding = (IIndexFragmentBinding) cscope.getCompositeType();
|
||||
return (IIndexScope) ((ICompositeType)getCompositeBinding(rbinding)).getCompositeScope();
|
||||
return (IIndexScope) ((ICompositeType) getCompositeBinding(rbinding)).getCompositeScope();
|
||||
}
|
||||
throw new CompositingNotImplementedError();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.internal.core.index.composite.cpp.ICompositesFactory#getCompositeType(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.core.dom.ast.IType)
|
||||
*/
|
||||
@Override
|
||||
public IType getCompositeType(IType rtype) {
|
||||
|
||||
if (rtype instanceof IIndexFragmentBinding) {
|
||||
return (IType) getCompositeBinding((IIndexFragmentBinding) rtype);
|
||||
}
|
||||
|
@ -138,28 +131,28 @@ public class CCompositesFactory extends AbstractCompositeFactory {
|
|||
public IIndexBinding getCompositeBinding(IIndexFragmentBinding rbinding) {
|
||||
IIndexBinding result;
|
||||
|
||||
if(rbinding==null) {
|
||||
if (rbinding == null) {
|
||||
result = null;
|
||||
} else if(rbinding instanceof IParameter) {
|
||||
} else if (rbinding instanceof IParameter) {
|
||||
result = new CompositeCParameter(this, rbinding);
|
||||
} else if(rbinding instanceof IField) {
|
||||
} else if (rbinding instanceof IField) {
|
||||
result = new CompositeCField(this, rbinding);
|
||||
} else if(rbinding instanceof IVariable) {
|
||||
} else if (rbinding instanceof IVariable) {
|
||||
result = new CompositeCVariable(this, rbinding);
|
||||
} else if(rbinding instanceof ICompositeType) {
|
||||
} else if (rbinding instanceof ICompositeType) {
|
||||
result = new CompositeCStructure(this, findOneBinding(rbinding, false));
|
||||
} else if(rbinding instanceof IEnumeration) {
|
||||
} else if (rbinding instanceof IEnumeration) {
|
||||
result = new CompositeCEnumeration(this, findOneBinding(rbinding, false));
|
||||
} else if(rbinding instanceof IFunction) {
|
||||
} else if (rbinding instanceof IFunction) {
|
||||
result = new CompositeCFunction(this, rbinding);
|
||||
} else if(rbinding instanceof IEnumerator) {
|
||||
} else if (rbinding instanceof IEnumerator) {
|
||||
result = new CompositeCEnumerator(this, rbinding);
|
||||
} else if(rbinding instanceof ITypedef) {
|
||||
} else if (rbinding instanceof ITypedef) {
|
||||
result = new CompositeCTypedef(this, rbinding);
|
||||
} else if(rbinding instanceof IIndexMacroContainer) {
|
||||
} else if (rbinding instanceof IIndexMacroContainer) {
|
||||
result= new CompositeMacroContainer(this, rbinding);
|
||||
} else {
|
||||
throw new CompositingNotImplementedError("composite binding unavailable for "+rbinding+" "+rbinding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
throw new CompositingNotImplementedError("Composite binding unavailable for " + rbinding + " " + rbinding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.c;
|
||||
|
||||
|
@ -39,7 +39,7 @@ class CompositeCCompositeScope extends CompositeScope implements ICCompositeType
|
|||
|
||||
@Override
|
||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) {
|
||||
IBinding binding = ((ICompositeType)rbinding).getCompositeScope().getBinding(name, resolve, fileSet);
|
||||
IBinding binding = ((ICompositeType) rbinding).getCompositeScope().getBinding(name, resolve, fileSet);
|
||||
return processUncertainBinding(binding);
|
||||
}
|
||||
|
||||
|
@ -50,13 +50,13 @@ class CompositeCCompositeScope extends CompositeScope implements ICCompositeType
|
|||
|
||||
@Override
|
||||
public IBinding[] getBindings(ScopeLookupData lookup) {
|
||||
IBinding[] bindings = ((ICompositeType)rbinding).getCompositeScope().getBindings(lookup);
|
||||
IBinding[] bindings = ((ICompositeType) rbinding).getCompositeScope().getBindings(lookup);
|
||||
return processUncertainBindings(bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding[] find(String name) {
|
||||
IBinding[] preresult = ((ICompositeType)rbinding).getCompositeScope().find(name);
|
||||
IBinding[] preresult = ((ICompositeType) rbinding).getCompositeScope().find(name);
|
||||
return processUncertainBindings(preresult);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class CompositeCPPNamespaceScope extends CompositeScope implements ICPPNamespace
|
|||
@Override
|
||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) {
|
||||
IBinding preresult = null;
|
||||
for(int i=0; preresult==null && i<namespaces.length; i++) {
|
||||
for (int i= 0; preresult == null && i < namespaces.length; i++) {
|
||||
preresult = namespaces[i].getNamespaceScope().getBinding(name, resolve, fileSet);
|
||||
}
|
||||
return processUncertainBinding(preresult);
|
||||
|
@ -65,7 +65,7 @@ class CompositeCPPNamespaceScope extends CompositeScope implements ICPPNamespace
|
|||
@Override
|
||||
public IBinding[] getBindings(ScopeLookupData lookup) {
|
||||
IIndexFragmentBinding[][] preresult = new IIndexFragmentBinding[namespaces.length][];
|
||||
for(int i=0; i<namespaces.length; i++) {
|
||||
for (int i= 0; i < namespaces.length; i++) {
|
||||
IBinding[] raw = namespaces[i].getNamespaceScope().getBindings(lookup);
|
||||
preresult[i] = new IIndexFragmentBinding[raw.length];
|
||||
System.arraycopy(raw, 0, preresult[i], 0, raw.length);
|
||||
|
@ -76,7 +76,7 @@ class CompositeCPPNamespaceScope extends CompositeScope implements ICPPNamespace
|
|||
@Override
|
||||
final public IBinding[] find(String name) {
|
||||
IIndexFragmentBinding[][] preresult = new IIndexFragmentBinding[namespaces.length][];
|
||||
for(int i=0; i<namespaces.length; i++) {
|
||||
for (int i= 0; i < namespaces.length; i++) {
|
||||
IBinding[] raw = namespaces[i].getNamespaceScope().find(name);
|
||||
preresult[i] = new IIndexFragmentBinding[raw.length];
|
||||
System.arraycopy(raw, 0, preresult[i], 0, raw.length);
|
||||
|
@ -92,32 +92,29 @@ class CompositeCPPNamespaceScope extends CompositeScope implements ICPPNamespace
|
|||
@Override
|
||||
public IIndexName getScopeName() {
|
||||
for (ICPPNamespace namespace : namespaces) {
|
||||
if(namespace instanceof IIndexScope) {
|
||||
if (namespace instanceof IIndexScope) {
|
||||
IIndexScope s= (IIndexScope) namespace;
|
||||
IIndexName nm= s.getScopeName();
|
||||
if(nm!=null)
|
||||
if (nm != null)
|
||||
return nm;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope#getInlineNamespaces()
|
||||
*/
|
||||
@Override
|
||||
public ICPPNamespaceScope[] getInlineNamespaces() {
|
||||
IIndexFragmentBinding[][] preresult = new IIndexFragmentBinding[namespaces.length][];
|
||||
for(int i=0; i<namespaces.length; i++) {
|
||||
for (int i= 0; i < namespaces.length; i++) {
|
||||
ICPPNamespaceScope[] raw = namespaces[i].getNamespaceScope().getInlineNamespaces();
|
||||
IIndexFragmentBinding[] arr = preresult[i] = new IIndexFragmentBinding[raw.length];
|
||||
for (int j=0; j<raw.length; j++) {
|
||||
for (int j= 0; j < raw.length; j++) {
|
||||
arr[j]= (IIndexFragmentBinding) ((IIndexScope) raw[j]).getScopeBinding();
|
||||
}
|
||||
}
|
||||
IIndexBinding[] compBinding = cf.getCompositeBindings(preresult);
|
||||
ICPPNamespaceScope[] result = new ICPPNamespaceScope[compBinding.length];
|
||||
for(int i=0; i<result.length; i++) {
|
||||
for (int i= 0; i < result.length; i++) {
|
||||
result[i]= ((ICPPNamespace) compBinding[i]).getNamespaceScope();
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -284,8 +284,8 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
|
|||
}
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
} catch (CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ import org.eclipse.core.runtime.Status;
|
|||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*
|
||||
*/
|
||||
public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCompositeTypeScope, IPDOMMemberOwner, IIndexType, IIndexScope {
|
||||
private static final int MEMBERLIST = PDOMBinding.RECORD_SIZE;
|
||||
|
@ -58,7 +57,7 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom
|
|||
super(linkage, parent, compType.getNameCharArray());
|
||||
setKind(compType);
|
||||
setAnonymous(compType);
|
||||
// linked list is initialized by malloc zeroing allocated storage
|
||||
// Linked list is initialized by malloc zeroing allocated storage.
|
||||
}
|
||||
|
||||
public PDOMCStructure(PDOMLinkage linkage, long record) {
|
||||
|
@ -88,7 +87,6 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom
|
|||
getDB().putByte(record + ANONYMOUS, (byte) (ct.isAnonymous() ? 1 : 0));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void accept(IPDOMVisitor visitor) throws CoreException {
|
||||
super.accept(visitor);
|
||||
|
@ -126,7 +124,7 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom
|
|||
}
|
||||
|
||||
private static class GetFields implements IPDOMVisitor {
|
||||
private final List<IPDOMNode> fields = new ArrayList<IPDOMNode>();
|
||||
private final List<IPDOMNode> fields = new ArrayList<>();
|
||||
@Override
|
||||
public boolean visit(IPDOMNode node) throws CoreException {
|
||||
if (node instanceof IField) {
|
||||
|
@ -156,20 +154,22 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom
|
|||
return fields.getFields();
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return new IField[0];
|
||||
return IField.EMPTY_FIELD_ARRAY;
|
||||
}
|
||||
}
|
||||
|
||||
public static class FindField implements IPDOMVisitor {
|
||||
private IField field;
|
||||
private final String name;
|
||||
|
||||
public FindField(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(IPDOMNode node) throws CoreException {
|
||||
if (node instanceof IField) {
|
||||
IField tField = (IField)node;
|
||||
IField tField = (IField) node;
|
||||
if (IndexFilter.ALL_DECLARED_OR_IMPLICIT.acceptBinding(tField)) {
|
||||
if (name.equals(tField.getName())) {
|
||||
field = tField;
|
||||
|
@ -183,10 +183,14 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void leave(IPDOMNode node) throws CoreException {
|
||||
}
|
||||
public IField getField() { return field; }
|
||||
|
||||
public IField getField() {
|
||||
return field;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -254,7 +258,7 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom
|
|||
|
||||
@Override
|
||||
public void addChild(PDOMNode member) throws CoreException {
|
||||
new PDOMNodeLinkedList(getLinkage(), record+MEMBERLIST).addMember(member);
|
||||
new PDOMNodeLinkedList(getLinkage(), record + MEMBERLIST).addMember(member);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -296,9 +300,9 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom
|
|||
IBinding b= getBinding(name);
|
||||
if (b == null)
|
||||
return IBinding.EMPTY_BINDING_ARRAY;
|
||||
return new IBinding[]{b};
|
||||
return new IBinding[] { b };
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIndexBinding getScopeBinding() {
|
||||
return this;
|
||||
|
|
|
@ -338,7 +338,7 @@ public class ASTManager implements IDisposable {
|
|||
IASTNode node1= ASTInternal.getPhysicalNodeOfScope(s1);
|
||||
IASTNode node2= ASTInternal.getPhysicalNodeOfScope(s2);
|
||||
|
||||
// forward declarations do not have parent scopes.
|
||||
// Forward declarations do not have parent scopes.
|
||||
if (s1 == null) {
|
||||
if (!fileStatic && node2 instanceof IASTTranslationUnit) {
|
||||
return TRUE;
|
||||
|
@ -359,7 +359,7 @@ public class ASTManager implements IDisposable {
|
|||
if (node1 instanceof IASTTranslationUnit && node2 instanceof IASTTranslationUnit) {
|
||||
return hasSameLocation(node1, node2, fileStatic);
|
||||
}
|
||||
|
||||
|
||||
String name1= getName(s1);
|
||||
String name2= getName(s2);
|
||||
|
||||
|
@ -389,7 +389,7 @@ public class ASTManager implements IDisposable {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// classes
|
||||
// Classes.
|
||||
if (s1 instanceof ICPPClassScope || s1 instanceof ICCompositeTypeScope) {
|
||||
if (s2 instanceof ICPPClassScope || s2 instanceof ICCompositeTypeScope) {
|
||||
return isSameScope(s1.getParent(), s2.getParent(), fileStatic);
|
||||
|
@ -606,7 +606,7 @@ public class ASTManager implements IDisposable {
|
|||
}
|
||||
|
||||
private static IType getRealType(IType t) {
|
||||
while(t instanceof ITypedef) {
|
||||
while (t instanceof ITypedef) {
|
||||
t= ((ITypedef) t).getType();
|
||||
}
|
||||
return t;
|
||||
|
@ -758,8 +758,7 @@ public class ASTManager implements IDisposable {
|
|||
|
||||
// eliminate global bindings when looking up in a class type
|
||||
if (removeGlobalsWhenClassScope &&
|
||||
(scope instanceof ICPPClassScope ||
|
||||
scope instanceof ICCompositeTypeScope)) {
|
||||
(scope instanceof ICPPClassScope || scope instanceof ICCompositeTypeScope)) {
|
||||
int count= 0;
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
IBinding binding = result[i];
|
||||
|
@ -772,7 +771,7 @@ public class ASTManager implements IDisposable {
|
|||
}
|
||||
if (count < result.length) {
|
||||
IBinding[] copy= new IBinding[count];
|
||||
int i=0;
|
||||
int i= 0;
|
||||
for (IBinding b : result) {
|
||||
if (b != null) {
|
||||
copy[i++]= b;
|
||||
|
@ -782,7 +781,7 @@ public class ASTManager implements IDisposable {
|
|||
}
|
||||
}
|
||||
|
||||
// try to find constructors
|
||||
// Try to find constructors.
|
||||
if (scope instanceof ICPPBlockScope) {
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
IBinding binding = result[i];
|
||||
|
@ -805,9 +804,6 @@ public class ASTManager implements IDisposable {
|
|||
fArgument= arg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IDisposable#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
Assert.isTrue(!fDisposed, "ASTManager.dispose() called more than once"); //$NON-NLS-1$
|
||||
|
@ -898,17 +894,15 @@ public class ASTManager implements IDisposable {
|
|||
if (!Character.isJavaIdentifierPart(sig[i]))
|
||||
return null;
|
||||
}
|
||||
while(offset > 0) {
|
||||
if (Character.isJavaIdentifierPart(sig[offset-1]))
|
||||
offset--;
|
||||
else
|
||||
while (offset > 0) {
|
||||
if (!Character.isJavaIdentifierPart(sig[offset - 1]))
|
||||
break;
|
||||
offset--;
|
||||
}
|
||||
while(end < sig.length) {
|
||||
if (Character.isJavaIdentifierPart(sig[end]))
|
||||
end++;
|
||||
else
|
||||
while (end < sig.length) {
|
||||
if (!Character.isJavaIdentifierPart(sig[end]))
|
||||
break;
|
||||
end++;
|
||||
}
|
||||
return rawSignature.substring(offset, end);
|
||||
}
|
||||
|
@ -1497,7 +1491,7 @@ public class ASTManager implements IDisposable {
|
|||
|
||||
protected void classifyConflictingBindings(IASTTranslationUnit tu, Set<IBinding> shadows,
|
||||
Collection<IBinding> redecl, Collection<IBinding> barriers, RefactoringStatus status) {
|
||||
// collect bindings on higher or equal level
|
||||
// Collect bindings on higher or equal level.
|
||||
String name= fArgument.getName();
|
||||
IBinding[] newBindingsAboverOrEqual= null;
|
||||
IScope oldBindingsScope= null;
|
||||
|
@ -1523,11 +1517,11 @@ public class ASTManager implements IDisposable {
|
|||
newBindingsAboverOrEqual= IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
|
||||
// check conflicting bindings for being from above or equal level.
|
||||
// Check conflicting bindings for being from above or equal level.
|
||||
for (IBinding conflictingBinding : fConflictingBinding) {
|
||||
if (conflictingBinding != null) {
|
||||
boolean isAboveOrEqual= false;
|
||||
for (int i = 0; !isAboveOrEqual && i<newBindingsAboverOrEqual.length; i++) {
|
||||
for (int i = 0; !isAboveOrEqual && i < newBindingsAboverOrEqual.length; i++) {
|
||||
IBinding aboveBinding = newBindingsAboverOrEqual[i];
|
||||
try {
|
||||
if (isSameBinding(tu.getIndex(), aboveBinding, conflictingBinding) == TRUE) {
|
||||
|
@ -1543,7 +1537,7 @@ public class ASTManager implements IDisposable {
|
|||
}
|
||||
}
|
||||
|
||||
// find bindings on same level
|
||||
// Find bindings on same level.
|
||||
for (IBinding aboveBinding : newBindingsAboverOrEqual) {
|
||||
IScope aboveScope;
|
||||
try {
|
||||
|
|
Loading…
Add table
Reference in a new issue