1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

Fixes content assist and refactoring testcases, bug 268306.

This commit is contained in:
Markus Schorn 2009-03-12 10:32:14 +00:00
parent f340cd5908
commit c1b15e81bc
7 changed files with 18 additions and 10 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
* Copyright (c) 2006, 2009 Wind River Systems, Inc. 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
@ -32,6 +32,7 @@ import org.eclipse.cdt.core.model.ElementChangedEvent;
import org.eclipse.cdt.core.model.IElementChangedListener;
import org.eclipse.cdt.core.testplugin.TestScannerProvider;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IProgressMonitor;
@ -123,6 +124,13 @@ public class BaseTestCase extends TestCase {
ILogListener logListener= new ILogListener() {
public void logging(IStatus status, String plugin) {
if(!status.isOK() && status.getSeverity() != IStatus.INFO) {
switch (status.getCode()) {
case IResourceStatus.NOT_FOUND_LOCAL:
case IResourceStatus.NO_LOCATION_LOCAL:
case IResourceStatus.FAILED_READ_LOCAL:
// logged by the resources plugin.
return;
}
statusLog.add(status);
}
}

View file

@ -285,7 +285,7 @@ public class LookupData {
} else if (p1 instanceof ICPPASTNamedTypeSpecifier && p2 instanceof IASTTypeId) {
if (p2.getParent() instanceof ICPPASTNewExpression) {
IASTDeclarator dtor = ((IASTTypeId) p2).getAbstractDeclarator();
if (dtor.getPointerOperators().length == 0)
if (dtor != null && dtor.getPointerOperators().length == 0)
return true;
}
}

View file

@ -160,7 +160,7 @@ public class NodeContainer {
declarator.setName(new CPPASTName(getDeclaration().toCharArray()));
for (IASTPointerOperator pointerOp : sourceDeclarator
.getPointerOperators()) {
declarator.addPointerOperator(pointerOp);
declarator.addPointerOperator(pointerOp.copy());
}
if (isReference && !hasReferenceOperartor(declarator)) {

View file

@ -651,7 +651,7 @@ public class ExtractFunctionRefactoring extends CRefactoring {
for (IASTPointerOperator pointer : orgDecl.getDeclarators()[0]
.getPointerOperators()) {
declarator.addPointerOperator(pointer);
declarator.addPointerOperator(pointer.copy());
}
IASTInitializerExpression initializer = new CPPASTInitializerExpression();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik
* Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -71,7 +71,7 @@ public abstract class ExtractedFunctionConstructionHelper {
IASTDeclarator decl = (IASTDeclarator) returnVariable.getDeclaration().getParent();
IASTPointerOperator[] pointers = decl.getPointerOperators();
for (IASTPointerOperator operator : pointers) {
declarator.addPointerOperator(operator);
declarator.addPointerOperator(operator.copy());
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik
* Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -48,7 +48,7 @@ public class FunctionFactory {
declarator.setConst(true);
declarator.setName(getterName);
for(IASTPointerOperator pointer : fieldDeclaration.getDeclarators()[0].getPointerOperators()){
declarator.addPointerOperator(pointer);
declarator.addPointerOperator(pointer.copy());
}
getter.setDeclarator(declarator);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik
* Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -217,7 +217,7 @@ public class ImplementMethodRefactoring extends CRefactoring {
createdMethodDeclarator.setName(qname);
createdMethodDeclarator.setConst(functionDeclarator.isConst());
for(IASTPointerOperator pop : functionDeclarator.getPointerOperators()) {
createdMethodDeclarator.addPointerOperator(pop);
createdMethodDeclarator.addPointerOperator(pop.copy());
}
func.setDeclarator(createdMethodDeclarator);