mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56: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 {
|
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.
|
* and that matches the given name.
|
||||||
*/
|
*/
|
||||||
public IBinding getBinding(char[] 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
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public ICompositeType getCompositeType();
|
public ICompositeType getCompositeType();
|
||||||
|
|
|
@ -131,8 +131,8 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
public IASTTranslationUnit getASTTranslationUnit(org.eclipse.cdt.core.parser.CodeReader reader,
|
public IASTTranslationUnit getASTTranslationUnit(org.eclipse.cdt.core.parser.CodeReader reader,
|
||||||
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory codeReaderFactory,
|
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory codeReaderFactory,
|
||||||
IIndex index, int options, IParserLogService log) throws CoreException {
|
IIndex index, int options, IParserLogService log) throws CoreException {
|
||||||
return getASTTranslationUnit(FileContent.adapt(reader), scanInfo, IncludeFileContentProvider
|
return getASTTranslationUnit(FileContent.adapt(reader), scanInfo,
|
||||||
.adapt(codeReaderFactory), index, options, log);
|
IncludeFileContentProvider.adapt(codeReaderFactory), index, options, log);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -178,7 +178,7 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
if (scanner.getLocationResolver() != null)
|
if (scanner.getLocationResolver() != null)
|
||||||
tuName = scanner.getLocationResolver().getTranslationUnitPath();
|
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;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -241,7 +241,8 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
||||||
* @return an instance of ISourceCodeParser
|
* @return an instance of ISourceCodeParser
|
||||||
* @since 5.6
|
* @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);
|
ParserMode mode = createParserMode(forCompletion, options);
|
||||||
return createParser(scanner, mode, log, index, options, settings);
|
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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -149,24 +150,24 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
|
||||||
return ParserLanguage.CPP;
|
return ParserLanguage.CPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getLinkage()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ILinkage getLinkage() {
|
public ILinkage getLinkage() {
|
||||||
return Linkage.CPP_LINKAGE;
|
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
|
@Override
|
||||||
public void skippedFile(int offset, InternalFileContent fileContent) {
|
public void skippedFile(int offset, InternalFileContent fileContent) {
|
||||||
super.skippedFile(offset, fileContent);
|
super.skippedFile(offset, fileContent);
|
||||||
fScopeMapper.registerAdditionalDirectives(offset, fileContent.getUsingDirectives());
|
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) {
|
public IScope mapToASTScope(IScope scope) {
|
||||||
if (scope instanceof IIndexScope) {
|
if (scope instanceof IIndexScope) {
|
||||||
return fScopeMapper.mapToASTScope((IIndexScope) scope);
|
return fScopeMapper.mapToASTScope((IIndexScope) scope);
|
||||||
|
@ -174,7 +175,14 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
|
||||||
return scope;
|
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) {
|
public ICPPClassType mapToAST(ICPPClassType binding, IASTNode point) {
|
||||||
return fScopeMapper.mapToAST(binding, point);
|
return fScopeMapper.mapToAST(binding, point);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
* Represents a using-directive found in the AST.
|
* Represents a using-directive found in the AST.
|
||||||
*/
|
*/
|
||||||
public class CPPUsingDirective implements ICPPUsingDirective {
|
public class CPPUsingDirective implements ICPPUsingDirective {
|
||||||
|
|
||||||
private IASTName fNamespaceName;
|
private IASTName fNamespaceName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,9 +42,6 @@ public class CPPUsingDirective implements ICPPUsingDirective {
|
||||||
fNamespaceName= nsdef.getName();
|
fNamespaceName= nsdef.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective#getNamespaceScope()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPNamespaceScope getNominatedScope() throws DOMException {
|
public ICPPNamespaceScope getNominatedScope() throws DOMException {
|
||||||
IBinding binding= fNamespaceName.resolveBinding();
|
IBinding binding= fNamespaceName.resolveBinding();
|
||||||
|
@ -55,18 +51,12 @@ public class CPPUsingDirective implements ICPPUsingDirective {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective#getPointOfDeclaration()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int getPointOfDeclaration() {
|
public int getPointOfDeclaration() {
|
||||||
final ASTNode astNode = (ASTNode) fNamespaceName;
|
final ASTNode astNode = (ASTNode) fNamespaceName;
|
||||||
return astNode.getOffset() + astNode.getLength();
|
return astNode.getOffset() + astNode.getLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDirective#getContainingScope()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getContainingScope() {
|
public IScope getContainingScope() {
|
||||||
return CPPVisitor.getContainingScope(fNamespaceName);
|
return CPPVisitor.getContainingScope(fNamespaceName);
|
||||||
|
|
|
@ -1005,14 +1005,14 @@ public class CPPSemantics {
|
||||||
|
|
||||||
// Nominate using-directives found in this block or namespace.
|
// Nominate using-directives found in this block or namespace.
|
||||||
if (scope instanceof ICPPNamespaceScope) {
|
if (scope instanceof ICPPNamespaceScope) {
|
||||||
final ICPPNamespaceScope blockScope= (ICPPNamespaceScope) scope;
|
final ICPPNamespaceScope namespaceScope= (ICPPNamespaceScope) scope;
|
||||||
|
|
||||||
if (data.qualified && blockScope.getKind() != EScopeKind.eLocal) {
|
if (data.qualified && namespaceScope.getKind() != EScopeKind.eLocal) {
|
||||||
lookupInlineNamespaces(data, blockScope);
|
lookupInlineNamespaces(data, namespaceScope);
|
||||||
}
|
}
|
||||||
if (data.contentAssist || !data.hasResults() || !data.qualified) {
|
if (data.contentAssist || !data.hasResults() || !data.qualified) {
|
||||||
// Nominate namespaces
|
// Nominate namespaces
|
||||||
nominateNamespaces(data, blockScope);
|
nominateNamespaces(data, namespaceScope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.IIndexBinding;
|
||||||
import org.eclipse.cdt.core.index.IIndexName;
|
import org.eclipse.cdt.core.index.IIndexName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for scopes returned via the index
|
* Interface for scopes returned via the index
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
|
@ -24,12 +23,12 @@ public interface IIndexScope extends IScope {
|
||||||
IIndexScope[] EMPTY_INDEX_SCOPE_ARRAY = {};
|
IIndexScope[] EMPTY_INDEX_SCOPE_ARRAY = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the binding associated with scope
|
* Returns the binding associated with the scope.
|
||||||
*/
|
*/
|
||||||
IIndexBinding getScopeBinding();
|
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
|
@Override
|
||||||
IIndexScope getParent();
|
IIndexScope getParent();
|
||||||
|
|
|
@ -38,7 +38,9 @@ public abstract class CompositeScope implements IIndexScope {
|
||||||
protected final IIndexFragmentBinding rbinding;
|
protected final IIndexFragmentBinding rbinding;
|
||||||
|
|
||||||
public CompositeScope(ICompositesFactory cf, 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();
|
throw new NullPointerException();
|
||||||
this.cf = cf;
|
this.cf = cf;
|
||||||
this.rbinding = rbinding;
|
this.rbinding = rbinding;
|
||||||
|
@ -66,7 +68,6 @@ public abstract class CompositeScope implements IIndexScope {
|
||||||
throw new CompositingNotImplementedError();
|
throw new CompositingNotImplementedError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IBinding getRawScopeBinding() {
|
public IBinding getRawScopeBinding() {
|
||||||
return rbinding;
|
return rbinding;
|
||||||
}
|
}
|
||||||
|
@ -84,8 +85,7 @@ public abstract class CompositeScope implements IIndexScope {
|
||||||
return binding;
|
return binding;
|
||||||
} else if (binding instanceof CPPCompositeBinding /* AST composite */) {
|
} else if (binding instanceof CPPCompositeBinding /* AST composite */) {
|
||||||
return new CPPCompositeBinding(
|
return new CPPCompositeBinding(
|
||||||
processUncertainBindings(((CPPCompositeBinding) binding).getBindings())
|
processUncertainBindings(((CPPCompositeBinding) binding).getBindings()));
|
||||||
);
|
|
||||||
} else if (binding instanceof CPPUsingDeclaration) {
|
} else if (binding instanceof CPPUsingDeclaration) {
|
||||||
return binding;
|
return binding;
|
||||||
} else if (binding == null) {
|
} 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)}
|
* A convenience method for processing an array of bindings with
|
||||||
* Returns an empty array if the input parameter is null
|
* {@link CompositeScope#processUncertainBinding(IBinding)}.
|
||||||
|
* Returns an empty array if the input parameter is null.
|
||||||
|
*
|
||||||
* @param frgBindings
|
* @param frgBindings
|
||||||
* @return a non-null IBinding[]
|
* @return a non-null IBinding[]
|
||||||
*/
|
*/
|
||||||
|
@ -125,7 +127,7 @@ 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.
|
* in order to prevent infinite loops.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,7 +139,7 @@ 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.
|
* in order to prevent infinite loops.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -46,9 +46,6 @@ public class CCompositesFactory extends AbstractCompositeFactory {
|
||||||
super(index);
|
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
|
@Override
|
||||||
public IIndexScope getCompositeScope(IIndexScope rscope) {
|
public IIndexScope getCompositeScope(IIndexScope rscope) {
|
||||||
if (rscope == null)
|
if (rscope == null)
|
||||||
|
@ -61,12 +58,8 @@ public class CCompositesFactory extends AbstractCompositeFactory {
|
||||||
throw new CompositingNotImplementedError();
|
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
|
@Override
|
||||||
public IType getCompositeType(IType rtype) {
|
public IType getCompositeType(IType rtype) {
|
||||||
|
|
||||||
if (rtype instanceof IIndexFragmentBinding) {
|
if (rtype instanceof IIndexFragmentBinding) {
|
||||||
return (IType) getCompositeBinding((IIndexFragmentBinding) rtype);
|
return (IType) getCompositeBinding((IIndexFragmentBinding) rtype);
|
||||||
}
|
}
|
||||||
|
@ -159,7 +152,7 @@ public class CCompositesFactory extends AbstractCompositeFactory {
|
||||||
} else if (rbinding instanceof IIndexMacroContainer) {
|
} else if (rbinding instanceof IIndexMacroContainer) {
|
||||||
result= new CompositeMacroContainer(this, rbinding);
|
result= new CompositeMacroContainer(this, rbinding);
|
||||||
} else {
|
} 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;
|
return result;
|
||||||
|
|
|
@ -102,9 +102,6 @@ class CompositeCPPNamespaceScope extends CompositeScope implements ICPPNamespace
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope#getInlineNamespaces()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPNamespaceScope[] getInlineNamespaces() {
|
public ICPPNamespaceScope[] getInlineNamespaces() {
|
||||||
IIndexFragmentBinding[][] preresult = new IIndexFragmentBinding[namespaces.length][];
|
IIndexFragmentBinding[][] preresult = new IIndexFragmentBinding[namespaces.length][];
|
||||||
|
|
|
@ -284,8 +284,8 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
} catch (CoreException ce) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(ce);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,6 @@ import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCompositeTypeScope, IPDOMMemberOwner, IIndexType, IIndexScope {
|
public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCompositeTypeScope, IPDOMMemberOwner, IIndexType, IIndexScope {
|
||||||
private static final int MEMBERLIST = PDOMBinding.RECORD_SIZE;
|
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());
|
super(linkage, parent, compType.getNameCharArray());
|
||||||
setKind(compType);
|
setKind(compType);
|
||||||
setAnonymous(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) {
|
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));
|
getDB().putByte(record + ANONYMOUS, (byte) (ct.isAnonymous() ? 1 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(IPDOMVisitor visitor) throws CoreException {
|
public void accept(IPDOMVisitor visitor) throws CoreException {
|
||||||
super.accept(visitor);
|
super.accept(visitor);
|
||||||
|
@ -126,7 +124,7 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class GetFields implements IPDOMVisitor {
|
private static class GetFields implements IPDOMVisitor {
|
||||||
private final List<IPDOMNode> fields = new ArrayList<IPDOMNode>();
|
private final List<IPDOMNode> fields = new ArrayList<>();
|
||||||
@Override
|
@Override
|
||||||
public boolean visit(IPDOMNode node) throws CoreException {
|
public boolean visit(IPDOMNode node) throws CoreException {
|
||||||
if (node instanceof IField) {
|
if (node instanceof IField) {
|
||||||
|
@ -156,16 +154,18 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom
|
||||||
return fields.getFields();
|
return fields.getFields();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
return new IField[0];
|
return IField.EMPTY_FIELD_ARRAY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class FindField implements IPDOMVisitor {
|
public static class FindField implements IPDOMVisitor {
|
||||||
private IField field;
|
private IField field;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public FindField(String name) {
|
public FindField(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean visit(IPDOMNode node) throws CoreException {
|
public boolean visit(IPDOMNode node) throws CoreException {
|
||||||
if (node instanceof IField) {
|
if (node instanceof IField) {
|
||||||
|
@ -183,10 +183,14 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void leave(IPDOMNode node) throws CoreException {
|
public void leave(IPDOMNode node) throws CoreException {
|
||||||
}
|
}
|
||||||
public IField getField() { return field; }
|
|
||||||
|
public IField getField() {
|
||||||
|
return field;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -338,7 +338,7 @@ public class ASTManager implements IDisposable {
|
||||||
IASTNode node1= ASTInternal.getPhysicalNodeOfScope(s1);
|
IASTNode node1= ASTInternal.getPhysicalNodeOfScope(s1);
|
||||||
IASTNode node2= ASTInternal.getPhysicalNodeOfScope(s2);
|
IASTNode node2= ASTInternal.getPhysicalNodeOfScope(s2);
|
||||||
|
|
||||||
// forward declarations do not have parent scopes.
|
// Forward declarations do not have parent scopes.
|
||||||
if (s1 == null) {
|
if (s1 == null) {
|
||||||
if (!fileStatic && node2 instanceof IASTTranslationUnit) {
|
if (!fileStatic && node2 instanceof IASTTranslationUnit) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -389,7 +389,7 @@ public class ASTManager implements IDisposable {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// classes
|
// Classes.
|
||||||
if (s1 instanceof ICPPClassScope || s1 instanceof ICCompositeTypeScope) {
|
if (s1 instanceof ICPPClassScope || s1 instanceof ICCompositeTypeScope) {
|
||||||
if (s2 instanceof ICPPClassScope || s2 instanceof ICCompositeTypeScope) {
|
if (s2 instanceof ICPPClassScope || s2 instanceof ICCompositeTypeScope) {
|
||||||
return isSameScope(s1.getParent(), s2.getParent(), fileStatic);
|
return isSameScope(s1.getParent(), s2.getParent(), fileStatic);
|
||||||
|
@ -758,8 +758,7 @@ public class ASTManager implements IDisposable {
|
||||||
|
|
||||||
// eliminate global bindings when looking up in a class type
|
// eliminate global bindings when looking up in a class type
|
||||||
if (removeGlobalsWhenClassScope &&
|
if (removeGlobalsWhenClassScope &&
|
||||||
(scope instanceof ICPPClassScope ||
|
(scope instanceof ICPPClassScope || scope instanceof ICCompositeTypeScope)) {
|
||||||
scope instanceof ICCompositeTypeScope)) {
|
|
||||||
int count= 0;
|
int count= 0;
|
||||||
for (int i = 0; i < result.length; i++) {
|
for (int i = 0; i < result.length; i++) {
|
||||||
IBinding binding = result[i];
|
IBinding binding = result[i];
|
||||||
|
@ -782,7 +781,7 @@ public class ASTManager implements IDisposable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to find constructors
|
// Try to find constructors.
|
||||||
if (scope instanceof ICPPBlockScope) {
|
if (scope instanceof ICPPBlockScope) {
|
||||||
for (int i = 0; i < result.length; i++) {
|
for (int i = 0; i < result.length; i++) {
|
||||||
IBinding binding = result[i];
|
IBinding binding = result[i];
|
||||||
|
@ -805,9 +804,6 @@ public class ASTManager implements IDisposable {
|
||||||
fArgument= arg;
|
fArgument= arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see IDisposable#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
Assert.isTrue(!fDisposed, "ASTManager.dispose() called more than once"); //$NON-NLS-1$
|
Assert.isTrue(!fDisposed, "ASTManager.dispose() called more than once"); //$NON-NLS-1$
|
||||||
|
@ -899,16 +895,14 @@ public class ASTManager implements IDisposable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
while (offset > 0) {
|
while (offset > 0) {
|
||||||
if (Character.isJavaIdentifierPart(sig[offset-1]))
|
if (!Character.isJavaIdentifierPart(sig[offset - 1]))
|
||||||
offset--;
|
|
||||||
else
|
|
||||||
break;
|
break;
|
||||||
|
offset--;
|
||||||
}
|
}
|
||||||
while (end < sig.length) {
|
while (end < sig.length) {
|
||||||
if (Character.isJavaIdentifierPart(sig[end]))
|
if (!Character.isJavaIdentifierPart(sig[end]))
|
||||||
end++;
|
|
||||||
else
|
|
||||||
break;
|
break;
|
||||||
|
end++;
|
||||||
}
|
}
|
||||||
return rawSignature.substring(offset, end);
|
return rawSignature.substring(offset, end);
|
||||||
}
|
}
|
||||||
|
@ -1497,7 +1491,7 @@ public class ASTManager implements IDisposable {
|
||||||
|
|
||||||
protected void classifyConflictingBindings(IASTTranslationUnit tu, Set<IBinding> shadows,
|
protected void classifyConflictingBindings(IASTTranslationUnit tu, Set<IBinding> shadows,
|
||||||
Collection<IBinding> redecl, Collection<IBinding> barriers, RefactoringStatus status) {
|
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();
|
String name= fArgument.getName();
|
||||||
IBinding[] newBindingsAboverOrEqual= null;
|
IBinding[] newBindingsAboverOrEqual= null;
|
||||||
IScope oldBindingsScope= null;
|
IScope oldBindingsScope= null;
|
||||||
|
@ -1523,7 +1517,7 @@ public class ASTManager implements IDisposable {
|
||||||
newBindingsAboverOrEqual= IBinding.EMPTY_BINDING_ARRAY;
|
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) {
|
for (IBinding conflictingBinding : fConflictingBinding) {
|
||||||
if (conflictingBinding != null) {
|
if (conflictingBinding != null) {
|
||||||
boolean isAboveOrEqual= false;
|
boolean isAboveOrEqual= false;
|
||||||
|
@ -1543,7 +1537,7 @@ public class ASTManager implements IDisposable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// find bindings on same level
|
// Find bindings on same level.
|
||||||
for (IBinding aboveBinding : newBindingsAboverOrEqual) {
|
for (IBinding aboveBinding : newBindingsAboverOrEqual) {
|
||||||
IScope aboveScope;
|
IScope aboveScope;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue