1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 15:05:36 +02:00

Template rebind tests now pass

This commit is contained in:
Mike Kucera 2008-05-02 19:21:21 +00:00
parent 8a4f9177cd
commit 82df35cc3e

View file

@ -700,15 +700,16 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
/**
* The template keyword is optional but must be the leftmost token.
*
* This just throws away the template keyword.
*/
@Deprecated public void consumeNameWithTemplateKeyword() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
public void consumeNameWithTemplateKeyword() {
if(TRACE_ACTIONS)
DebugUtil.printMethodTrace();
IASTName name = (IASTName) astStack.pop();
boolean hasTemplateKeyword = astStack.pop() == PLACE_HOLDER;
if(hasTemplateKeyword)
name = addTemplateKeyword(parser.getLeftIToken(), name);
astStack.pop(); // pop the template keyword
astStack.push(name);
@ -716,14 +717,6 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
}
@Deprecated private IASTName addTemplateKeyword(final IToken templateKeyword, final IASTName name) {
IASTName replacement = nodeFactory.newName((templateKeyword + " " + name).toCharArray()); //$NON-NLS-1$
int offset = offset(templateKeyword);
int length = length(name) + (offset(name) - offset);
setOffsetAndLength(replacement, offset, length);
return replacement;
}
/**
@ -1258,23 +1251,22 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
public void consumeInitDeclaratorComplete() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
// System.out.println(parser.getRuleTokens());
// IASTDeclarator declarator = (IASTDeclarator) astStack.peek();
// if(!(declarator instanceof IASTFunctionDeclarator))
// return;
//
// IParser secondaryParser = new CPPNoFunctionDeclaratorParser(parser.getOrderedTerminalSymbols());
// IASTNode alternateDeclarator = runSecondaryParser(secondaryParser);
//
// if(alternateDeclarator == null || alternateDeclarator instanceof IASTProblemDeclaration)
// return;
//
// astStack.pop();
// IASTNode ambiguityNode = new CPPASTAmbiguousDeclarator(declarator, (IASTDeclarator)alternateDeclarator);
//
// setOffsetAndLength(ambiguityNode);
// astStack.push(ambiguityNode);
//
IASTDeclarator declarator = (IASTDeclarator) astStack.peek();
if(!(declarator instanceof IASTFunctionDeclarator))
return;
IParser secondaryParser = new CPPNoFunctionDeclaratorParser(parser.getOrderedTerminalSymbols());
IASTNode alternateDeclarator = runSecondaryParser(secondaryParser);
if(alternateDeclarator == null || alternateDeclarator instanceof IASTProblemDeclaration)
return;
astStack.pop();
IASTNode ambiguityNode = new CPPASTAmbiguousDeclarator(declarator, (IASTDeclarator)alternateDeclarator);
setOffsetAndLength(ambiguityNode);
astStack.push(ambiguityNode);
if(TRACE_AST_STACK) System.out.println(astStack);
}