mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 301933: Content assist for type-id in cast expression.
This commit is contained in:
parent
cf2231be77
commit
b76048e02f
2 changed files with 21 additions and 7 deletions
|
@ -204,4 +204,15 @@ public class BasicCompletionTest extends CompletionTestBase {
|
|||
String[] expectedCpp= {"test"};
|
||||
checkCompletion(code, true, expectedCpp);
|
||||
}
|
||||
|
||||
// typedef int MyType;
|
||||
// void func(){
|
||||
// static_cast<My
|
||||
public void testCastExpression_Bug301933() throws Exception {
|
||||
String code = getAboveComment();
|
||||
String[] expectedCpp= {"MyType"};
|
||||
checkCompletion(code, true, expectedCpp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1432,10 +1432,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
final IASTTypeId typeID = typeId(DeclarationOptions.TYPEID);
|
||||
if (typeID == null)
|
||||
throw backtrack;
|
||||
consume(IToken.tGT);
|
||||
consume(IToken.tLPAREN);
|
||||
final IASTExpression operand= expression();
|
||||
final int endOffset= consume(IToken.tRPAREN).getEndOffset();
|
||||
consumeOrEOC(IToken.tGT);
|
||||
consumeOrEOC(IToken.tLPAREN);
|
||||
IASTExpression operand= null;
|
||||
if (LT(1) != IToken.tEOC) {
|
||||
operand= expression();
|
||||
}
|
||||
final int endOffset= consumeOrEOC(IToken.tRPAREN).getEndOffset();
|
||||
int operator;
|
||||
switch(optype) {
|
||||
case IToken.t_dynamic_cast:
|
||||
|
@ -2231,7 +2234,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
endOffset= consume().getEndOffset();
|
||||
break;
|
||||
case IToken.t_mutable:
|
||||
storageClass = ICPPASTDeclSpecifier.sc_mutable;
|
||||
storageClass = IASTDeclSpecifier.sc_mutable;
|
||||
endOffset= consume().getEndOffset();
|
||||
break;
|
||||
case IToken.t_typedef:
|
||||
|
@ -2318,14 +2321,14 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
case IToken.t_wchar_t:
|
||||
if (encounteredTypename)
|
||||
break declSpecifiers;
|
||||
simpleType = ICPPASTSimpleDeclSpecifier.t_wchar_t;
|
||||
simpleType = IASTSimpleDeclSpecifier.t_wchar_t;
|
||||
encounteredRawType= true;
|
||||
endOffset= consume().getEndOffset();
|
||||
break;
|
||||
case IToken.t_bool:
|
||||
if (encounteredTypename)
|
||||
break declSpecifiers;
|
||||
simpleType = ICPPASTSimpleDeclSpecifier.t_bool;
|
||||
simpleType = IASTSimpleDeclSpecifier.t_bool;
|
||||
encounteredRawType= true;
|
||||
endOffset= consume().getEndOffset();
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue