1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-21 07:55:24 +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. * The template keyword is optional but must be the leftmost token.
*
* This just throws away the template keyword.
*/ */
@Deprecated public void consumeNameWithTemplateKeyword() { public void consumeNameWithTemplateKeyword() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); if(TRACE_ACTIONS)
DebugUtil.printMethodTrace();
IASTName name = (IASTName) astStack.pop(); IASTName name = (IASTName) astStack.pop();
boolean hasTemplateKeyword = astStack.pop() == PLACE_HOLDER;
if(hasTemplateKeyword) astStack.pop(); // pop the template keyword
name = addTemplateKeyword(parser.getLeftIToken(), name);
astStack.push(name); 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() { public void consumeInitDeclaratorComplete() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
// System.out.println(parser.getRuleTokens()); IASTDeclarator declarator = (IASTDeclarator) astStack.peek();
// IASTDeclarator declarator = (IASTDeclarator) astStack.peek(); if(!(declarator instanceof IASTFunctionDeclarator))
// if(!(declarator instanceof IASTFunctionDeclarator)) return;
// return;
// IParser secondaryParser = new CPPNoFunctionDeclaratorParser(parser.getOrderedTerminalSymbols());
// IParser secondaryParser = new CPPNoFunctionDeclaratorParser(parser.getOrderedTerminalSymbols()); IASTNode alternateDeclarator = runSecondaryParser(secondaryParser);
// IASTNode alternateDeclarator = runSecondaryParser(secondaryParser);
// if(alternateDeclarator == null || alternateDeclarator instanceof IASTProblemDeclaration)
// if(alternateDeclarator == null || alternateDeclarator instanceof IASTProblemDeclaration) return;
// return;
// astStack.pop();
// astStack.pop(); IASTNode ambiguityNode = new CPPASTAmbiguousDeclarator(declarator, (IASTDeclarator)alternateDeclarator);
// IASTNode ambiguityNode = new CPPASTAmbiguousDeclarator(declarator, (IASTDeclarator)alternateDeclarator);
// setOffsetAndLength(ambiguityNode);
// setOffsetAndLength(ambiguityNode); astStack.push(ambiguityNode);
// astStack.push(ambiguityNode);
//
if(TRACE_AST_STACK) System.out.println(astStack); if(TRACE_AST_STACK) System.out.println(astStack);
} }