1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Removes unnecessary code.

This commit is contained in:
Markus Schorn 2007-11-28 08:56:20 +00:00
parent a087fe8745
commit d658efa830
2 changed files with 8 additions and 11 deletions

View file

@ -50,7 +50,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
@ -288,8 +287,7 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
} }
// skip the rest of this node if the selection is outside of its bounds // skip the rest of this node if the selection is outside of its bounds
// TODO take out fix below for bug 86993 check for: !(node instanceof ICPPASTLinkageSpecification) if (node instanceof ASTNode &&
if (node instanceof ASTNode && !(node instanceof ICPPASTLinkageSpecification) &&
offset > ((ASTNode)node).getOffset() + ((ASTNode)node).getLength()) offset > ((ASTNode)node).getOffset() + ((ASTNode)node).getLength())
return PROCESS_SKIP; return PROCESS_SKIP;
@ -299,8 +297,7 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
public int visit(IASTDeclaration declaration) { public int visit(IASTDeclaration declaration) {
// use declarations to determine if the search has gone past the offset (i.e. don't know the order the visitor visits the nodes) // use declarations to determine if the search has gone past the offset (i.e. don't know the order the visitor visits the nodes)
// TODO take out fix below for bug 86993 check for: !(declaration instanceof ICPPASTLinkageSpecification) if (declaration instanceof ASTNode && ((ASTNode)declaration).getOffset() > offset)
if (declaration instanceof ASTNode && !(declaration instanceof ICPPASTLinkageSpecification) && ((ASTNode)declaration).getOffset() > offset)
return PROCESS_ABORT; return PROCESS_ABORT;
return processNode(declaration); return processNode(declaration);

View file

@ -1,15 +1,17 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2006 IBM Corporation and others. * Copyright (c) 2005, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.tests.DOMAST; package org.eclipse.cdt.ui.tests.DOMAST;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator; import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier; import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
@ -35,13 +37,12 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
import org.eclipse.cdt.core.parser.util.ArrayUtil; import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.parser.scanner2.LocationMap.ASTInclusionStatement; import org.eclipse.cdt.internal.core.parser.scanner2.LocationMap.ASTInclusionStatement;
import org.eclipse.core.runtime.IProgressMonitor;
/** /**
* @author dsteffle * @author dsteffle
@ -91,8 +92,7 @@ public class CPPPopulateASTViewAction extends CPPASTVisitor implements IPopulate
if (node == null) return new DOMASTNodeLeafContinue(null); if (node == null) return new DOMASTNodeLeafContinue(null);
// only do length check for ASTNode (getNodeLocations on PreprocessorStatements is very expensive) // only do length check for ASTNode (getNodeLocations on PreprocessorStatements is very expensive)
if (!(node instanceof ICPPASTLinkageSpecification) && if (node instanceof ASTNode && ((ASTNode)node).getLength() <= 0)
node instanceof ASTNode && ((ASTNode)node).getLength() <= 0)
return new DOMASTNodeLeafContinue(null); return new DOMASTNodeLeafContinue(null);
DOMASTNodeParent parent = null; DOMASTNodeParent parent = null;