mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
org.eclipse.cdt.core
Added support for inline method x-references. Fixed Bug 44340 - Inline functions fail to resolve references Fixed Bug 51243 - Content Assist in an empty document causes a NPE org.eclipse.cdt.core.tests Moved testErrorHandling_1() from failed tests to CompleteParseASTTest. Moved testBug44340() from failed tests to CompleteParseASTTest.
This commit is contained in:
parent
2e52e1bcc2
commit
90c0309950
23 changed files with 208 additions and 68 deletions
|
@ -1,3 +1,7 @@
|
|||
2004-02-08 John Camelon
|
||||
Moved testErrorHandling_1() from failed tests to CompleteParseASTTest.
|
||||
Moved testBug44340() from failed tests to CompleteParseASTTest.
|
||||
|
||||
2004-02-04 John Camelon
|
||||
Added preliminary SelectionParseTests to test SELECTION_PARSE clients.
|
||||
Added SelectionParseTests to ParserTestSuite.
|
||||
|
|
|
@ -12,19 +12,12 @@ package org.eclipse.cdt.core.model.failedTests;
|
|||
***********************************************************************/
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.INamespace;
|
||||
import org.eclipse.cdt.core.model.IStructure;
|
||||
import org.eclipse.cdt.internal.core.model.CElement;
|
||||
import org.eclipse.cdt.internal.core.model.TranslationUnit;
|
||||
import org.eclipse.cdt.testplugin.CProjectHelper;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
|
|
@ -142,38 +142,7 @@ public class FailedCompleteParseASTTest extends CompleteParseBaseTest
|
|||
// assertAllReferences( 4 /*should be 5 */, createTaskList( new Task( cl /* , 2 */ ), new Task( a), new Task( pm), new Task( f2)));
|
||||
}
|
||||
|
||||
public void testErrorHandling_1() throws Exception
|
||||
{
|
||||
Iterator i = parse( "A anA; int x = c; class A {}; A * anotherA = &anA; int b;", false ).getDeclarations();
|
||||
IASTVariable x = (IASTVariable)i.next();
|
||||
assertEquals( x.getName(), "x");
|
||||
IASTClassSpecifier A = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTVariable anotherA = (IASTVariable)i.next();
|
||||
assertFalse(i.hasNext()); // should be true
|
||||
// this variable is skipped because of wrong error handling
|
||||
// IASTVariable b = (IASTVariable)i.next();
|
||||
// assertEquals( b.getName(), "b");
|
||||
// assertFalse(i.hasNext());
|
||||
}
|
||||
|
||||
public void testBug44340() throws Exception {
|
||||
try {
|
||||
// inline function with reference to variables declared after them
|
||||
IASTScope scope = parse ("class A{ int getX() {return x[1];} int x[10];};");
|
||||
Iterator i = scope.getDeclarations();
|
||||
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
Iterator j = getDeclarations(classA);
|
||||
IASTMethod g = (IASTMethod)j.next();
|
||||
IASTField x = (IASTField)j.next();
|
||||
assertFalse(j.hasNext());
|
||||
assertAllReferences( 1, createTaskList( new Task( x )));
|
||||
|
||||
} catch (ParserException e){
|
||||
// parsing fails for now
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void testBug47926() throws Exception{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
|
|
@ -1178,4 +1178,30 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
|||
assertTrue( foo.takesVarArgs() );
|
||||
assertAllReferences( 1, createTaskList( new Task( foo ) ) );
|
||||
}
|
||||
|
||||
public void testErrorHandling_1() throws Exception
|
||||
{
|
||||
Iterator i = parse( "A anA; int x = c; class A {}; A * anotherA = &anA; int b;", false ).getDeclarations();
|
||||
IASTVariable x = (IASTVariable)i.next();
|
||||
assertEquals( x.getName(), "x");
|
||||
IASTClassSpecifier A = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
assertEquals( A.getName(), "A");
|
||||
IASTVariable anotherA = (IASTVariable)i.next();
|
||||
assertEquals( anotherA.getName(), "b");
|
||||
assertFalse(i.hasNext()); // should be true
|
||||
}
|
||||
|
||||
public void testBug44340() throws Exception {
|
||||
// inline function with reference to variables declared after them
|
||||
IASTScope scope = parse ("class A{ int getX() {return x[1];} int x[10];};", false );
|
||||
Iterator i = scope.getDeclarations();
|
||||
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
Iterator j = getDeclarations(classA);
|
||||
IASTMethod g = (IASTMethod)j.next();
|
||||
IASTField x = (IASTField)j.next();
|
||||
assertFalse(j.hasNext());
|
||||
assertAllReferences( 1, createTaskList( new Task( x )));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -177,6 +177,14 @@ public class CompleteParseBaseTest extends TestCase
|
|||
{
|
||||
return nestedScopes.iterator();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getContainingFunction()
|
||||
*/
|
||||
public IASTFunction getContainingFunction() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class FullParseCallback implements ISourceElementRequestor
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2004-02-08 John Camelon
|
||||
Added support for inline method x-references.
|
||||
Fixed Bug 44340 - Inline functions fail to resolve references
|
||||
Fixed Bug 51243 - Content Assist in an empty document causes a NPE
|
||||
|
||||
2004-02-04 John Camelon
|
||||
Added preliminary (crude) bSelectionParser IParser implementation for SELECTION_PARSE clients.
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
|||
*/
|
||||
public interface IASTCodeScope extends IASTScope, ISourceElementCallbackDelegate{
|
||||
|
||||
public IASTCodeScope getOwnerCodeScope();
|
||||
public IASTCodeScope getOwnerCodeScope();
|
||||
public IASTFunction getContainingFunction();
|
||||
|
||||
}
|
||||
|
|
|
@ -30,4 +30,6 @@ public interface IASTMethod extends IASTFunction, IASTMember {
|
|||
public boolean isPureVirtual();
|
||||
|
||||
public Iterator getConstructorChainInitializers();
|
||||
|
||||
public IASTClassSpecifier getOwnerClassSpecifier();
|
||||
}
|
||||
|
|
|
@ -41,12 +41,9 @@ public class CompleteParser extends Parser {
|
|||
scanner.setASTFactory(astFactory);
|
||||
}
|
||||
|
||||
protected void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws BacktrackException, EndOfFileException
|
||||
protected void handleFunctionBody(IASTScope scope) throws BacktrackException, EndOfFileException
|
||||
{
|
||||
if ( isInlineFunction )
|
||||
skipOverCompoundStatement();
|
||||
else
|
||||
functionBody(scope);
|
||||
functionBody(scope);
|
||||
}
|
||||
|
||||
protected void catchBlockCompoundStatement(IASTScope scope) throws BacktrackException, EndOfFileException
|
||||
|
|
|
@ -77,6 +77,7 @@ public class CompletionParser extends CompleteParser implements IParser {
|
|||
* @return
|
||||
*/
|
||||
private Set reconcileKeywords(Set keywords, String prefix) {
|
||||
if( keywords == null ) return null;
|
||||
Set resultSet = new TreeSet();
|
||||
Iterator i = keywords.iterator();
|
||||
while( i.hasNext() )
|
||||
|
|
|
@ -1067,9 +1067,8 @@ public abstract class Parser implements IParser
|
|||
|
||||
if ( !( declaration instanceof IASTScope ) )
|
||||
throw backtrack;
|
||||
|
||||
handleFunctionBody((IASTScope)declaration,
|
||||
sdw.isInline() );
|
||||
|
||||
handleFunctionBody((IASTScope)declaration );
|
||||
((IASTOffsetableElement)declaration).setEndingOffsetAndLineNumber(
|
||||
lastToken.getEndOffset(), lastToken.getLineNumber());
|
||||
|
||||
|
@ -1100,7 +1099,7 @@ public abstract class Parser implements IParser
|
|||
}
|
||||
|
||||
}
|
||||
protected abstract void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws BacktrackException, EndOfFileException;
|
||||
protected abstract void handleFunctionBody(IASTScope scope) throws BacktrackException, EndOfFileException;
|
||||
|
||||
protected void skipOverCompoundStatement() throws BacktrackException, EndOfFileException
|
||||
{
|
||||
|
@ -2838,6 +2837,7 @@ public abstract class Parser implements IParser
|
|||
|
||||
astClassSpecifier.exitScope( requestor );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ public class QuickParser extends Parser {
|
|||
scanner.setASTFactory(astFactory);
|
||||
}
|
||||
|
||||
protected void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws BacktrackException, EndOfFileException
|
||||
protected void handleFunctionBody(IASTScope scope) throws BacktrackException, EndOfFileException
|
||||
{
|
||||
skipOverCompoundStatement();
|
||||
}
|
||||
|
|
|
@ -46,8 +46,7 @@ public class StructuralParser extends Parser implements IParser {
|
|||
* @see org.eclipse.cdt.internal.core.parser.Parser#handleFunctionBody(org.eclipse.cdt.core.parser.ast.IASTScope, boolean)
|
||||
*/
|
||||
protected void handleFunctionBody(
|
||||
IASTScope scope,
|
||||
boolean isInlineFunction)
|
||||
IASTScope scope)
|
||||
throws BacktrackException, EndOfFileException {
|
||||
skipOverCompoundStatement();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.parser.ast.ASTClassKind;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
|
||||
|
@ -193,6 +194,11 @@ public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier
|
|||
*/
|
||||
public void exitScope(ISourceElementRequestor requestor)
|
||||
{
|
||||
Iterator i = resolvedCrossReferences.iterator();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
((IASTReference)i.next()).acceptElement( requestor );
|
||||
}
|
||||
try
|
||||
{
|
||||
requestor.exitClassSpecifier(this);
|
||||
|
@ -201,6 +207,7 @@ public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier
|
|||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
|
||||
|
@ -263,6 +270,7 @@ public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier
|
|||
{
|
||||
return declarations.iterator();
|
||||
}
|
||||
|
||||
public void addDeclaration(IASTDeclaration declaration)
|
||||
{
|
||||
declarations.add(declaration);
|
||||
|
@ -287,4 +295,24 @@ public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier
|
|||
public int getNameLineNumber() {
|
||||
return offsets.getNameLineNumber();
|
||||
}
|
||||
|
||||
private List unresolvedCrossReferences = new ArrayList();
|
||||
|
||||
public void addUnresolvedReference( UnresolvedReferenceDuple duple)
|
||||
{
|
||||
unresolvedCrossReferences.add( duple );
|
||||
}
|
||||
|
||||
public Iterator getUnresolvedReferences()
|
||||
{
|
||||
return unresolvedCrossReferences.iterator();
|
||||
}
|
||||
|
||||
private List resolvedCrossReferences = new ArrayList();
|
||||
/**
|
||||
* @param references2
|
||||
*/
|
||||
public void setExtraReferences(List references) {
|
||||
resolvedCrossReferences.addAll( references );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,13 +13,12 @@ import java.util.List;
|
|||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class ASTCodeScope extends ASTScope implements IASTCodeScope {
|
||||
|
||||
|
@ -88,4 +87,14 @@ public class ASTCodeScope extends ASTScope implements IASTCodeScope {
|
|||
declarations.add(declaration);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getContainingFunction()
|
||||
*/
|
||||
public IASTFunction getContainingFunction() {
|
||||
IASTCodeScope i = getOwnerCodeScope();
|
||||
while( (i != null ) && !( i instanceof IASTFunction ))
|
||||
i = i.getOwnerCodeScope();
|
||||
return (IASTFunction) i;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -356,4 +356,12 @@ public class ASTFunction extends ASTScope implements IASTFunction
|
|||
public int getNameLineNumber() {
|
||||
return offsets.getNameLineNumber();
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getContainingFunction()
|
||||
*/
|
||||
public IASTFunction getContainingFunction() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
||||
|
@ -192,4 +193,10 @@ public class ASTMethod extends ASTFunction implements IASTMethod
|
|||
return new EmptyIterator();
|
||||
return constructorChain.iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTMethod#getOwnerClassSpecifier()
|
||||
*/
|
||||
public IASTClassSpecifier getOwnerClassSpecifier() {
|
||||
return (IASTClassSpecifier) getOwnerScope();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,12 +95,9 @@ import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension.ExtensionExc
|
|||
*/
|
||||
public class CompleteParseASTFactory extends BaseASTFactory implements IASTFactory
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
private final static List SUBSCRIPT;
|
||||
private final IASTExtensionFactory extensionFactory;
|
||||
//private final IASTExtensionFactory extensionFactory;
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -124,7 +121,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
{
|
||||
super();
|
||||
pst = new ParserSymbolTable( language, mode );
|
||||
extensionFactory = factory;
|
||||
// extensionFactory = factory;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -271,7 +268,18 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
if( result != null )
|
||||
addReference( references, createReference( result, firstSymbol.getImage(), firstSymbol.getOffset() ));
|
||||
else
|
||||
throw new ASTSemanticException();
|
||||
{
|
||||
if( startingScope.getASTExtension().getPrimaryDeclaration() instanceof IASTCodeScope )
|
||||
{
|
||||
if( ((IASTCodeScope) startingScope.getASTExtension().getPrimaryDeclaration()).getContainingFunction() instanceof IASTMethod )
|
||||
{
|
||||
IASTClassSpecifier classSpecifier = ((IASTMethod) ((IASTCodeScope) startingScope.getASTExtension().getPrimaryDeclaration()).getContainingFunction()).getOwnerClassSpecifier();
|
||||
((ASTClassSpecifier)classSpecifier).addUnresolvedReference( new UnresolvedReferenceDuple( startingScope, name ));
|
||||
break;
|
||||
}
|
||||
}
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
}
|
||||
catch (ParserSymbolTableException e)
|
||||
{
|
||||
|
@ -667,8 +675,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
*/
|
||||
protected IASTReference createReference(ISymbol symbol, String string, int offset ) throws ASTSemanticException
|
||||
{
|
||||
if( symbol == null )
|
||||
throw new ASTSemanticException();
|
||||
if( symbol == null ) throw new ASTSemanticException();
|
||||
|
||||
if( symbol.getType() == TypeInfo.t_namespace )
|
||||
{
|
||||
|
@ -2489,7 +2496,6 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
ISymbol newSymbol = pst.newSymbol( name, TypeInfo.t_type);
|
||||
newSymbol.getTypeInfo().setBit( true,TypeInfo.isTypedef );
|
||||
|
||||
|
||||
List references = new ArrayList();
|
||||
if( mapping.getTypeSpecifier() instanceof ASTSimpleTypeSpecifier )
|
||||
{
|
||||
|
@ -2786,15 +2792,41 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
*/
|
||||
public void signalEndOfClassSpecifier(IASTClassSpecifier astClassSpecifier)
|
||||
{
|
||||
if( astClassSpecifier == null ) return;
|
||||
ASTClassSpecifier astImplementation = (ASTClassSpecifier)astClassSpecifier;
|
||||
try
|
||||
{
|
||||
((IDerivableContainerSymbol)((ASTClassSpecifier)astClassSpecifier).getSymbol()).addCopyConstructor();
|
||||
{
|
||||
((IDerivableContainerSymbol)(astImplementation).getSymbol()).addCopyConstructor();
|
||||
}
|
||||
catch (ParserSymbolTableException e)
|
||||
{
|
||||
// do nothing, this is best effort
|
||||
}
|
||||
|
||||
Iterator i = astImplementation.getUnresolvedReferences();
|
||||
List references = new ArrayList();
|
||||
while( i.hasNext() )
|
||||
{
|
||||
UnresolvedReferenceDuple duple = (UnresolvedReferenceDuple) i.next();
|
||||
ISymbol s = null;
|
||||
|
||||
List subReferences = new ArrayList();
|
||||
try
|
||||
{
|
||||
s = lookupQualifiedName( duple.getScope(), duple.getName(), subReferences, false );
|
||||
}
|
||||
catch( ASTSemanticException ase )
|
||||
{
|
||||
}
|
||||
|
||||
if( s != null )
|
||||
references.addAll( subReferences );
|
||||
|
||||
|
||||
}
|
||||
|
||||
if( ! references.isEmpty() )
|
||||
astImplementation.setExtraReferences( references );
|
||||
|
||||
}
|
||||
|
||||
public IASTInitializerClause createInitializerClause(IASTScope scope, IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses, List designators)
|
||||
|
@ -2835,4 +2867,5 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
return null;
|
||||
return s.getASTExtension().getPrimaryDeclaration();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.ast.complete;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class UnresolvedReferenceDuple {
|
||||
|
||||
public UnresolvedReferenceDuple( IContainerSymbol scope, ITokenDuple name ){
|
||||
this.scope = scope;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
private final IContainerSymbol scope;
|
||||
private final ITokenDuple name;
|
||||
|
||||
public IContainerSymbol getScope()
|
||||
{
|
||||
return scope;
|
||||
}
|
||||
|
||||
public ITokenDuple getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
|
@ -308,4 +308,10 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction
|
|||
public int getNameLineNumber() {
|
||||
return offsets.getNameLineNumber();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getContainingFunction()
|
||||
*/
|
||||
public IASTFunction getContainingFunction() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.List;
|
|||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
|
||||
|
@ -210,4 +211,10 @@ public class ASTMethod extends ASTFunction implements IASTMethod
|
|||
return new EmptyIterator();
|
||||
return constructorChainElements.iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTMethod#getOwnerClassSpecifier()
|
||||
*/
|
||||
public IASTClassSpecifier getOwnerClassSpecifier() {
|
||||
return (IASTClassSpecifier) getOwnerScope();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -353,5 +353,4 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
public IASTNode lookupSymbolInContext(IASTScope scope, ITokenDuple duple) throws ASTNotImplementedException {
|
||||
throw new ASTNotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2098,7 +2098,7 @@ public class Scanner implements IScanner {
|
|||
if( offsetLimit == NO_OFFSET_LIMIT )
|
||||
throw new EndOfFileException();
|
||||
|
||||
if( finalToken.getEndOffset() == offsetLimit )
|
||||
if( finalToken != null && finalToken.getEndOffset() == offsetLimit )
|
||||
throw new OffsetLimitReachedException(finalToken);
|
||||
throw new OffsetLimitReachedException( (IToken)null );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue