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

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-08-20 21:30:36 -07:00
parent 30ed2ca8c9
commit 41ee60794f
5 changed files with 102 additions and 103 deletions

View file

@ -111,14 +111,14 @@ abstract class LocationCtx implements ILocationCtx {
* that it is contained in this context.
*/
public ASTFileLocation findMappedFileLocation(int sequenceNumber, int length) {
return fParent.createMappedFileLocation(fOffsetInParent, fEndOffsetInParent-fOffsetInParent);
return fParent.createMappedFileLocation(fOffsetInParent, fEndOffsetInParent - fOffsetInParent);
}
/**
* Returns the file location containing the specified offset range in this context.
*/
public ASTFileLocation createMappedFileLocation(int offset, int length) {
return fParent.createMappedFileLocation(fOffsetInParent, fEndOffsetInParent-fOffsetInParent);
return fParent.createMappedFileLocation(fOffsetInParent, fEndOffsetInParent - fOffsetInParent);
}
/**

View file

@ -56,7 +56,7 @@ class LocationCtxContainer extends LocationCtx {
}
public char[] getSource(int offset, int length) {
if (fSource.isValidOffset(offset+length-1)) {
if (fSource.isValidOffset(offset + length - 1)) {
char[] result= new char[length];
fSource.arraycopy(offset, result, 0, length);
return result;
@ -73,12 +73,11 @@ class LocationCtxContainer extends LocationCtx {
public final int getSequenceNumberForOffset(int offset, boolean checkChildren) {
int result= fSequenceNumber + fChildSequenceLength + offset;
if (checkChildren && fChildren != null) {
for (int i= fChildren.size()-1; i >= 0; i--) {
for (int i= fChildren.size() - 1; i >= 0; i--) {
final LocationCtx child= fChildren.get(i);
if (child.fEndOffsetInParent > offset) { // child was inserted behind the offset, adjust sequence number
result-= child.getSequenceLength();
}
else {
} else {
return result;
}
}
@ -93,7 +92,7 @@ class LocationCtxContainer extends LocationCtx {
@Override
public final LocationCtx findSurroundingContext(int sequenceNumber, int length) {
int testEnd= length > 1 ? sequenceNumber+length-1 : sequenceNumber;
int testEnd= length > 1 ? sequenceNumber + length - 1 : sequenceNumber;
final LocationCtx child= findChildLessOrEqualThan(sequenceNumber, false);
if (child != null && child.fSequenceNumber+child.getSequenceLength() > testEnd) {
return child.findSurroundingContext(sequenceNumber, length);
@ -103,7 +102,7 @@ class LocationCtxContainer extends LocationCtx {
@Override
public final LocationCtxMacroExpansion findEnclosingMacroExpansion(int sequenceNumber, int length) {
int testEnd= length > 1 ? sequenceNumber+length-1 : sequenceNumber;
int testEnd= length > 1 ? sequenceNumber + length - 1 : sequenceNumber;
final LocationCtx child= findChildLessOrEqualThan(sequenceNumber, true);
if (child != null && child.fSequenceNumber+child.getSequenceLength() > testEnd) {
return child.findEnclosingMacroExpansion(sequenceNumber, length);
@ -129,9 +128,9 @@ class LocationCtxContainer extends LocationCtx {
@Override
public ASTFileLocation findMappedFileLocation(int sequenceNumber, int length) {
// try to delegate to a child.
int testEnd= length > 1 ? sequenceNumber+length-1 : sequenceNumber;
int testEnd= length > 1 ? sequenceNumber + length - 1 : sequenceNumber;
final LocationCtx child= findChildLessOrEqualThan(sequenceNumber, false);
if (child != null && child.fSequenceNumber+child.getSequenceLength() > testEnd) {
if (child != null && child.fSequenceNumber + child.getSequenceLength() > testEnd) {
return child.findMappedFileLocation(sequenceNumber, length);
}
return super.findMappedFileLocation(sequenceNumber, length);
@ -139,7 +138,7 @@ class LocationCtxContainer extends LocationCtx {
@Override
public boolean collectLocations(int sequenceNumber, final int length, ArrayList<IASTNodeLocation> locations) {
final int endSequenceNumber= sequenceNumber+length;
final int endSequenceNumber= sequenceNumber + length;
if (fChildren != null) {
int childIdx= Math.max(0, findChildIdxLessOrEqualThan(sequenceNumber, false));
for (; childIdx < fChildren.size(); childIdx++) {
@ -151,18 +150,18 @@ class LocationCtxContainer extends LocationCtx {
final int offset= child.fEndOffsetInParent - (child.fSequenceNumber - sequenceNumber);
// it the child is not affected, we are done.
if (endSequenceNumber <= child.fSequenceNumber) {
addFileLocation(offset, endSequenceNumber-sequenceNumber, locations);
addFileLocation(offset, endSequenceNumber - sequenceNumber, locations);
return true;
}
if (offset < child.fOffsetInParent)
addFileLocation(offset, child.fOffsetInParent-offset, locations);
addFileLocation(offset, child.fOffsetInParent - offset, locations);
sequenceNumber= child.fSequenceNumber;
}
// let the child create locations
final int childEndSequenceNumber= child.fSequenceNumber + child.getSequenceLength();
if (sequenceNumber < childEndSequenceNumber) {
if (child.collectLocations(sequenceNumber, endSequenceNumber-sequenceNumber, locations)) {
if (child.collectLocations(sequenceNumber, endSequenceNumber - sequenceNumber, locations)) {
return true;
}
sequenceNumber= childEndSequenceNumber;
@ -174,10 +173,10 @@ class LocationCtxContainer extends LocationCtx {
final int myEndNumber = fSequenceNumber + getSequenceLength();
final int offset= fSource.getLength() - (myEndNumber - sequenceNumber);
if (endSequenceNumber <= myEndNumber) {
addFileLocation(offset, endSequenceNumber-sequenceNumber, locations);
addFileLocation(offset, endSequenceNumber - sequenceNumber, locations);
return true;
}
addFileLocation(offset, fSource.getLength()-offset, locations);
addFileLocation(offset, fSource.getLength() - offset, locations);
return false;
}
@ -200,20 +199,19 @@ class LocationCtxContainer extends LocationCtx {
int upper= fChildren.size();
int lower= 0;
while (upper > lower) {
int middle= (upper+lower)/2;
int middle= (upper + lower) / 2;
LocationCtx child= fChildren.get(middle);
int childSequenceNumber= child.fSequenceNumber;
if (beforeReplacedChars) {
childSequenceNumber-= child.fEndOffsetInParent-child.fOffsetInParent;
childSequenceNumber-= child.fEndOffsetInParent - child.fOffsetInParent;
}
if (childSequenceNumber <= sequenceNumber) {
lower= middle+1;
}
else {
lower= middle + 1;
} else {
upper= middle;
}
}
return lower-1;
return lower - 1;
}
final LocationCtx findChildLessOrEqualThan(final int sequenceNumber, boolean beforeReplacedChars) {
@ -227,8 +225,7 @@ class LocationCtxContainer extends LocationCtx {
for (LocationCtx ctx : fChildren) {
if (ctx.getInclusionStatement() != null) {
result.add(new ASTInclusionNode(ctx));
}
else {
} else {
ctx.getInclusions(result);
}
}

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.parser.scanner;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroExpansion;
/**
@ -24,9 +25,9 @@ class LocationCtxFile extends LocationCtxContainer {
private final ASTInclusionStatement fASTInclude;
private final boolean fIsSource;
public LocationCtxFile(LocationCtxContainer parent, String filename, AbstractCharArray source, int parentOffset,
int parentEndOffset, int sequenceNumber, ASTInclusionStatement inclusionStatement,
boolean isSource) {
public LocationCtxFile(LocationCtxContainer parent, String filename, AbstractCharArray source,
int parentOffset, int parentEndOffset, int sequenceNumber,
ASTInclusionStatement inclusionStatement, boolean isSource) {
super(parent, source, parentOffset, parentEndOffset, sequenceNumber);
fFilename= new String(filename);
fASTInclude= inclusionStatement;
@ -46,12 +47,14 @@ class LocationCtxFile extends LocationCtxContainer {
@Override
public ASTFileLocation findMappedFileLocation(int sequenceNumber, int length) {
// try to delegate to a child.
final int testEnd= length > 1 ? sequenceNumber+length-1 : sequenceNumber;
final int testEnd= length > 1 ? sequenceNumber + length - 1 : sequenceNumber;
final int sequenceEnd= sequenceNumber+length;
final LocationCtx child1= findChildLessOrEqualThan(sequenceNumber, false);
final LocationCtx child2= testEnd == sequenceNumber ? child1 : findChildLessOrEqualThan(testEnd, false);
final LocationCtx child2= testEnd == sequenceNumber ?
child1 : findChildLessOrEqualThan(testEnd, false);
if (child1 == child2 && child1 != null && child1.fSequenceNumber + child1.getSequenceLength() > testEnd) {
if (child1 == child2 && child1 != null &&
child1.fSequenceNumber + child1.getSequenceLength() > testEnd) {
return child1.findMappedFileLocation(sequenceNumber, length);
}
@ -61,29 +64,25 @@ class LocationCtxFile extends LocationCtxContainer {
if (child1 == null) {
startOffset= sequenceNumber-fSequenceNumber;
}
else {
} else {
int childSequenceEnd= child1.fSequenceNumber + child1.getSequenceLength();
if (sequenceNumber < childSequenceEnd) {
startOffset= child1.fOffsetInParent;
}
else { // start beyond child1
startOffset= child1.fEndOffsetInParent + sequenceNumber-childSequenceEnd;
} else { // start beyond child1
startOffset= child1.fEndOffsetInParent + sequenceNumber - childSequenceEnd;
}
}
if (child2 == null) {
endOffset= sequenceEnd-fSequenceNumber;
}
else {
endOffset= sequenceEnd - fSequenceNumber;
} else {
int childSequenceEnd= child2.fSequenceNumber + child2.getSequenceLength();
if (childSequenceEnd < sequenceEnd) { // beyond child2
endOffset= child2.fEndOffsetInParent+sequenceEnd-childSequenceEnd;
}
else {
endOffset= child2.fEndOffsetInParent + sequenceEnd - childSequenceEnd;
} else {
endOffset= child2.fEndOffsetInParent;
}
}
return new ASTFileLocation(this, startOffset, endOffset-startOffset);
return new ASTFileLocation(this, startOffset, endOffset - startOffset);
}
@Override
@ -109,7 +108,8 @@ class LocationCtxFile extends LocationCtxContainer {
return sequenceNumber >= child.fSequenceNumber + child.getSequenceLength();
}
public void collectMacroExpansions(int offset, int length, ArrayList<IASTPreprocessorMacroExpansion> list) {
public void collectMacroExpansions(int offset, int length,
ArrayList<IASTPreprocessorMacroExpansion> list) {
Collection<LocationCtx> children= getChildren();
for (LocationCtx ctx : children) {
// context must start before the end of the search range
@ -119,7 +119,9 @@ class LocationCtxFile extends LocationCtxContainer {
if (ctx instanceof LocationCtxMacroExpansion) {
// expansion must end after the search start
if (ctx.fEndOffsetInParent > offset) {
list.add((IASTPreprocessorMacroExpansion) ((LocationCtxMacroExpansion)ctx).getMacroReference().getParent());
IASTNode macroExpansion =
((LocationCtxMacroExpansion) ctx).getMacroReference().getParent();
list.add((IASTPreprocessorMacroExpansion) macroExpansion);
}
}
}

View file

@ -46,10 +46,10 @@ class LocationCtxMacroExpansion extends LocationCtx {
@Override
public boolean collectLocations(int start, int length, ArrayList<IASTNodeLocation> locations) {
final int offset= start-fSequenceNumber;
final int offset= start - fSequenceNumber;
assert offset >= 0 && length >= 0;
if (offset+length <= fLength) {
if (offset + length <= fLength) {
locations.add(new ASTMacroExpansionLocation(this, offset, length));
return true;
}
@ -87,18 +87,15 @@ class LocationCtxMacroExpansion extends LocationCtx {
if (info.fTokenOffsetInExpansion == nextToCheck) {
if (firstInfo == null || lastInfo == null) {
firstInfo= lastInfo= info;
}
else if (lastInfo.canConcatenate(info)) {
} else if (lastInfo.canConcatenate(info)) {
lastInfo= info;
}
else {
} else {
return null;
}
if (++nextToCheck == end) {
return firstInfo.createLocation(fLocationMap, lastInfo);
}
}
else if (info.fTokenOffsetInExpansion > nextToCheck) {
} else if (info.fTokenOffsetInExpansion > nextToCheck) {
return null;
}
}
@ -109,5 +106,3 @@ class LocationCtxMacroExpansion extends LocationCtx {
return fLocationMap.getNestedMacroReferences((ASTMacroExpansion) fExpansionName.getParent());
}
}

View file

@ -37,13 +37,11 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTProblem;
import org.eclipse.cdt.internal.core.parser.scanner.Lexer.LexerOptions;
/**
* Converts the offsets relative to various contexts to the global sequence number. Also creates and stores
* objects that are needed to conform with the IAST... interfaces.
* Converts the offsets relative to various contexts to the global sequence number. Also creates
* and stores objects that are needed to conform with the IAST... interfaces.
* @since 5.0
*/
public class LocationMap implements ILocationResolver {
private static final IASTName[] EMPTY_NAMES = {};
private final LexerOptions fLexerOptions;
private String fTranslationUnitPath;
private IASTTranslationUnit fTranslationUnit;
@ -82,8 +80,7 @@ public class LocationMap implements ILocationResolver {
ASTMacroDefinition astmacro;
if (macro.isFunctionStyle()) {
astmacro= new ASTFunctionStyleMacroDefinition(fTranslationUnit, macro, nameloc, expansionOffset);
}
else {
} else {
astmacro= new ASTMacroDefinition(fTranslationUnit, macro, nameloc, expansionOffset);
}
fBuiltinMacros.add(astmacro);
@ -176,10 +173,11 @@ public class LocationMap implements ILocationResolver {
int nameNumber= getSequenceNumberForOffset(nameOffset);
int nameEndNumber= getSequenceNumberForOffset(nameEndOffset);
int endNumber= getSequenceNumberForOffset(endOffset);
final int length= endNumber-nameNumber;
final int length= endNumber - nameNumber;
ASTMacroExpansion expansion= new ASTMacroExpansion(fTranslationUnit, nameNumber, endNumber);
ASTMacroReferenceName explicitRef= new ASTMacroReferenceName(expansion, IASTPreprocessorMacroExpansion.EXPANSION_NAME, nameNumber, nameEndNumber, macro, null);
ASTMacroReferenceName explicitRef= new ASTMacroReferenceName(expansion,
IASTPreprocessorMacroExpansion.EXPANSION_NAME, nameNumber, nameEndNumber, macro, null);
addMacroReference(explicitRef);
for (IASTName implicitMacroReference : implicitMacroReferences) {
ASTMacroReferenceName name = (ASTMacroReferenceName) implicitMacroReference;
@ -188,7 +186,9 @@ public class LocationMap implements ILocationResolver {
addMacroReference(name);
}
LocationCtxMacroExpansion expansionCtx= new LocationCtxMacroExpansion(this, (LocationCtxContainer) fCurrentContext, nameOffset, endOffset, endNumber, contextLength, imageLocations, explicitRef);
LocationCtxMacroExpansion expansionCtx= new LocationCtxMacroExpansion(this,
(LocationCtxContainer) fCurrentContext, nameOffset, endOffset, endNumber,
contextLength, imageLocations, explicitRef);
expansion.setContext(expansionCtx);
fCurrentContext= expansionCtx;
fLastChildInsertionOffset= 0;
@ -232,7 +232,8 @@ public class LocationMap implements ILocationResolver {
nameOffset= getSequenceNumberForOffset(nameOffset);
nameEndOffset= getSequenceNumberForOffset(nameEndOffset);
endOffset= getSequenceNumberForOffset(endOffset);
fDirectives.add(new ASTInclusionStatement(fTranslationUnit, startOffset, nameOffset, nameEndOffset, endOffset, name, filename, userInclude, active, heuristic));
fDirectives.add(new ASTInclusionStatement(fTranslationUnit, startOffset, nameOffset,
nameEndOffset, endOffset, name, filename, userInclude, active, heuristic));
}
public void encounteredComment(int offset, int endOffset, boolean isBlockComment) {
@ -244,7 +245,8 @@ public class LocationMap implements ILocationResolver {
public void encounterProblem(int id, char[] arg, int offset, int endOffset) {
offset= getSequenceNumberForOffset(offset);
endOffset= getSequenceNumberForOffset(endOffset);
ASTProblem problem = new ASTProblem(fTranslationUnit, IASTTranslationUnit.SCANNER_PROBLEM, id, arg, false, offset, endOffset);
ASTProblem problem = new ASTProblem(fTranslationUnit, IASTTranslationUnit.SCANNER_PROBLEM,
id, arg, false, offset, endOffset);
fProblems.add(problem);
}
@ -302,7 +304,8 @@ public class LocationMap implements ILocationResolver {
fDirectives.add(new ASTPragmaOperator(fTranslationUnit, startNumber, condNumber, condEndNumber, endNumber));
}
public ASTIfdef encounterPoundIfdef(int startOffset, int condOffset, int condEndOffset, int endOffset, boolean taken, IMacroBinding macro) {
public ASTIfdef encounterPoundIfdef(int startOffset, int condOffset, int condEndOffset,
int endOffset, boolean taken, IMacroBinding macro) {
startOffset= getSequenceNumberForOffset(startOffset);
condOffset= getSequenceNumberForOffset(condOffset);
condEndOffset= getSequenceNumberForOffset(condEndOffset);
@ -313,7 +316,8 @@ public class LocationMap implements ILocationResolver {
return ifdef;
}
public ASTIfndef encounterPoundIfndef(int startOffset, int condOffset, int condEndOffset, int endOffset, boolean taken, IMacroBinding macro) {
public ASTIfndef encounterPoundIfndef(int startOffset, int condOffset, int condEndOffset,
int endOffset, boolean taken, IMacroBinding macro) {
startOffset= getSequenceNumberForOffset(startOffset);
condOffset= getSequenceNumberForOffset(condOffset);
condEndOffset= getSequenceNumberForOffset(condEndOffset);
@ -324,8 +328,8 @@ public class LocationMap implements ILocationResolver {
return ifndef;
}
public ASTIf encounterPoundIf(int startOffset, int condOffset, int condEndOffset, int endOffset, boolean taken,
IASTName[] macrosInDefinedExpression) {
public ASTIf encounterPoundIf(int startOffset, int condOffset, int condEndOffset, int endOffset,
boolean taken, IASTName[] macrosInDefinedExpression) {
startOffset= getSequenceNumberForOffset(startOffset);
condOffset= getSequenceNumberForOffset(condOffset);
condEndOffset= getSequenceNumberForOffset(condEndOffset);
@ -341,7 +345,8 @@ public class LocationMap implements ILocationResolver {
return astif;
}
public void encounterPoundDefine(int startOffset, int nameOffset, int nameEndOffset, int expansionOffset, int endOffset, boolean isActive, IMacroBinding macrodef) {
public void encounterPoundDefine(int startOffset, int nameOffset, int nameEndOffset,
int expansionOffset, int endOffset, boolean isActive, IMacroBinding macrodef) {
startOffset= getSequenceNumberForOffset(startOffset);
nameOffset= getSequenceNumberForOffset(nameOffset);
nameEndOffset= getSequenceNumberForOffset(nameEndOffset);
@ -349,20 +354,23 @@ public class LocationMap implements ILocationResolver {
endOffset= getSequenceNumberForOffset(endOffset);
ASTPreprocessorNode astMacro;
if (!macrodef.isFunctionStyle()) {
astMacro= new ASTMacroDefinition(fTranslationUnit, macrodef, startOffset, nameOffset, nameEndOffset, expansionOffset, endOffset, isActive);
}
else {
astMacro= new ASTFunctionStyleMacroDefinition(fTranslationUnit, macrodef, startOffset, nameOffset, nameEndOffset, expansionOffset, endOffset, isActive);
astMacro= new ASTMacroDefinition(fTranslationUnit, macrodef, startOffset, nameOffset,
nameEndOffset, expansionOffset, endOffset, isActive);
} else {
astMacro= new ASTFunctionStyleMacroDefinition(fTranslationUnit, macrodef, startOffset,
nameOffset, nameEndOffset, expansionOffset, endOffset, isActive);
}
fDirectives.add(astMacro);
}
public void encounterPoundUndef(IMacroBinding definition, int startOffset, int nameOffset, int nameEndOffset, int endOffset, char[] name, boolean isActive) {
public void encounterPoundUndef(IMacroBinding definition, int startOffset, int nameOffset,
int nameEndOffset, int endOffset, char[] name, boolean isActive) {
startOffset= getSequenceNumberForOffset(startOffset);
nameOffset= getSequenceNumberForOffset(nameOffset);
nameEndOffset= getSequenceNumberForOffset(nameEndOffset);
// not using endOffset, compatible with 4.0: endOffset= getSequenceNumberForOffset(endOffset);
final ASTUndef undef = new ASTUndef(fTranslationUnit, name, startOffset, nameOffset, nameEndOffset, definition, isActive);
final ASTUndef undef = new ASTUndef(fTranslationUnit, name, startOffset, nameOffset,
nameEndOffset, definition, isActive);
fDirectives.add(undef);
addMacroReference(undef.getMacroName());
}
@ -462,7 +470,7 @@ public class LocationMap implements ILocationResolver {
int length= 0;
if (nodeLength > 0) {
length= getSequenceNumberForFileOffset(fileName, nodeOffset + nodeLength-1)+1 - sequenceNumber;
length= getSequenceNumberForFileOffset(fileName, nodeOffset + nodeLength - 1) + 1 - sequenceNumber;
if (length < 0) {
return null;
}
@ -506,7 +514,7 @@ public class LocationMap implements ILocationResolver {
// check directives
int from= findLastNodeBefore(fDirectives, sequenceStart);
for (int i= from+1; i < fDirectives.size(); i++) {
for (int i= from + 1; i < fDirectives.size(); i++) {
ASTPreprocessorNode directive= fDirectives.get(i);
if (directive.getOffset() > sequenceEnd) {
break;
@ -516,7 +524,7 @@ public class LocationMap implements ILocationResolver {
// check macro references and expansions
from= findLastMacroReferenceBefore(fMacroReferences, sequenceStart);
for (int i= from+1; i < fMacroReferences.size(); i++) {
for (int i= from + 1; i < fMacroReferences.size(); i++) {
ASTPreprocessorNode macroRef= fMacroReferences.get(i);
if (macroRef.getOffset() > sequenceEnd) {
break;
@ -552,15 +560,14 @@ public class LocationMap implements ILocationResolver {
}
private int findLastNodeBefore(ArrayList<? extends ASTPreprocessorNode> nodes, int sequenceStart) {
int lower=-1;
int upper= nodes.size()-1;
while(lower < upper) {
int middle= (lower+upper+1)/2;
int lower= -1;
int upper= nodes.size() - 1;
while (lower < upper) {
int middle= (lower + upper + 1) / 2;
ASTPreprocessorNode candidate= nodes.get(middle);
if (candidate.getOffset() + candidate.getLength() >= sequenceStart) {
upper= middle-1;
}
else {
upper= middle - 1;
} else {
lower= middle;
}
}
@ -568,19 +575,18 @@ public class LocationMap implements ILocationResolver {
}
private int findLastMacroReferenceBefore(ArrayList<? extends ASTPreprocessorName> nodes, int sequenceStart) {
int lower=-1;
int upper= nodes.size()-1;
while(lower < upper) {
int middle= (lower+upper+1)/2;
int lower= -1;
int upper= nodes.size() - 1;
while (lower < upper) {
int middle= (lower + upper + 1) / 2;
ASTPreprocessorNode candidate= nodes.get(middle);
IASTNode parent= candidate.getParent();
if (parent instanceof ASTMacroExpansion) {
candidate= (ASTMacroExpansion) parent;
}
if (candidate.getOffset() + candidate.getLength() >= sequenceStart) {
upper= middle-1;
}
else {
upper= middle - 1;
} else {
lower= middle;
}
}
@ -591,7 +597,7 @@ public class LocationMap implements ILocationResolver {
LocationCtx ctx= fRootContext;
if (filePath != null) {
LinkedList<LocationCtx> contexts= new LinkedList<LocationCtx>();
while(ctx != null) {
while (ctx != null) {
if (ctx instanceof LocationCtxFile) {
if (filePath.equals(ctx.getFilePath())) {
break;
@ -600,8 +606,7 @@ public class LocationMap implements ILocationResolver {
contexts.addAll(ctx.getChildren());
if (contexts.isEmpty()) {
ctx= null;
}
else {
} else {
ctx= contexts.removeFirst();
}
}
@ -617,7 +622,7 @@ public class LocationMap implements ILocationResolver {
return null;
}
IASTFileLocation from= locations[0].asFileLocation();
IASTFileLocation to= locations[locations.length-1].asFileLocation();
IASTFileLocation to= locations[locations.length - 1].asFileLocation();
if (from == to) {
return from;
}
@ -676,7 +681,7 @@ public class LocationMap implements ILocationResolver {
public IASTName[] getDeclarations(IMacroBinding binding) {
IASTPreprocessorMacroDefinition def = getMacroDefinition(binding);
return def == null ? EMPTY_NAMES : new IASTName[] {def.getName()};
return def == null ? IASTName.EMPTY_NAME_ARRAY: new IASTName[] { def.getName() };
}
IASTPreprocessorMacroDefinition getMacroDefinition(IMacroBinding binding) {