mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 68931 - fix problem reporting in simple type specifiers
This commit is contained in:
parent
99da3b476b
commit
d16e76a28e
3 changed files with 21 additions and 2 deletions
|
@ -75,4 +75,20 @@ public class CompleteParseProblemTest extends CompleteParseBaseTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug68931() throws Exception
|
||||||
|
{
|
||||||
|
String code = "void foo(){ SomeUnknownType t; } "; //$NON-NLS-1$
|
||||||
|
parse( code, false );
|
||||||
|
|
||||||
|
int start = code.indexOf( "SomeUnknownType" ); //$NON-NLS-1$
|
||||||
|
int end = start + 15;
|
||||||
|
|
||||||
|
assertFalse( callback.problems.isEmpty() );
|
||||||
|
assertEquals( callback.problems.size(), 1 );
|
||||||
|
IProblem p = (IProblem) callback.problems.get( 0 );
|
||||||
|
assertTrue( p.checkCategory( IProblem.SEMANTICS_RELATED ));
|
||||||
|
assertEquals( p.getSourceStart(), start );
|
||||||
|
assertEquals( p.getSourceEnd(), end );
|
||||||
|
assertEquals( p.getID(), IProblem.SEMANTIC_NAME_NOT_FOUND );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1126,7 +1126,10 @@ public abstract class Parser extends ExpressionParser implements IParser
|
||||||
{
|
{
|
||||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||||
logException( "simpleDeclaration:createSimpleTypeSpecifier", e1 ); //$NON-NLS-1$
|
logException( "simpleDeclaration:createSimpleTypeSpecifier", e1 ); //$NON-NLS-1$
|
||||||
throwBacktrack(firstOffset, endOffset, firstLine);
|
if( e1 instanceof ASTSemanticException && ((ASTSemanticException)e1).getProblem() != null )
|
||||||
|
throwBacktrack(((ASTSemanticException)e1).getProblem());
|
||||||
|
else
|
||||||
|
throwBacktrack(firstOffset, endOffset, firstLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -2042,7 +2042,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
handleProblem( IProblem.SEMANTIC_NAME_NOT_FOUND, image, -1, -1, current.getLineNumber(), true );
|
handleProblem( IProblem.SEMANTIC_NAME_NOT_FOUND, image, current.getOffset(), current.getEndOffset(), current.getLineNumber(), true );
|
||||||
}
|
}
|
||||||
catch (ParserSymbolTableException e)
|
catch (ParserSymbolTableException e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue