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

org.eclipse.cdt.core

Fixed Bug 50711 - Wrong completion kind in a new expression

org.eclipse.cdt.ui.tests
Updated and renamed CompletionFailedTest_NewTypeReference_NoPrefix_Bug50711 to CompletionTest_NewTypeReference_NoPrefix, moving it to the success tests directory.
Updated and renamed CompletionFailedTest_NewTypeReference_Prefix_Bug50711 to CompletionTest_NewTypeReference_Prefix, moving it to the success tests directory.
This commit is contained in:
John Camelon 2004-01-28 22:31:24 +00:00
parent ad01ba1044
commit a581a6aa81
7 changed files with 56 additions and 83 deletions

View file

@ -1,3 +1,6 @@
2004-01-28 John Camelon
Fixed Bug 50711 - Wrong completion kind in a new expression
2004-01-28 John Camelon 2004-01-28 John Camelon
Updated Scanner to add ANSI built-in defined macros for C and C++. Updated Scanner to add ANSI built-in defined macros for C and C++.
Updated GCCScannerExtension to add GCC specific defined macros for C++. Updated GCCScannerExtension to add GCC specific defined macros for C++.

View file

@ -249,9 +249,11 @@ public class ContextualParser extends Parser implements IParser {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.Parser#getCompletionKindForDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope) * @see org.eclipse.cdt.internal.core.parser.Parser#getCompletionKindForDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope)
*/ */
protected CompletionKind getCompletionKindForDeclaration(IASTScope scope) { protected CompletionKind getCompletionKindForDeclaration(IASTScope scope, CompletionKind overide) {
IASTCompletionNode.CompletionKind kind = null; IASTCompletionNode.CompletionKind kind = null;
if( scope instanceof IASTClassSpecifier ) if( overide != null )
kind = overide;
else if( scope instanceof IASTClassSpecifier )
kind = CompletionKind.FIELD_TYPE; kind = CompletionKind.FIELD_TYPE;
else if (scope instanceof IASTCodeScope) else if (scope instanceof IASTCodeScope)
// kind = CompletionKind.STATEMENT_START; // kind = CompletionKind.STATEMENT_START;

View file

@ -179,7 +179,7 @@ public abstract class Parser implements IParser
try try
{ {
checkToken = LA(1); checkToken = LA(1);
declaration(compilationUnit, null); declaration(compilationUnit, null, null);
if (LA(1) == checkToken) if (LA(1) == checkToken)
errorHandling(); errorHandling();
} }
@ -391,7 +391,7 @@ public abstract class Parser implements IParser
default : default :
try try
{ {
declaration(linkage, null); declaration(linkage, null, null);
} }
catch (BacktrackException bt) catch (BacktrackException bt)
{ {
@ -424,7 +424,7 @@ public abstract class Parser implements IParser
throw backtrack; throw backtrack;
} }
linkage.enterScope( requestor ); linkage.enterScope( requestor );
declaration(linkage, null); declaration(linkage, null, null);
linkage.exitScope( requestor ); linkage.exitScope( requestor );
} }
} }
@ -469,7 +469,7 @@ public abstract class Parser implements IParser
throw backtrack; throw backtrack;
} }
templateInstantiation.enterScope( requestor ); templateInstantiation.enterScope( requestor );
declaration(scope, templateInstantiation); declaration(scope, templateInstantiation, null);
templateInstantiation.setEndingOffsetAndLineNumber(lastToken.getEndOffset(), lastToken.getLineNumber()); templateInstantiation.setEndingOffsetAndLineNumber(lastToken.getEndOffset(), lastToken.getLineNumber());
templateInstantiation.exitScope( requestor ); templateInstantiation.exitScope( requestor );
@ -496,7 +496,7 @@ public abstract class Parser implements IParser
throw backtrack; throw backtrack;
} }
templateSpecialization.enterScope(requestor); templateSpecialization.enterScope(requestor);
declaration(scope, templateSpecialization); declaration(scope, templateSpecialization, null);
templateSpecialization.setEndingOffsetAndLineNumber( templateSpecialization.setEndingOffsetAndLineNumber(
lastToken.getEndOffset(), lastToken.getLineNumber()); lastToken.getEndOffset(), lastToken.getLineNumber());
templateSpecialization.exitScope(requestor); templateSpecialization.exitScope(requestor);
@ -523,7 +523,7 @@ public abstract class Parser implements IParser
throw backtrack; throw backtrack;
} }
templateDecl.enterScope( requestor ); templateDecl.enterScope( requestor );
declaration(scope, templateDecl ); declaration(scope, templateDecl, null );
templateDecl.setEndingOffsetAndLineNumber( templateDecl.setEndingOffsetAndLineNumber(
lastToken.getEndOffset(), lastToken.getLineNumber() ); lastToken.getEndOffset(), lastToken.getLineNumber() );
templateDecl.exitScope( requestor ); templateDecl.exitScope( requestor );
@ -713,10 +713,10 @@ public abstract class Parser implements IParser
*/ */
protected void declaration( protected void declaration(
IASTScope scope, IASTScope scope,
IASTTemplate ownerTemplate) IASTTemplate ownerTemplate, CompletionKind overideKind)
throws EndOfFileException, BacktrackException throws EndOfFileException, BacktrackException
{ {
IASTCompletionNode.CompletionKind kind = getCompletionKindForDeclaration(scope); IASTCompletionNode.CompletionKind kind = getCompletionKindForDeclaration(scope, overideKind);
setCompletionValues(scope, kind, Key.DECLARATION ); setCompletionValues(scope, kind, Key.DECLARATION );
switch (LT(1)) switch (LT(1))
@ -765,7 +765,7 @@ public abstract class Parser implements IParser
return; return;
} }
default : default :
simpleDeclarationStrategyUnion(scope, ownerTemplate); simpleDeclarationStrategyUnion(scope, ownerTemplate, overideKind);
} }
setCompletionValues(scope, kind, Key.DECLARATION ); setCompletionValues(scope, kind, Key.DECLARATION );
} }
@ -774,13 +774,13 @@ public abstract class Parser implements IParser
* @param scope * @param scope
* @return * @return
*/ */
protected IASTCompletionNode.CompletionKind getCompletionKindForDeclaration(IASTScope scope) { protected IASTCompletionNode.CompletionKind getCompletionKindForDeclaration(IASTScope scope, CompletionKind overide) {
return null; return null;
} }
protected void simpleDeclarationStrategyUnion( protected void simpleDeclarationStrategyUnion(
IASTScope scope, IASTScope scope,
IASTTemplate ownerTemplate) IASTTemplate ownerTemplate, CompletionKind overide)
throws EndOfFileException, BacktrackException throws EndOfFileException, BacktrackException
{ {
IToken mark = mark(); IToken mark = mark();
@ -790,7 +790,7 @@ public abstract class Parser implements IParser
simpleDeclaration( simpleDeclaration(
SimpleDeclarationStrategy.TRY_CONSTRUCTOR, SimpleDeclarationStrategy.TRY_CONSTRUCTOR,
scope, scope,
ownerTemplate); ownerTemplate, overide);
// try it first with the original strategy // try it first with the original strategy
} }
catch (BacktrackException bt) catch (BacktrackException bt)
@ -803,7 +803,7 @@ public abstract class Parser implements IParser
simpleDeclaration( simpleDeclaration(
SimpleDeclarationStrategy.TRY_FUNCTION, SimpleDeclarationStrategy.TRY_FUNCTION,
scope, scope,
ownerTemplate); ownerTemplate, overide);
} }
catch( BacktrackException bt2 ) catch( BacktrackException bt2 )
{ {
@ -814,7 +814,7 @@ public abstract class Parser implements IParser
simpleDeclaration( simpleDeclaration(
SimpleDeclarationStrategy.TRY_VARIABLE, SimpleDeclarationStrategy.TRY_VARIABLE,
scope, scope,
ownerTemplate); ownerTemplate, overide);
} }
catch( BacktrackException b3 ) catch( BacktrackException b3 )
{ {
@ -879,7 +879,7 @@ public abstract class Parser implements IParser
default : default :
try try
{ {
declaration(namespaceDefinition, null); declaration(namespaceDefinition, null, null);
} }
catch (BacktrackException bt) catch (BacktrackException bt)
{ {
@ -945,14 +945,14 @@ public abstract class Parser implements IParser
protected void simpleDeclaration( protected void simpleDeclaration(
SimpleDeclarationStrategy strategy, SimpleDeclarationStrategy strategy,
IASTScope scope, IASTScope scope,
IASTTemplate ownerTemplate) IASTTemplate ownerTemplate, CompletionKind overideKind)
throws BacktrackException, EndOfFileException throws BacktrackException, EndOfFileException
{ {
IToken firstToken = LA(1); IToken firstToken = LA(1);
DeclarationWrapper sdw = DeclarationWrapper sdw =
new DeclarationWrapper(scope, firstToken.getOffset(), firstToken.getLineNumber(), ownerTemplate); new DeclarationWrapper(scope, firstToken.getOffset(), firstToken.getLineNumber(), ownerTemplate);
setCompletionValues( scope, getCompletionKindForDeclaration(scope), Key.DECL_SPECIFIER_SEQUENCE ); setCompletionValues( scope, getCompletionKindForDeclaration(scope, overideKind), Key.DECL_SPECIFIER_SEQUENCE );
declSpecifierSeq(sdw, false, strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR ); declSpecifierSeq(sdw, false, strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR );
if (sdw.getTypeSpecifier() == null && sdw.getSimpleType() != IASTSimpleTypeSpecifier.Type.UNSPECIFIED ) if (sdw.getTypeSpecifier() == null && sdw.getSimpleType() != IASTSimpleTypeSpecifier.Type.UNSPECIFIED )
try try
@ -2797,7 +2797,7 @@ public abstract class Parser implements IParser
default : default :
try try
{ {
declaration(astClassSpecifier, null); declaration(astClassSpecifier, null, null);
} }
catch (BacktrackException bt) catch (BacktrackException bt)
{ {
@ -3067,10 +3067,7 @@ public abstract class Parser implements IParser
try try
{ {
IASTExpression thisExpression = expression(scope); IASTExpression thisExpression = expression(scope);
// if( queryLookaheadCapability() )
consume(IToken.tSEMI); consume(IToken.tSEMI);
// else
// throw new EndOfFileException();
thisExpression.acceptElement( requestor ); thisExpression.acceptElement( requestor );
return; return;
} }
@ -3084,7 +3081,7 @@ public abstract class Parser implements IParser
} }
// declarationStatement // declarationStatement
declaration(scope, null); declaration(scope, null, null);
} }
} }
@ -3099,12 +3096,10 @@ public abstract class Parser implements IParser
setCompletionValues(scope,CompletionKind.NO_SUCH_KIND,Key.EMPTY); setCompletionValues(scope,CompletionKind.NO_SUCH_KIND,Key.EMPTY);
consume(IToken.tLPAREN); consume(IToken.tLPAREN);
setCompletionValues(scope,CompletionKind.EXCEPTION_REFERENCE,Key.DECL_SPECIFIER_SEQUENCE ); setCompletionValues(scope,CompletionKind.EXCEPTION_REFERENCE,Key.DECL_SPECIFIER_SEQUENCE );
if( ! queryLookaheadCapability(2))
throw new EndOfFileException();
if( LT(1) == IToken.tELLIPSIS ) if( LT(1) == IToken.tELLIPSIS )
consume( IToken.tELLIPSIS ); consume( IToken.tELLIPSIS );
else else
declaration(scope, null); // was exceptionDeclaration declaration(scope, null, CompletionKind.EXCEPTION_REFERENCE); // was exceptionDeclaration
consume(IToken.tRPAREN); consume(IToken.tRPAREN);
catchBlockCompoundStatement(scope); catchBlockCompoundStatement(scope);
@ -3152,7 +3147,7 @@ public abstract class Parser implements IParser
{ {
try try
{ {
simpleDeclarationStrategyUnion(scope,null); simpleDeclarationStrategyUnion(scope,null, null);
} }
catch( BacktrackException bt ) catch( BacktrackException bt )
{ {
@ -3196,7 +3191,6 @@ public abstract class Parser implements IParser
KeywordSets.Key.STATEMENT ); KeywordSets.Key.STATEMENT );
while (LT(1) != IToken.tRBRACE) while (LT(1) != IToken.tRBRACE)
// while (queryLookaheadCapability() && LT(1) != IToken.tRBRACE)
{ {
checkToken = LA(1); checkToken = LA(1);
try try
@ -3214,8 +3208,6 @@ public abstract class Parser implements IParser
} }
consume(IToken.tRBRACE); consume(IToken.tRBRACE);
// if( queryLookaheadCapability() ) consume(IToken.tRBRACE);
// else throw new EndOfFileException();
if( createNewScope ) if( createNewScope )
newScope.exitScope( requestor ); newScope.exitScope( requestor );
@ -3235,7 +3227,6 @@ public abstract class Parser implements IParser
public IASTExpression expression(IASTScope scope) throws BacktrackException, EndOfFileException public IASTExpression expression(IASTScope scope) throws BacktrackException, EndOfFileException
{ {
IASTExpression assignmentExpression = assignmentExpression(scope); IASTExpression assignmentExpression = assignmentExpression(scope);
// if( !queryLookaheadCapability() ) return assignmentExpression;
while (LT(1) == IToken.tCOMMA) while (LT(1) == IToken.tCOMMA)
{ {
consume(); consume();
@ -3277,7 +3268,6 @@ public abstract class Parser implements IParser
&& conditionalExpression.getExpressionKind() && conditionalExpression.getExpressionKind()
== IASTExpression.Kind.CONDITIONALEXPRESSION) == IASTExpression.Kind.CONDITIONALEXPRESSION)
return conditionalExpression; return conditionalExpression;
// if( !queryLookaheadCapability() ) return conditionalExpression;
switch (LT(1)) { switch (LT(1)) {
case IToken.tASSIGN : case IToken.tASSIGN :
return assignmentOperatorExpression( return assignmentOperatorExpression(
@ -3408,7 +3398,6 @@ public abstract class Parser implements IParser
throws BacktrackException, EndOfFileException throws BacktrackException, EndOfFileException
{ {
IASTExpression firstExpression = logicalOrExpression(scope); IASTExpression firstExpression = logicalOrExpression(scope);
// if( !queryLookaheadCapability() ) return firstExpression;
if (LT(1) == IToken.tQUESTION) if (LT(1) == IToken.tQUESTION)
{ {
consume(); consume();
@ -3445,7 +3434,6 @@ public abstract class Parser implements IParser
throws BacktrackException, EndOfFileException throws BacktrackException, EndOfFileException
{ {
IASTExpression firstExpression = logicalAndExpression(scope); IASTExpression firstExpression = logicalAndExpression(scope);
// if( !queryLookaheadCapability() ) return firstExpression;
while (LT(1) == IToken.tOR) while (LT(1) == IToken.tOR)
{ {
consume(); consume();
@ -3481,7 +3469,6 @@ public abstract class Parser implements IParser
throws BacktrackException, EndOfFileException throws BacktrackException, EndOfFileException
{ {
IASTExpression firstExpression = inclusiveOrExpression( scope ); IASTExpression firstExpression = inclusiveOrExpression( scope );
// if( !queryLookaheadCapability() ) return firstExpression;
while (LT(1) == IToken.tAND) while (LT(1) == IToken.tAND)
{ {
consume(); consume();
@ -3516,7 +3503,6 @@ public abstract class Parser implements IParser
throws BacktrackException, EndOfFileException throws BacktrackException, EndOfFileException
{ {
IASTExpression firstExpression = exclusiveOrExpression(scope); IASTExpression firstExpression = exclusiveOrExpression(scope);
// if( !queryLookaheadCapability() ) return firstExpression;
while (LT(1) == IToken.tBITOR) while (LT(1) == IToken.tBITOR)
{ {
consume(); consume();
@ -3552,7 +3538,6 @@ public abstract class Parser implements IParser
throws BacktrackException, EndOfFileException throws BacktrackException, EndOfFileException
{ {
IASTExpression firstExpression = andExpression( scope ); IASTExpression firstExpression = andExpression( scope );
// if( !queryLookaheadCapability() ) return firstExpression;
while (LT(1) == IToken.tXOR) while (LT(1) == IToken.tXOR)
{ {
consume(); consume();
@ -3588,7 +3573,6 @@ public abstract class Parser implements IParser
protected IASTExpression andExpression(IASTScope scope) throws EndOfFileException, BacktrackException protected IASTExpression andExpression(IASTScope scope) throws EndOfFileException, BacktrackException
{ {
IASTExpression firstExpression = equalityExpression(scope); IASTExpression firstExpression = equalityExpression(scope);
// if( !queryLookaheadCapability() ) return firstExpression;
while (LT(1) == IToken.tAMPER) while (LT(1) == IToken.tAMPER)
{ {
consume(); consume();
@ -3626,7 +3610,6 @@ public abstract class Parser implements IParser
IASTExpression firstExpression = relationalExpression(scope); IASTExpression firstExpression = relationalExpression(scope);
for (;;) for (;;)
{ {
// if( !queryLookaheadCapability() ) return firstExpression;
switch (LT(1)) switch (LT(1))
{ {
case IToken.tEQUAL : case IToken.tEQUAL :
@ -3672,7 +3655,6 @@ public abstract class Parser implements IParser
IASTExpression firstExpression = shiftExpression(scope); IASTExpression firstExpression = shiftExpression(scope);
for (;;) for (;;)
{ {
// if( !queryLookaheadCapability() ) return firstExpression;
switch (LT(1)) switch (LT(1))
{ {
case IToken.tGT : case IToken.tGT :
@ -3752,7 +3734,6 @@ public abstract class Parser implements IParser
IASTExpression firstExpression = additiveExpression(scope); IASTExpression firstExpression = additiveExpression(scope);
for (;;) for (;;)
{ {
// if( !queryLookaheadCapability() ) return firstExpression;
switch (LT(1)) switch (LT(1))
{ {
case IToken.tSHIFTL : case IToken.tSHIFTL :
@ -3797,7 +3778,6 @@ public abstract class Parser implements IParser
IASTExpression firstExpression = multiplicativeExpression( scope ); IASTExpression firstExpression = multiplicativeExpression( scope );
for (;;) for (;;)
{ {
// if( !queryLookaheadCapability() ) return firstExpression;
switch (LT(1)) switch (LT(1))
{ {
case IToken.tPLUS : case IToken.tPLUS :
@ -3842,7 +3822,6 @@ public abstract class Parser implements IParser
IASTExpression firstExpression = pmExpression(scope); IASTExpression firstExpression = pmExpression(scope);
for (;;) for (;;)
{ {
// if( !queryLookaheadCapability() ) return firstExpression;
switch (LT(1)) switch (LT(1))
{ {
case IToken.tSTAR : case IToken.tSTAR :
@ -3897,7 +3876,6 @@ public abstract class Parser implements IParser
IASTExpression firstExpression = castExpression(scope); IASTExpression firstExpression = castExpression(scope);
for (;;) for (;;)
{ {
// if( ! queryLookaheadCapability() ) return firstExpression;
switch (LT(1)) switch (LT(1))
{ {
case IToken.tDOTSTAR : case IToken.tDOTSTAR :
@ -3940,7 +3918,6 @@ public abstract class Parser implements IParser
protected IASTExpression castExpression( IASTScope scope ) throws EndOfFileException, BacktrackException protected IASTExpression castExpression( IASTScope scope ) throws EndOfFileException, BacktrackException
{ {
// TO DO: we need proper symbol checkint to ensure type name // TO DO: we need proper symbol checkint to ensure type name
// if( ! queryLookaheadCapability() ) return unaryExpression(scope);
if (LT(1) == IToken.tLPAREN) if (LT(1) == IToken.tLPAREN)
{ {
IToken mark = mark(); IToken mark = mark();
@ -4232,6 +4209,7 @@ public abstract class Parser implements IParser
*/ */
protected IASTExpression newExpression( IASTScope scope ) throws BacktrackException, EndOfFileException protected IASTExpression newExpression( IASTScope scope ) throws BacktrackException, EndOfFileException
{ {
setCompletionValues(scope, CompletionKind.NEW_TYPE_REFERENCE, Key.EMPTY);
if (LT(1) == IToken.tCOLONCOLON) if (LT(1) == IToken.tCOLONCOLON)
{ {
// global scope // global scope
@ -4336,6 +4314,7 @@ public abstract class Parser implements IParser
// new-expression ends here. // new-expression ends here.
try try
{ {
setCompletionValues(scope, CompletionKind.NO_SUCH_KIND, Key.EMPTY);
return astFactory.createExpression( return astFactory.createExpression(
scope, IASTExpression.Kind.NEW_TYPEID, scope, IASTExpression.Kind.NEW_TYPEID,
null, null, null, typeId, null, null, null, null, typeId, null,
@ -4381,6 +4360,7 @@ public abstract class Parser implements IParser
newInitializerExpressions.add(expression(scope)); newInitializerExpressions.add(expression(scope));
consume(IToken.tRPAREN); consume(IToken.tRPAREN);
} }
setCompletionValues(scope, CompletionKind.NO_SUCH_KIND, Key.EMPTY);
try try
{ {
return astFactory.createExpression( return astFactory.createExpression(
@ -4395,6 +4375,7 @@ public abstract class Parser implements IParser
{ {
throw backtrack; throw backtrack;
} }
} }
protected IASTExpression unaryOperatorCastExpression( IASTScope scope, protected IASTExpression unaryOperatorCastExpression( IASTScope scope,
IASTExpression.Kind kind) IASTExpression.Kind kind)
@ -4427,7 +4408,6 @@ public abstract class Parser implements IParser
protected IASTExpression unaryExpression( IASTScope scope ) protected IASTExpression unaryExpression( IASTScope scope )
throws EndOfFileException, BacktrackException throws EndOfFileException, BacktrackException
{ {
// if( ! queryLookaheadCapability() ) return postfixExpression( scope );
switch (LT(1)) switch (LT(1))
{ {
case IToken.tSTAR : case IToken.tSTAR :
@ -4553,7 +4533,6 @@ public abstract class Parser implements IParser
IASTExpression firstExpression = null; IASTExpression firstExpression = null;
boolean isTemplate = false; boolean isTemplate = false;
checkEndOfFile(); checkEndOfFile();
// if( ! queryLookaheadCapability() ) return primaryExpression(scope);
switch (LT(1)) switch (LT(1))
{ {
case IToken.t_typename : case IToken.t_typename :
@ -4714,7 +4693,6 @@ public abstract class Parser implements IParser
IASTExpression secondExpression = null; IASTExpression secondExpression = null;
for (;;) for (;;)
{ {
// if( ! queryLookaheadCapability() )return firstExpression;
switch (LT(1)) switch (LT(1))
{ {
case IToken.tLBRACKET : case IToken.tLBRACKET :
@ -4828,15 +4806,9 @@ public abstract class Parser implements IParser
setCompletionValues(scope, CompletionKind.MEMBER_REFERENCE, KeywordSets.Key.EMPTY, firstExpression, isTemplate ); setCompletionValues(scope, CompletionKind.MEMBER_REFERENCE, KeywordSets.Key.EMPTY, firstExpression, isTemplate );
// if( ! queryLookaheadCapability() )
// throw new EndOfFileException();
secondExpression = primaryExpression(scope); secondExpression = primaryExpression(scope);
checkEndOfFile(); checkEndOfFile();
// if( ! queryLookaheadCapability() )
// throw new EndOfFileException();
setCompletionValues(scope, CompletionKind.NO_SUCH_KIND, KeywordSets.Key.EMPTY ); setCompletionValues(scope, CompletionKind.NO_SUCH_KIND, KeywordSets.Key.EMPTY );
try try
@ -4875,15 +4847,9 @@ public abstract class Parser implements IParser
setCompletionValues(scope, CompletionKind.MEMBER_REFERENCE, KeywordSets.Key.EMPTY, firstExpression, isTemplate ); setCompletionValues(scope, CompletionKind.MEMBER_REFERENCE, KeywordSets.Key.EMPTY, firstExpression, isTemplate );
// if( ! queryLookaheadCapability() )
// throw new EndOfFileException();
secondExpression = primaryExpression(scope); secondExpression = primaryExpression(scope);
checkEndOfFile(); checkEndOfFile();
// if( ! queryLookaheadCapability() )
// throw new EndOfFileException();
setCompletionValues(scope, CompletionKind.NO_SUCH_KIND, KeywordSets.Key.EMPTY ); setCompletionValues(scope, CompletionKind.NO_SUCH_KIND, KeywordSets.Key.EMPTY );
try try
{ {
@ -5018,7 +4984,6 @@ public abstract class Parser implements IParser
throws EndOfFileException, BacktrackException throws EndOfFileException, BacktrackException
{ {
IToken t = null; IToken t = null;
// if( !queryLookaheadCapability() ) return emptyExpression;
switch (LT(1)) switch (LT(1))
{ {
// TO DO: we need more literals... // TO DO: we need more literals...

View file

@ -1,3 +1,7 @@
2004-01-28 John Camelon
Updated and renamed CompletionFailedTest_NewTypeReference_NoPrefix_Bug50711 to CompletionTest_NewTypeReference_NoPrefix, moving it to the success tests directory.
Updated and renamed CompletionFailedTest_NewTypeReference_Prefix_Bug50711 to CompletionTest_NewTypeReference_Prefix, moving it to the success tests directory.
2004-01-28 John Camelon 2004-01-28 John Camelon
Updated CompletionTest_SingleName_NoPrefix to include internal macro definitions. Updated CompletionTest_SingleName_NoPrefix to include internal macro definitions.

View file

@ -68,8 +68,8 @@ public class AutomatedSuite extends TestSuite {
addTest(CompletionTest_ClassReference_Prefix.suite()); addTest(CompletionTest_ClassReference_Prefix.suite());
addTest(CompletionTest_ExceptionReference_NoPrefix.suite()); addTest(CompletionTest_ExceptionReference_NoPrefix.suite());
addTest(CompletionTest_ExceptionReference_Prefix.suite()); addTest(CompletionTest_ExceptionReference_Prefix.suite());
addTest(CompletionFailedTest_NewTypeReference_NoPrefix_Bug50711.suite()); addTest(CompletionTest_NewTypeReference_NoPrefix.suite());
addTest(CompletionFailedTest_NewTypeReference_Prefix_Bug50711.suite()); addTest(CompletionTest_NewTypeReference_Prefix.suite());
} }
} }

View file

@ -8,13 +8,12 @@
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests; package org.eclipse.cdt.ui.tests.text.contentassist;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
/** /**
* @author hamer * @author hamer
@ -23,28 +22,29 @@ import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
* Bug#50711 : Wrong completion kind in a new expression * Bug#50711 : Wrong completion kind in a new expression
* *
*/ */
public class CompletionFailedTest_NewTypeReference_NoPrefix_Bug50711 extends CompletionProposalsBaseTest{ public class CompletionTest_NewTypeReference_NoPrefix extends CompletionProposalsBaseTest{
private final String fileName = "CompletionFailedTestStart12.cpp"; private final String fileName = "CompletionFailedTestStart12.cpp";
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName; private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
private final String headerFileName = "CompletionTestStart.h"; private final String headerFileName = "CompletionTestStart.h";
private final String headerFileFullPath ="resources/contentassist/" + headerFileName; private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedScopeName = "ASTMethod"; private final String expectedScopeName = "ASTMethod";
private final String expectedContextName = "null"; // should be "ASTClassSpecifier" private final String expectedContextName = "null";
private final CompletionKind expectedKind = CompletionKind.SINGLE_NAME_REFERENCE; // sould be CompletionKind.NEW_TYPE_REFERENCE; private final CompletionKind expectedKind = CompletionKind.NEW_TYPE_REFERENCE;
private final String expectedPrefix = ""; private final String expectedPrefix = "";
private final String[] expectedResults = { private final String[] expectedResults = {
//TODO - Hoda please look into why these results do not resolve
// should be // should be
// "aClass" // "aClass"
}; };
public CompletionFailedTest_NewTypeReference_NoPrefix_Bug50711(String name) { public CompletionTest_NewTypeReference_NoPrefix(String name) {
super(name); super(name);
} }
public static Test suite() { public static Test suite() {
TestSuite suite= new TestSuite(CompletionFailedTest_NewTypeReference_NoPrefix_Bug50711.class.getName()); TestSuite suite= new TestSuite(CompletionTest_NewTypeReference_NoPrefix.class.getName());
suite.addTest(new CompletionFailedTest_NewTypeReference_NoPrefix_Bug50711("testCompletionProposals")); suite.addTest(new CompletionTest_NewTypeReference_NoPrefix("testCompletionProposals"));
return suite; return suite;
} }

View file

@ -8,13 +8,12 @@
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests; package org.eclipse.cdt.ui.tests.text.contentassist;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
/** /**
* @author hamer * @author hamer
@ -23,15 +22,15 @@ import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
* Bug#50711 : Wrong completion kind in a new expression * Bug#50711 : Wrong completion kind in a new expression
* *
*/ */
public class CompletionFailedTest_NewTypeReference_Prefix_Bug50711 extends CompletionProposalsBaseTest{ public class CompletionTest_NewTypeReference_Prefix extends CompletionProposalsBaseTest{
private final String fileName = "CompletionFailedTestStart11.cpp"; private final String fileName = "CompletionFailedTestStart11.cpp";
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName; private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
private final String headerFileName = "CompletionTestStart.h"; private final String headerFileName = "CompletionTestStart.h";
private final String headerFileFullPath ="resources/contentassist/" + headerFileName; private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedScopeName = "ASTMethod"; private final String expectedScopeName = "ASTMethod";
private final String expectedContextName = "null"; // should be "ASTClassSpecifier" private final String expectedContextName = "null";
private final CompletionKind expectedKind = CompletionKind.SINGLE_NAME_REFERENCE; // sould be CompletionKind.NEW_TYPE_REFERENCE; private final CompletionKind expectedKind = CompletionKind.NEW_TYPE_REFERENCE;
private final String expectedPrefix = "a"; private final String expectedPrefix = "a";
private final String[] expectedResults = { private final String[] expectedResults = {
// Should be // Should be
@ -42,13 +41,13 @@ public class CompletionFailedTest_NewTypeReference_Prefix_Bug50711 extends Comp
// "AStruct" // "AStruct"
}; };
public CompletionFailedTest_NewTypeReference_Prefix_Bug50711(String name) { public CompletionTest_NewTypeReference_Prefix(String name) {
super(name); super(name);
} }
public static Test suite() { public static Test suite() {
TestSuite suite= new TestSuite(CompletionFailedTest_NewTypeReference_Prefix_Bug50711.class.getName()); TestSuite suite= new TestSuite(CompletionTest_NewTypeReference_Prefix.class.getName());
suite.addTest(new CompletionFailedTest_NewTypeReference_Prefix_Bug50711("testCompletionProposals")); suite.addTest(new CompletionTest_NewTypeReference_Prefix("testCompletionProposals"));
return suite; return suite;
} }