From 037509036d3e15cc895222651f5e594a2d85d8fc Mon Sep 17 00:00:00 2001 From: Mike Kucera Date: Wed, 21 May 2008 16:28:47 +0000 Subject: [PATCH] removed CPPASTAmbiguousDeclarator.accept() --- .../action/cpp/CPPASTAmbiguousDeclarator.java | 72 +++---------------- 1 file changed, 11 insertions(+), 61 deletions(-) diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPASTAmbiguousDeclarator.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPASTAmbiguousDeclarator.java index a617c0e9a0b..a7b17bfaf5e 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPASTAmbiguousDeclarator.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPASTAmbiguousDeclarator.java @@ -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 declarators = new ArrayList(2); + private List declarators = new ArrayList(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) {