mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
fix bug 66744
This commit is contained in:
parent
5c9fe1859c
commit
7bc8d33c1a
3 changed files with 31 additions and 1 deletions
|
@ -282,4 +282,15 @@ public class SelectionParseTest extends SelectionParseBaseTest {
|
||||||
int startIndex = code.indexOf( "foo(1)"); //$NON-NLS-1$
|
int startIndex = code.indexOf( "foo(1)"); //$NON-NLS-1$
|
||||||
parse( code, startIndex, startIndex + 3 );
|
parse( code, startIndex, startIndex + 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug66744() throws Exception
|
||||||
|
{
|
||||||
|
Writer writer = new StringWriter();
|
||||||
|
writer.write( "enum EColours { RED, GREEN, BLUE }; \n" ); //$NON-NLS-1$
|
||||||
|
writer.write( "void foo() { EColours color = GREEN; } \n" ); //$NON-NLS-1$
|
||||||
|
|
||||||
|
String code = writer.toString();
|
||||||
|
int startIndex = code.indexOf( "EColours color"); //$NON-NLS-1$
|
||||||
|
parse( code, startIndex, startIndex + 8 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2651,6 +2651,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
||||||
IToken t = consume(IToken.tRBRACE);
|
IToken t = consume(IToken.tRBRACE);
|
||||||
enumeration.setEndingOffsetAndLineNumber(t.getEndOffset(), t.getLineNumber());
|
enumeration.setEndingOffsetAndLineNumber(t.getEndOffset(), t.getLineNumber());
|
||||||
enumeration.acceptElement( requestor, astFactory.getReferenceManager() );
|
enumeration.acceptElement( requestor, astFactory.getReferenceManager() );
|
||||||
|
handleEnumeration( enumeration );
|
||||||
sdw.setTypeSpecifier(enumeration);
|
sdw.setTypeSpecifier(enumeration);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2660,7 +2661,8 @@ public abstract class Parser extends ExpressionParser implements IParser
|
||||||
throw backtrack;
|
throw backtrack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
|
/**
|
||||||
* Parse a class/struct/union definition.
|
* Parse a class/struct/union definition.
|
||||||
*
|
*
|
||||||
* classSpecifier
|
* classSpecifier
|
||||||
|
@ -3339,6 +3341,11 @@ public abstract class Parser extends ExpressionParser implements IParser
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void handleEnumeration(IASTEnumerationSpecifier enumeration) throws EndOfFileException {
|
||||||
|
cleanupLastToken();
|
||||||
|
handleOffsetableNamedElement( enumeration );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param expression
|
* @param expression
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
|
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
|
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||||
|
@ -376,4 +377,15 @@ public class SelectionParser extends ContextualParser {
|
||||||
throw new EndOfFileException();
|
throw new EndOfFileException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void handleEnumeration(IASTEnumerationSpecifier enumeration) throws EndOfFileException {
|
||||||
|
if( ! tokenDupleCompleted() )
|
||||||
|
super.handleEnumeration(enumeration);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
contextNode = enumeration;
|
||||||
|
handleOffsetableNamedElement( enumeration );
|
||||||
|
throw new EndOfFileException();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue