mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Andrew Niefer
Core: - fixed bug 43834 : Empty Parameter list and parameter list taking one void do not match - fix NPE if IScannerInfoProvider returns null IScannerInfo Tests: - added testbug43834 to ParserSymbolTableTest
This commit is contained in:
parent
e95da4dade
commit
746563ed2b
6 changed files with 59 additions and 5 deletions
|
@ -1,3 +1,6 @@
|
|||
2003-09-29 Andrew Niefer
|
||||
added testbug43834() to ParserSymbolTableTest
|
||||
|
||||
2003-09-29 John Camelon
|
||||
Added testErrorHandling_1() to CompleteParseASTTest.java.
|
||||
|
||||
|
|
|
@ -2822,5 +2822,27 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
returned = ParserSymbolTable.getConditionalOperand( secondOp, thirdOp );
|
||||
assertEquals( returned, secondOp );
|
||||
}
|
||||
|
||||
public void testbug43834() throws Exception{
|
||||
newTable();
|
||||
|
||||
IParameterizedSymbol f = table.newParameterizedSymbol( "f", TypeInfo.t_function );
|
||||
table.getCompilationUnit().addSymbol( f );
|
||||
|
||||
LinkedList parameters = new LinkedList();
|
||||
TypeInfo param = new TypeInfo( TypeInfo.t_void, 0, null );
|
||||
parameters.add( param );
|
||||
|
||||
|
||||
ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", parameters );
|
||||
assertEquals( look, f );
|
||||
|
||||
f.addParameter( TypeInfo.t_void, 0, null, false );
|
||||
|
||||
parameters.clear();
|
||||
|
||||
look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", parameters );
|
||||
assertEquals( look, f );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2003-09-29 Andrew Niefer
|
||||
fixed bug 43834 : Empty Parameter list and parameter list taking one void do not match
|
||||
|
||||
2003-09-29 John Camelon
|
||||
Continued work on Bug 43062 : Outline is confused on operator methods containing spaces
|
||||
Partial fix for Bug 43680 : Fix Parser Error Handling
|
||||
|
|
|
@ -721,10 +721,20 @@ public class ParserSymbolTable {
|
|||
currFn = (IParameterizedSymbol) iterFns.next();
|
||||
|
||||
sourceParams = data.parameters.iterator();
|
||||
targetParams = currFn.getParameterList().iterator();
|
||||
|
||||
//number of parameters in the current function
|
||||
numTargetParams = currFn.getParameterList().size();
|
||||
List parameterList = null;
|
||||
if( currFn.getParameterList() == null ){
|
||||
//the only way we get here and have no parameters, is if we are looking
|
||||
//for a function that takes void parameters ie f( void )
|
||||
parameterList = new LinkedList();
|
||||
parameterList.add( currFn.getSymbolTable().newSymbol( "", TypeInfo.t_void ) );
|
||||
targetParams = parameterList.iterator();
|
||||
} else {
|
||||
parameterList = currFn.getParameterList();
|
||||
}
|
||||
|
||||
targetParams = parameterList.iterator();
|
||||
numTargetParams = parameterList.size();
|
||||
|
||||
//we only need to look at the smaller number of parameters
|
||||
//(a larger number in the Target means default parameters, a larger
|
||||
|
@ -825,9 +835,21 @@ public class ParserSymbolTable {
|
|||
if( num == numParameters ){
|
||||
continue;
|
||||
}
|
||||
//check for void
|
||||
else if( numParameters == 0 && num == 1 ){
|
||||
ISymbol param = (ISymbol)function.getParameterList().iterator().next();
|
||||
if( param.isType( TypeInfo.t_void ) )
|
||||
continue;
|
||||
}
|
||||
else if( numParameters == 1 && num == 0 ){
|
||||
TypeInfo paramType = (TypeInfo) data.parameters.iterator().next();
|
||||
if( paramType.isType( TypeInfo.t_void ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
//A candidate function having fewer than m parameters is viable only if it has an
|
||||
//ellipsis in its parameter list.
|
||||
else if( num < numParameters ) {
|
||||
if( num < numParameters ) {
|
||||
//TODO ellipsis
|
||||
//not enough parameters, remove it
|
||||
iter.remove();
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2003-09-29 Andrew Niefer
|
||||
-fix NPE if IScannerInfoProvider returns null IScannerInfo
|
||||
|
||||
2003-09-25 Andrew Niefer
|
||||
- bug43129 - Cannot search for definitions of global variables
|
||||
- check definitions for variables, fields, enumerators and namespaces
|
||||
|
|
|
@ -418,7 +418,8 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
|
|||
IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project);
|
||||
if (provider != null){
|
||||
IScannerInfo buildScanInfo = provider.getScannerInformation(project);
|
||||
scanInfo = new ScannerInfo(buildScanInfo.getDefinedSymbols(), buildScanInfo.getIncludePaths());
|
||||
if( buildScanInfo != null )
|
||||
scanInfo = new ScannerInfo(buildScanInfo.getDefinedSymbols(), buildScanInfo.getIncludePaths());
|
||||
}
|
||||
|
||||
ParserLanguage language = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue