1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-13 03:05:39 +02:00

removed CPPASTAmbiguousDeclarator.accept()

This commit is contained in:
Mike Kucera 2008-05-21 16:28:47 +00:00
parent 0982e99b7c
commit 037509036d

View file

@ -1,3 +1,13 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser.action.cpp;
import java.util.ArrayList;
@ -14,7 +24,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguity;
@SuppressWarnings("restriction")
public class CPPASTAmbiguousDeclarator extends CPPASTAmbiguity implements IASTDeclarator {
private List<IASTDeclarator> declarators = new ArrayList<IASTDeclarator>(2);
private List<IASTDeclarator> declarators = new ArrayList<IASTDeclarator>(2);
private int defaultDeclarator = 0;
@ -29,66 +39,6 @@ public class CPPASTAmbiguousDeclarator extends CPPASTAmbiguity implements IASTDe
return declarators.toArray(new IASTDeclarator[declarators.size()]);
}
// @Override
// public boolean accept(ASTVisitor visitor) {
// // this code was copied from CPPASTAmbiguity.accept() and slightly modified.
// IASTNode nodeToReplace = this;
// IASTAmbiguityParent owner = (IASTAmbiguityParent) getParent();
//
// IASTNode[] nodez = getNodes();
// int[] problems = new int[nodez.length];
//
// for(int i = 0; i < nodez.length; ++i) {
// defaultDeclarator = i;
// IASTNode node = nodez[i];
// owner.replace(nodeToReplace, node);
// nodeToReplace = node;
//
// node.accept(visitor);
// NameCollector nameCollector = new NameCollector();
// node.accept(nameCollector);
// IASTName[] names = nameCollector.getNames();
// for(IASTName name : names) {
// if(name.toCharArray().length > 0) { // don't count dummy name nodes
// try {
// IBinding b = name.resolveBinding();
// if(b == null || b instanceof IProblemBinding) {
// ++problems[i];
// }
// } catch (Exception t) {
// t.printStackTrace();
// ++problems[i];
// }
// }
// }
// if(names.length > 0) {
// IScope scope = CPPVisitor.getContainingScope(names[0]);
//
// if( scope != null ) {
// try {
// IScope parentScope = scope;
// do {
// ASTInternal.flushCache(parentScope);
// } while((parentScope = parentScope.getParent()) != null);
// } catch (DOMException de) {}
// }
// }
// }
//
// int bestIndex = 0;
// int bestValue = problems[0];
// for (int i = 1; i < problems.length; ++i) {
// if (problems[i] < bestValue) {
// bestIndex = i;
// bestValue = problems[i];
// }
// }
//
// //IASTAmbiguityParent owner = (IASTAmbiguityParent) getParent();
// owner.replace(nodeToReplace, nodez[bestIndex]);
// defaultDeclarator = 0;
// return true;
// }
public void addDeclarator(IASTDeclarator declarator) {
if(declarator != null) {