mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Deprecated methods in IASTTranslationUnit.
This commit is contained in:
parent
981ddadee0
commit
b3d789e035
6 changed files with 16 additions and 39 deletions
|
@ -120,20 +120,9 @@ public interface IASTTranslationUnit extends IASTNode, IAdaptable {
|
||||||
* @param offset sequence number as stored in the ast nodes.
|
* @param offset sequence number as stored in the ast nodes.
|
||||||
* @param length
|
* @param length
|
||||||
* @return and array of locations.
|
* @return and array of locations.
|
||||||
|
* @deprecated the offsets needed for this method are not accessible via public API.
|
||||||
*/
|
*/
|
||||||
public IASTNodeLocation[] getLocationInfo(int offset, int length);
|
public IASTNodeLocation[] getLocationInfo(int offset, int length);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the smallest file location, that encloses the given global range. In case the range
|
|
||||||
* spans over multiple files, the files are mapped to include statements until all of them are
|
|
||||||
* found in the same file. So the resulting location contains the include directives that actually
|
|
||||||
* cause the range to be part of the AST.
|
|
||||||
* @param offset sequence number as stored in the ASTNodes.
|
|
||||||
* @param length
|
|
||||||
* @return a file location
|
|
||||||
* @since 5.0
|
|
||||||
*/
|
|
||||||
public IASTFileLocation getMappedFileLocation(int offset, int length);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select the node in the treet that best fits the offset/length/file path.
|
* Select the node in the treet that best fits the offset/length/file path.
|
||||||
|
@ -202,7 +191,6 @@ public interface IASTTranslationUnit extends IASTNode, IAdaptable {
|
||||||
*
|
*
|
||||||
* @param nodeLocations <code>IASTNodeLocation</code>s to flatten
|
* @param nodeLocations <code>IASTNodeLocation</code>s to flatten
|
||||||
* @return null if not possible, otherwise, a file location representing where the macros are.
|
* @return null if not possible, otherwise, a file location representing where the macros are.
|
||||||
* @deprecated use {@link #getMappedFileLocation(int, int)}
|
|
||||||
*/
|
*/
|
||||||
public IASTFileLocation flattenLocationsToFile( IASTNodeLocation [] nodeLocations );
|
public IASTFileLocation flattenLocationsToFile( IASTNodeLocation [] nodeLocations );
|
||||||
|
|
||||||
|
|
|
@ -82,9 +82,16 @@ public abstract class ASTNode implements IASTNode {
|
||||||
public IASTNodeLocation[] getNodeLocations() {
|
public IASTNodeLocation[] getNodeLocations() {
|
||||||
if (locations != null)
|
if (locations != null)
|
||||||
return locations;
|
return locations;
|
||||||
if (length == 0)
|
if (length == 0) {
|
||||||
return EMPTY_LOCATION_ARRAY;
|
locations= EMPTY_LOCATION_ARRAY;
|
||||||
locations = getTranslationUnit().getLocationInfo(offset, length);
|
}
|
||||||
|
final IASTTranslationUnit tu= getTranslationUnit();
|
||||||
|
if (tu != null) {
|
||||||
|
org.eclipse.cdt.internal.core.parser.scanner2.ILocationResolver l= (org.eclipse.cdt.internal.core.parser.scanner2.ILocationResolver) tu.getAdapter(org.eclipse.cdt.internal.core.parser.scanner2.ILocationResolver.class);
|
||||||
|
if (l != null) {
|
||||||
|
locations= l.getLocations(offset, length);
|
||||||
|
}
|
||||||
|
}
|
||||||
return locations;
|
return locations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -558,14 +558,6 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTFileLocation getMappedFileLocation(int offset, int length) {
|
|
||||||
if (resolver instanceof org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver) {
|
|
||||||
org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver r2= (org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver) resolver;
|
|
||||||
return r2.getMappedFileLocation(offset, length);
|
|
||||||
}
|
|
||||||
return flattenLocationsToFile(getLocationInfo(offset, length));
|
|
||||||
}
|
|
||||||
|
|
||||||
public IASTFileLocation flattenLocationsToFile(IASTNodeLocation[] nodeLocations) {
|
public IASTFileLocation flattenLocationsToFile(IASTNodeLocation[] nodeLocations) {
|
||||||
if( resolver == null )
|
if( resolver == null )
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -509,14 +509,6 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTFileLocation getMappedFileLocation(int offset, int length) {
|
|
||||||
if (resolver instanceof org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver) {
|
|
||||||
org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver r2= (org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver) resolver;
|
|
||||||
return r2.getMappedFileLocation(offset, length);
|
|
||||||
}
|
|
||||||
return flattenLocationsToFile(getLocationInfo(offset, length));
|
|
||||||
}
|
|
||||||
|
|
||||||
public IASTFileLocation flattenLocationsToFile(IASTNodeLocation[] nodeLocations) {
|
public IASTFileLocation flattenLocationsToFile(IASTNodeLocation[] nodeLocations) {
|
||||||
if( resolver == null )
|
if( resolver == null )
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -68,9 +68,6 @@ abstract class ASTPreprocessorNode extends ASTNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTNodeLocation[] getNodeLocations() {
|
public IASTNodeLocation[] getNodeLocations() {
|
||||||
if (getLength() == 0) {
|
|
||||||
return getTranslationUnit().getLocationInfo(getOffset(), 0);
|
|
||||||
}
|
|
||||||
return super.getNodeLocations();
|
return super.getNodeLocations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -414,6 +414,11 @@ public class LocationMap implements ILocationResolver {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mstodo implement
|
||||||
|
public IASTFileLocation flattenLocations(IASTNodeLocation[] locations) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public IASTPreprocessorMacroDefinition[] getMacroDefinitions() {
|
public IASTPreprocessorMacroDefinition[] getMacroDefinitions() {
|
||||||
ArrayList result= new ArrayList();
|
ArrayList result= new ArrayList();
|
||||||
|
@ -497,10 +502,6 @@ public class LocationMap implements ILocationResolver {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
// mstodo- scanner removal
|
// mstodo- scanner removal
|
||||||
public IASTFileLocation flattenLocations(IASTNodeLocation[] locations) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
// mstodo- scanner removal
|
|
||||||
public IASTName[] getMacroExpansions() {
|
public IASTName[] getMacroExpansions() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue