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

Removed warnings.

This commit is contained in:
John Camelon 2004-04-25 05:30:52 +00:00
parent b87154d43c
commit 94bfaa41cf
14 changed files with 80 additions and 87 deletions

View file

@ -51,22 +51,22 @@ public class ContextualParser extends CompleteParser {
super(scanner, callback, language, log, extension );
}
protected IASTScope scope;
protected IASTScope contextualScope;
/**
* @return
*/
protected IASTScope getCompletionScope() {
return scope;
return contextualScope;
}
protected CompletionKind kind;
protected CompletionKind completionKind;
/**
* @return
*/
protected IASTCompletionNode.CompletionKind getCompletionKind() {
return kind;
return completionKind;
}
protected IASTNode context;
@ -93,7 +93,7 @@ public class ContextualParser extends CompleteParser {
}
protected void setCompletionKind(IASTCompletionNode.CompletionKind kind) {
this.kind = kind;
this.completionKind = kind;
}
/**
@ -176,7 +176,7 @@ public class ContextualParser extends CompleteParser {
}
protected void setCompletionScope(IASTScope scope) {
this.scope = scope;
this.contextualScope = scope;
}
/* (non-Javadoc)

View file

@ -346,9 +346,9 @@ public class DeclarationWrapper implements IDeclaratorOwner
/**
* @param requestor
*/
public List createASTNodes(IASTFactory astFactory) throws ASTSemanticException, BacktrackException
public List createASTNodes(IASTFactory astFactoryToWorkWith) throws ASTSemanticException, BacktrackException
{
this.astFactory = astFactory;
this.astFactory = astFactoryToWorkWith;
Iterator i = declarators.iterator();
List l = new ArrayList();
while (i.hasNext())
@ -360,13 +360,11 @@ public class DeclarationWrapper implements IDeclaratorOwner
*/
private IASTDeclaration createASTNode(Declarator declarator) throws ASTSemanticException, BacktrackException
{
IASTScope scope = getScope();
boolean isWithinClass = false;//(getScope() instanceof IASTClassSpecifier); //TODO fix this for COMPLETE_PARSE
if( scope instanceof IASTClassSpecifier ){
if( getScope() instanceof IASTClassSpecifier ){
isWithinClass = true;
} else if ( scope instanceof IASTTemplateDeclaration ){
isWithinClass = (((IASTTemplateDeclaration)scope).getOwnerScope() instanceof IASTClassSpecifier);
} else if ( getScope() instanceof IASTTemplateDeclaration ){
isWithinClass = (((IASTTemplateDeclaration)getScope()).getOwnerScope() instanceof IASTClassSpecifier);
}
boolean isFunction = declarator.isFunction();
@ -445,18 +443,18 @@ public class DeclarationWrapper implements IDeclaratorOwner
convertedParms,
(ASTPointerOperator)i.next());
ITokenDuple name = ( d.getPointerOperatorNameDuple() != null ) ? new TokenDuple( d.getPointerOperatorNameDuple(), d.getNameDuple() ) : d.getNameDuple();
ITokenDuple nameDuple = ( d.getPointerOperatorNameDuple() != null ) ? new TokenDuple( d.getPointerOperatorNameDuple(), d.getNameDuple() ) : d.getNameDuple();
if( typedef )
return astFactory.createTypedef(scope, name.toString(), abs,
return astFactory.createTypedef(scope, nameDuple.toString(), abs,
getStartingOffset(), getStartingLine(), d
.getNameStartOffset(), d.getNameEndOffset(), d
.getNameLine());
else {
if( isWithinClass )
return astFactory.createField( scope, name, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode() );
return astFactory.createField( scope, nameDuple, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode() );
else
return astFactory.createVariable( scope, name, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression() );
return astFactory.createVariable( scope, nameDuple, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression() );
}
}

View file

@ -32,7 +32,6 @@ import org.eclipse.cdt.core.parser.ast.gcc.IASTGCCExpression;
import org.eclipse.cdt.core.parser.ast.gcc.IASTGCCSimpleTypeSpecifier;
import org.eclipse.cdt.core.parser.extension.IParserExtension;
import org.eclipse.cdt.internal.core.parser.Parser.Flags;
import org.eclipse.cdt.internal.core.parser.ast.complete.gcc.ASTGCCSimpleTypeSpecifier;
import org.eclipse.cdt.internal.core.parser.token.KeywordSets;
import org.eclipse.cdt.internal.core.parser.token.KeywordSets.Key;
@ -44,8 +43,6 @@ import org.eclipse.cdt.internal.core.parser.token.KeywordSets.Key;
public class GCCParserExtension implements IParserExtension {
private static final String EMPTY_STRING = "";//$NON-NLS-1$
protected static BacktrackException backtrack = new BacktrackException();
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.extension.IParserExtension#isValidCVModifier(org.eclipse.cdt.core.parser.ParserLanguage, int)
*/
@ -266,7 +263,7 @@ public class GCCParserExtension implements IParserExtension {
flags.setEncounteredRawType(true);
Hashtable params = new Hashtable();
params.put( IASTGCCSimpleTypeSpecifier.TYPEOF_EXRESSION, typeOfExpression );
sdw.setExtensionParameter( ASTGCCSimpleTypeSpecifier.TYPEOF_EXRESSION, typeOfExpression );
sdw.setExtensionParameter( IASTGCCSimpleTypeSpecifier.TYPEOF_EXRESSION, typeOfExpression );
return new GCCDeclSpecifierExtensionResult( startingPoint, data.getLastToken(), flags, params );
}
data.backup( startingPoint );
@ -388,7 +385,7 @@ public class GCCParserExtension implements IParserExtension {
{
data.backup( mark );
return null;
} catch( BacktrackException backtrack )
} catch( BacktrackException bt )
{
data.backup( mark );
return null;

View file

@ -380,8 +380,8 @@ public abstract class Parser extends ExpressionParser implements IParser
errorHandling();
}
// consume the }
IToken lastToken = consume();
linkage.setEndingOffsetAndLineNumber(lastToken.getEndOffset(), lastToken.getLineNumber());
IToken lastTokenConsumed = consume();
linkage.setEndingOffsetAndLineNumber(lastTokenConsumed.getEndOffset(), lastTokenConsumed.getLineNumber());
linkage.exitScope( requestor );
}
else // single declaration

View file

@ -28,7 +28,7 @@ import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
public class QuickParseCallback extends NullSourceElementRequestor implements IQuickParseCallback
{
protected IASTCompilationUnit compilationUnit = null;
protected IASTCompilationUnit compUnit = null;
protected List inclusions = new ArrayList();
protected List macros = new ArrayList();
protected boolean hasNoProblems = true;
@ -45,7 +45,7 @@ public class QuickParseCallback extends NullSourceElementRequestor implements IQ
public Iterator getDeclarations(){
try{
return compilationUnit.getDeclarations();
return compUnit.getDeclarations();
}
catch (ASTNotImplementedException ne )
{
@ -68,7 +68,7 @@ public class QuickParseCallback extends NullSourceElementRequestor implements IQ
public void exitCompilationUnit( IASTCompilationUnit compilationUnit )
{
this.compilationUnit = compilationUnit;
this.compUnit = compilationUnit;
}
public void exitInclusion( IASTInclusion inclusion )
@ -86,7 +86,7 @@ public class QuickParseCallback extends NullSourceElementRequestor implements IQ
*/
public IASTCompilationUnit getCompilationUnit()
{
return compilationUnit;
return compUnit;
}
public class OffsetableIterator implements Iterator

View file

@ -180,7 +180,7 @@ public class StructuralParseCallback extends QuickParseCallback{
*/
public void exitCompilationUnit(IASTCompilationUnit compilationUnit) {
exitScope(compilationUnit);
this.compilationUnit = compilationUnit;
this.compUnit = compilationUnit;
}
/* (non-Javadoc)
@ -195,7 +195,8 @@ public class StructuralParseCallback extends QuickParseCallback{
* @see org.eclipse.cdt.core.parser.IQuickParseCallback#getCompilationUnit()
*/
public IASTCompilationUnit getCompilationUnit() {
return compilationUnit; }
return compUnit;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)

View file

@ -134,7 +134,7 @@ public class GCCASTExtension implements IASTFactoryExtension {
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(ParserSymbolTable pst, IASTScope scope, Type kind, ITokenDuple typeName, boolean isShort, boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, boolean isComplex, boolean isImaginary, boolean isGlobal, Hashtable extensionParms) {
if( kind == IASTGCCSimpleTypeSpecifier.Type.TYPEOF )
{
ASTExpression typeOfExpression = (ASTExpression) extensionParms.get( ASTGCCSimpleTypeSpecifier.TYPEOF_EXRESSION );
ASTExpression typeOfExpression = (ASTExpression) extensionParms.get( IASTGCCSimpleTypeSpecifier.TYPEOF_EXRESSION );
ISymbol s = pst.newSymbol( EMPTY_STRING );
s.setTypeInfo( typeOfExpression.getResultType().getResult() );
return new ASTGCCSimpleTypeSpecifier( s, isTypename, ( typeName == null ? EMPTY_STRING : typeName.toString()), EMPTY_LIST, typeOfExpression );

View file

@ -333,7 +333,7 @@ public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier
* @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getFriends()
*/
public Iterator getFriends() {
IDerivableContainerSymbol symbol = (IDerivableContainerSymbol) getSymbol();
return new SymbolIterator( symbol.getFriends().iterator() );
IDerivableContainerSymbol s = (IDerivableContainerSymbol) getSymbol();
return new SymbolIterator( s.getFriends().iterator() );
}
}

View file

@ -42,9 +42,8 @@ public abstract class ASTScope extends ASTSymbol implements IASTScope
*/
public Iterator getDeclarations()
{
IContainerSymbol symbol = getContainerSymbol();
if( symbol != null ){
return new SymbolIterator( symbol.getContentsIterator() );
if( getContainerSymbol() != null ){
return new SymbolIterator( getContainerSymbol().getContentsIterator() );
}
return null;
}

View file

@ -38,8 +38,7 @@ public class ASTTemplateDeclaration extends ASTSymbol implements IASTTemplateDec
private NamedOffsets offsets = new NamedOffsets();
private ITemplateSymbol getTemplateSymbol(){
ISymbol symbol = getSymbol();
return (ITemplateSymbol) (( symbol instanceof ITemplateSymbol ) ? symbol : null);
return (ITemplateSymbol) (( getSymbol() instanceof ITemplateSymbol ) ? getSymbol() : null);
}
/**
*
@ -90,9 +89,9 @@ public class ASTTemplateDeclaration extends ASTSymbol implements IASTTemplateDec
return ( node instanceof IASTDeclaration ) ? (IASTDeclaration)node : null;
}
IContainerSymbol owned = getTemplateSymbol().getTemplatedSymbol();
if( owned != null && owned.getASTExtension() != null ){
ASTNode node = owned.getASTExtension().getPrimaryDeclaration();
IContainerSymbol ownedSymbol = getTemplateSymbol().getTemplatedSymbol();
if( ownedSymbol != null && ownedSymbol.getASTExtension() != null ){
ASTNode node = ownedSymbol.getASTExtension().getPrimaryDeclaration();
return ( node instanceof IASTDeclaration ) ? (IASTDeclaration)node : null;
}
return null;

View file

@ -639,40 +639,40 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
protected void attachSymbolExtension( IExtensibleSymbol symbol, ASTNode astNode )
{
ISymbolASTExtension extension = new ExtensibleSymbolExtension( symbol, astNode );
symbol.setASTExtension( extension );
ISymbolASTExtension symbolExtension = new ExtensibleSymbolExtension( symbol, astNode );
symbol.setASTExtension( symbolExtension );
}
protected void attachSymbolExtension(
ISymbol symbol,
ASTSymbol astSymbol, boolean asDefinition )
{
ISymbolASTExtension extension = symbol.getASTExtension();
if( extension == null )
ISymbolASTExtension symbolExtension = symbol.getASTExtension();
if( symbolExtension == null )
{
if( astSymbol instanceof IASTNamespaceDefinition )
extension = new NamespaceSymbolExtension( symbol, astSymbol );
symbolExtension = new NamespaceSymbolExtension( symbol, astSymbol );
else if( astSymbol instanceof IASTFunction || astSymbol instanceof IASTMethod ||
astSymbol instanceof IASTEnumerationSpecifier ||
astSymbol instanceof IASTClassSpecifier ||
astSymbol instanceof IASTElaboratedTypeSpecifier )
{
extension = new ForewardDeclaredSymbolExtension( symbol, astSymbol );
symbolExtension = new ForewardDeclaredSymbolExtension( symbol, astSymbol );
}
else if( astSymbol instanceof IASTTemplateDeclaration ){
extension = new TemplateSymbolExtension( symbol, astSymbol );
symbolExtension = new TemplateSymbolExtension( symbol, astSymbol );
}
else
{
extension = new StandardSymbolExtension( symbol, astSymbol );
symbolExtension = new StandardSymbolExtension( symbol, astSymbol );
}
symbol.setASTExtension( extension );
symbol.setASTExtension( symbolExtension );
}
else
{
if( asDefinition )
try {
extension.addDefinition( astSymbol );
symbolExtension.addDefinition( astSymbol );
} catch (ExtensionException e) {
// assert false : ExtensionException.class;
}
@ -3294,8 +3294,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
}
if( context != null ){
ISymbolASTExtension extension = context.getASTExtension();
return ( extension != null ) ? extension.getPrimaryDeclaration() : null;
ISymbolASTExtension symbolExtension = context.getASTExtension();
return ( symbolExtension != null ) ? symbolExtension.getPrimaryDeclaration() : null;
}
return null;

View file

@ -49,7 +49,7 @@ public class ContextStack {
private final IParserLogService log;
private int current_size = 8;
private IScannerContext [] cs = new IScannerContext[current_size];;
private IScannerContext [] cs = new IScannerContext[current_size];
private int cs_pos = 0;
@ -59,7 +59,7 @@ public class ContextStack {
private final void cs_push(IScannerContext c) {
try {
cs[cs_pos++] = c;;
cs[cs_pos++] = c;
}
catch (ArrayIndexOutOfBoundsException a)
{

View file

@ -646,7 +646,6 @@ public class Scanner implements IScanner {
private static final int NOCHAR = -1;
private static final String TEXT = "<text>"; //$NON-NLS-1$
private static final String START = "<initial reader>"; //$NON-NLS-1$
private static final String EXPRESSION = "<expression>"; //$NON-NLS-1$
private static final String PASTING = "<pasting>"; //$NON-NLS-1$

View file

@ -51,38 +51,38 @@ public class KeywordSets {
public static Set getKeywords( Key kind, ParserLanguage language )
{
if( kind == Key.EMPTY )
return EMPTY;
return EMPTY_TABLE;
if( kind == Key.DECL_SPECIFIER_SEQUENCE )
return (Set) DECL_SPECIFIER_SEQUENCE.get( language );
return (Set) DECL_SPECIFIER_SEQUENCE_TABLE.get( language );
if( kind == Key.DECLARATION )
return (Set) DECLARATION.get( language );
return (Set) DECLARATION_TABLE.get( language );
if( kind == Key.STATEMENT )
return (Set) STATEMENT.get( language );
return (Set) STATEMENT_TABLE.get( language );
if( kind == Key.BASE_SPECIFIER )
return BASE_SPECIFIER_CPP;
if( kind == Key.POST_USING )
return POST_USING_CPP;
if( kind == Key.FUNCTION_MODIFIER )
return (Set) FUNCTION_MODIFIER.get( language );
return (Set) FUNCTION_MODIFIER_TABLE.get( language );
if( kind == Key.NAMESPACE_ONLY )
return NAMESPACE_ONLY;
return NAMESPACE_ONLY_SET;
if( kind == Key.MACRO )
return MACRO_ONLY;
if( kind == Key.PP_DIRECTIVE )
return PP_DIRECTIVES;
if( kind == Key.EXPRESSION )
return (Set) EXPRESSION.get( language );
return (Set) EXPRESSION_TABLE.get( language );
//TODO finish this
return null;
}
private static final Set EMPTY = new HashSet();
private static final Set EMPTY_TABLE = new HashSet();
private static final Set NAMESPACE_ONLY;
private static final Set NAMESPACE_ONLY_SET;
static
{
NAMESPACE_ONLY = new HashSet();
NAMESPACE_ONLY.add(Keywords.NAMESPACE );
NAMESPACE_ONLY_SET = new HashSet();
NAMESPACE_ONLY_SET.add(Keywords.NAMESPACE );
}
private static final Set MACRO_ONLY;
@ -143,12 +143,12 @@ public class KeywordSets {
DECL_SPECIFIER_SEQUENCE_CPP.add( Keywords.CLASS);
}
private static final Hashtable DECL_SPECIFIER_SEQUENCE;
private static final Hashtable DECL_SPECIFIER_SEQUENCE_TABLE;
static
{
DECL_SPECIFIER_SEQUENCE = new Hashtable();
DECL_SPECIFIER_SEQUENCE.put( ParserLanguage.CPP, DECL_SPECIFIER_SEQUENCE_CPP );
DECL_SPECIFIER_SEQUENCE.put( ParserLanguage.C, DECL_SPECIFIER_SEQUENCE_C );
DECL_SPECIFIER_SEQUENCE_TABLE = new Hashtable();
DECL_SPECIFIER_SEQUENCE_TABLE.put( ParserLanguage.CPP, DECL_SPECIFIER_SEQUENCE_CPP );
DECL_SPECIFIER_SEQUENCE_TABLE.put( ParserLanguage.C, DECL_SPECIFIER_SEQUENCE_C );
}
private static final Set DECLARATION_CPP;
@ -169,12 +169,12 @@ public class KeywordSets {
// more to come
}
private static final Hashtable DECLARATION;
private static final Hashtable DECLARATION_TABLE;
static
{
DECLARATION = new Hashtable();
DECLARATION.put( ParserLanguage.CPP, DECLARATION_CPP );
DECLARATION.put( ParserLanguage.C, DECLARATION_C );
DECLARATION_TABLE = new Hashtable();
DECLARATION_TABLE.put( ParserLanguage.CPP, DECLARATION_CPP );
DECLARATION_TABLE.put( ParserLanguage.C, DECLARATION_C );
}
private static final Set STATEMENT_C;
@ -194,12 +194,12 @@ public class KeywordSets {
//TODO finish this
}
private static final Hashtable STATEMENT;
private static final Hashtable STATEMENT_TABLE;
static
{
STATEMENT = new Hashtable();
STATEMENT.put( ParserLanguage.CPP, STATEMENT_CPP);
STATEMENT.put( ParserLanguage.C, STATEMENT_C );
STATEMENT_TABLE = new Hashtable();
STATEMENT_TABLE.put( ParserLanguage.CPP, STATEMENT_CPP);
STATEMENT_TABLE.put( ParserLanguage.C, STATEMENT_C );
}
private static final Set BASE_SPECIFIER_CPP;
@ -235,12 +235,12 @@ public class KeywordSets {
FUNCTION_MODIFIER_CPP.add( Keywords.VOLATILE );
}
private static final Hashtable FUNCTION_MODIFIER;
private static final Hashtable FUNCTION_MODIFIER_TABLE;
static
{
FUNCTION_MODIFIER= new Hashtable();
FUNCTION_MODIFIER.put( ParserLanguage.CPP, FUNCTION_MODIFIER_CPP );
FUNCTION_MODIFIER.put( ParserLanguage.C, FUNCTION_MODIFIER_C );
FUNCTION_MODIFIER_TABLE= new Hashtable();
FUNCTION_MODIFIER_TABLE.put( ParserLanguage.CPP, FUNCTION_MODIFIER_CPP );
FUNCTION_MODIFIER_TABLE.put( ParserLanguage.C, FUNCTION_MODIFIER_C );
}
private static final Set PP_DIRECTIVES;
@ -299,11 +299,11 @@ public class KeywordSets {
EXPRESSION_CPP.add( Keywords.THROW );
}
private static final Hashtable EXPRESSION;
private static final Hashtable EXPRESSION_TABLE;
static
{
EXPRESSION = new Hashtable();
EXPRESSION.put( ParserLanguage.CPP, EXPRESSION_CPP );
EXPRESSION.put( ParserLanguage.C, EXPRESSION_C );
EXPRESSION_TABLE = new Hashtable();
EXPRESSION_TABLE.put( ParserLanguage.CPP, EXPRESSION_CPP );
EXPRESSION_TABLE.put( ParserLanguage.C, EXPRESSION_C );
}
}