mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Make the TypeInfoProvider non-static
This commit is contained in:
parent
a464b6bbf5
commit
cb4ec57f90
11 changed files with 292 additions and 271 deletions
|
@ -108,7 +108,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
|
||||
look = instance.lookup( "i" ); //$NON-NLS-1$
|
||||
assertEquals( look, i );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -166,7 +166,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), t );
|
||||
assertTrue( look.isType( TypeInfo.t_int ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -236,7 +236,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), u );
|
||||
assertTrue( look.isType( TypeInfo.t_char ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -310,7 +310,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
|
||||
ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$
|
||||
assertEquals( look, f2 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -362,7 +362,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
|
||||
look = f.lookup( "i" ); //$NON-NLS-1$
|
||||
assertEquals( look, parami );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -451,7 +451,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
look = table.getCompilationUnit().lookupTemplateId( "S", args ); //$NON-NLS-1$
|
||||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), S );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -483,7 +483,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
ISymbol look = table.getCompilationUnit().lookupTemplateId( "String", args ); //$NON-NLS-1$
|
||||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), string );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -534,7 +534,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
} catch( ParserSymbolTableException e ){
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_BadTemplateArgument );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -590,7 +590,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
ISymbol look = table.getCompilationUnit().lookupTemplateId( "X", args ); //$NON-NLS-1$
|
||||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), X );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -670,7 +670,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
args.add( arg );
|
||||
|
||||
assertNotNull( table.getCompilationUnit().lookupTemplateId( "X", args ) ); //$NON-NLS-1$
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -720,7 +720,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
ISymbol look = table.getCompilationUnit().lookupTemplateId( "B", args ); //$NON-NLS-1$
|
||||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), B );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,7 +841,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
|
||||
assertEquals( look.getType(), TypeInfo.t_int );
|
||||
assertEquals( look.getTypeInfo().checkBit( TypeInfo.isLong ), true );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -955,7 +955,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
} catch ( ParserSymbolTableException e ){
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_BadTemplate );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1032,7 +1032,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), i );
|
||||
assertEquals( look.getType(), TypeInfo.t_int );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1106,7 +1106,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
assertTrue( look.isType( TypeInfo.t_float ) );
|
||||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), newS );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1213,7 +1213,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
assertTrue( look.getInstantiatedSymbol().isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol().getInstantiatedSymbol(), u );
|
||||
assertTrue( look.isType( TypeInfo.t_int ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1261,7 +1261,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
f.getTypeInfo().setBit( true, TypeInfo.isVirtual );
|
||||
|
||||
A.addSymbol( f );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1324,7 +1324,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
assertTrue( look != null );
|
||||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), A2 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1487,7 +1487,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
} catch ( ParserSymbolTableException e ){
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1551,7 +1551,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$
|
||||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), f3 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1599,7 +1599,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
} catch( ParserSymbolTableException e ){
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1681,7 +1681,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
look = table.getCompilationUnit().unqualifiedFunctionLookup( "h", params ); //$NON-NLS-1$
|
||||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), h1 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1720,7 +1720,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
TypeInfo type = (TypeInfo) iter.next();
|
||||
assertTrue( type.isType( TypeInfo.t_type ) );
|
||||
assertEquals( type.getTypeSymbol(), T );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1759,7 +1759,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), Y2 );
|
||||
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1819,7 +1819,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
} catch( ParserSymbolTableException e ){
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_BadTemplateParameter );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1897,7 +1897,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
flook = look.qualifiedFunctionLookup( "f", args ); //$NON-NLS-1$
|
||||
|
||||
assertEquals( flook, f3 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1965,7 +1965,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
|
||||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), newSort );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2053,7 +2053,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", args ); //$NON-NLS-1$
|
||||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), f5 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2142,7 +2142,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", argList ); //$NON-NLS-1$
|
||||
assertTrue( look.isTemplateInstance());
|
||||
assertEquals( look.getInstantiatedSymbol(), f );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2224,7 +2224,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
arg.setTypeSymbol( g3 );
|
||||
look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", argList ); //$NON-NLS-1$
|
||||
assertEquals( look, null );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
/**
|
||||
* template< class T > void f( const T * ){}
|
||||
|
@ -2274,7 +2274,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
assertTrue( op.isConst() );
|
||||
assertEquals( op.getType(), PtrOp.t_pointer );
|
||||
assertFalse( iter.hasNext() );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2392,7 +2392,7 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
|
||||
//both are the template function instantiated with int, should be the same instance.
|
||||
assertEquals( look, look2 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2619,6 +2619,6 @@ public class ParserSymbolTableTemplateTests extends TestCase {
|
|||
assertTrue( look.isTemplateInstance() );
|
||||
assertEquals( look.getInstantiatedSymbol(), c3 );
|
||||
assertTrue( look.isType( TypeInfo.t_float ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
}
|
|
@ -95,7 +95,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
assertEquals( false, iter.hasNext() );
|
||||
assertEquals( x, contained );
|
||||
assertEquals( contained.getName(), "x" ); //$NON-NLS-1$
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,7 +112,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
ISymbol look = table.getCompilationUnit().lookup( "x" ); //$NON-NLS-1$
|
||||
|
||||
assertEquals( x, look );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
public void testLookupNonExistant() throws Exception{
|
||||
|
@ -120,7 +120,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
ISymbol look = table.getCompilationUnit().lookup("boo"); //$NON-NLS-1$
|
||||
assertEquals( look, null );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
public void testSimpleSetGetObject() throws Exception{
|
||||
|
@ -137,7 +137,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
ISymbol look = table.getCompilationUnit().lookup( "x" ); //$NON-NLS-1$
|
||||
|
||||
assertEquals( look.getASTExtension(), extension );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,7 +167,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = table.getCompilationUnit().lookup( "x" ); //$NON-NLS-1$
|
||||
assertEquals( look, firstX );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -188,7 +188,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
ISymbol look = decl.lookup( "x" ); //$NON-NLS-1$
|
||||
|
||||
assertEquals( x, look );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,7 +215,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
ISymbol look = class1.lookup( "x" ); //$NON-NLS-1$
|
||||
assertEquals( look, decl );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -246,7 +246,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
catch ( ParserSymbolTableException e ){
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,7 +272,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
} catch ( ParserSymbolTableException e) {
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_CircularInheritance );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
/**
|
||||
* testVirtualParentLookup
|
||||
|
@ -314,7 +314,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
ISymbol look = decl.lookup( "x" ); //$NON-NLS-1$
|
||||
|
||||
assertEquals( look, x );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -349,7 +349,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
catch( ParserSymbolTableException e){
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -423,7 +423,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
catch ( ParserSymbolTableException e){
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -470,7 +470,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
look = a.elaboratedLookup( TypeInfo.t_union, "union" ); //$NON-NLS-1$
|
||||
assertEquals( look, union );
|
||||
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -508,7 +508,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = type.lookup("member"); //$NON-NLS-1$
|
||||
assertEquals( look, member );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -547,7 +547,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = f.lookup( "stat" ); //$NON-NLS-1$
|
||||
assertEquals( look, function );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -654,7 +654,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = f4.lookup("i"); //$NON-NLS-1$
|
||||
assertEquals( look, null );//neither i is visible here.
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -721,7 +721,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = ((IContainerSymbol) look).qualifiedLookup("i"); //ok //$NON-NLS-1$
|
||||
assertEquals( look, nsN_i );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -784,7 +784,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
assertEquals( look, nsBC );
|
||||
look = ((IContainerSymbol)look).qualifiedLookup("a"); //$NON-NLS-1$
|
||||
assertEquals( look, a );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -851,7 +851,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = lookB.qualifiedLookup("b"); //$NON-NLS-1$
|
||||
assertEquals( look, b );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -899,7 +899,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
ISymbol look = f.lookup("i"); //$NON-NLS-1$
|
||||
assertEquals( look, null );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -984,7 +984,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
} catch ( ParserSymbolTableException e ) {
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1029,7 +1029,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
//but notice if you wanted to do A::f1 as a function call, it is ok
|
||||
look = lookA.qualifiedLookup( "f1" ); //$NON-NLS-1$
|
||||
assertEquals( look, f1 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1116,7 +1116,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
catch ( ParserSymbolTableException exception ){
|
||||
assertTrue( true );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1209,7 +1209,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
look = bar.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$
|
||||
assertTrue( look != null );
|
||||
assertEquals( look, list.get( index ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1241,7 +1241,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
assertEquals( ((PtrOp)look.getPtrOperators().iterator().next()).getType(), TypeInfo.PtrOp.t_pointer );
|
||||
|
||||
assertEquals( look.getContainingSymbol(), fn );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1272,7 +1272,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
assertEquals( look, enumerator );
|
||||
assertEquals( look.getContainingSymbol(), cls );
|
||||
assertEquals( look.getTypeSymbol(), enumeration );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1336,7 +1336,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = main.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$
|
||||
assertEquals( look, f );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1424,7 +1424,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$
|
||||
assertEquals( look, f2 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1507,7 +1507,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
paramList.add( p3 );
|
||||
look = C.memberFunctionLookup( "foo", paramList ); //$NON-NLS-1$
|
||||
assertEquals( look, f3 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1558,7 +1558,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = compUnit.unqualifiedFunctionLookup( "f", null ); //$NON-NLS-1$
|
||||
assertEquals( look, f2 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1628,7 +1628,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
paramList.add( p2 );
|
||||
look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$
|
||||
assertEquals( look, f2 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1716,7 +1716,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
p.getOperatorExpressions().clear();
|
||||
look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$
|
||||
assertEquals( look, f1 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1769,7 +1769,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
ISymbol look = compUnit.unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$
|
||||
assertEquals( look, f );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1861,7 +1861,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
params.add( p3 );
|
||||
look = main.unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$
|
||||
assertEquals( look, f1 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1961,7 +1961,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = compUnit.unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$
|
||||
assertEquals( look, f3 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
// public void testMarkRollback() throws Exception{
|
||||
|
@ -2064,7 +2064,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
lookup = table.getCompilationUnit().elaboratedLookup( TypeInfo.t_class, "A" ); //$NON-NLS-1$
|
||||
assertEquals( lookup, classA );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2154,7 +2154,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
paramList.add( p1 );
|
||||
look = classB.memberFunctionLookup( "f", paramList ); //$NON-NLS-1$
|
||||
assertEquals( look, fn1 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
public void testConstructors() throws Exception{
|
||||
|
@ -2190,7 +2190,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
ISymbol lookup = classA.lookupConstructor( paramList );
|
||||
|
||||
assertEquals( lookup, constructor2 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2224,7 +2224,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
lookup = NSB.lookup( "x" ); //$NON-NLS-1$
|
||||
assertEquals( lookup, x );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2265,7 +2265,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$
|
||||
assertEquals( look, f );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2306,7 +2306,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", paramList ); //$NON-NLS-1$
|
||||
|
||||
assertEquals( look, null );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2349,7 +2349,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
TypeInfo thirdOp = new TypeInfo( TypeInfo.t_type, 0, b );
|
||||
thirdOp.addOperatorExpression( OperatorExpression.addressof );
|
||||
|
||||
TypeInfo returned = ParserSymbolTable.getConditionalOperand( secondOp, thirdOp );
|
||||
TypeInfo returned = table.getConditionalOperand( secondOp, thirdOp );
|
||||
assertEquals( returned, secondOp );
|
||||
|
||||
IDerivableContainerSymbol clsC = table.newDerivableContainerSymbol( "C", TypeInfo.t_class ); //$NON-NLS-1$
|
||||
|
@ -2361,7 +2361,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
TypeInfo anotherOp = new TypeInfo( TypeInfo.t_type, 0, c );
|
||||
anotherOp.addOperatorExpression( OperatorExpression.addressof );
|
||||
|
||||
returned = ParserSymbolTable.getConditionalOperand( secondOp, anotherOp );
|
||||
returned = table.getConditionalOperand( secondOp, anotherOp );
|
||||
assertEquals( returned, null );
|
||||
|
||||
IParameterizedSymbol constructorA = table.newParameterizedSymbol( "A", TypeInfo.t_constructor ); //$NON-NLS-1$
|
||||
|
@ -2376,12 +2376,12 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
anotherOp.getOperatorExpressions().clear();
|
||||
try{
|
||||
|
||||
returned = ParserSymbolTable.getConditionalOperand( secondOp, anotherOp );
|
||||
returned = table.getConditionalOperand( secondOp, anotherOp );
|
||||
assertTrue( false );
|
||||
} catch ( ParserSymbolTableException e ){
|
||||
//good
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2448,7 +2448,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
} catch ( ParserSymbolTableException e ){
|
||||
//good
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2494,15 +2494,15 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
TypeInfo secondOp = new TypeInfo( TypeInfo.t_type, 0, a, null, false );
|
||||
TypeInfo thirdOp = new TypeInfo( TypeInfo.t_type, 0, b, null, false );
|
||||
|
||||
TypeInfo returned = ParserSymbolTable.getConditionalOperand( secondOp, thirdOp );
|
||||
TypeInfo returned = table.getConditionalOperand( secondOp, thirdOp );
|
||||
assertEquals( returned, null );
|
||||
|
||||
clsA.addCopyConstructor();
|
||||
clsB.addCopyConstructor();
|
||||
|
||||
returned = ParserSymbolTable.getConditionalOperand( secondOp, thirdOp );
|
||||
returned = table.getConditionalOperand( secondOp, thirdOp );
|
||||
assertEquals( returned, secondOp );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
public void testbug43834() throws Exception{
|
||||
|
@ -2525,7 +2525,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", parameters ); //$NON-NLS-1$
|
||||
assertEquals( look, f );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2567,7 +2567,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
} catch ( ParserSymbolTableException e ){
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2594,7 +2594,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
} catch( ParserSymbolTableException e ){
|
||||
assertEquals( e.reason, ParserSymbolTableException.r_UnableToResolveFunction );
|
||||
}
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2627,7 +2627,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
look = table.getCompilationUnit().unqualifiedFunctionLookup( "initialize", new ArrayList() ); //$NON-NLS-1$
|
||||
|
||||
assertEquals( look, init2 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2675,7 +2675,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
params.clear();
|
||||
look = B.qualifiedFunctionLookup( "f", params ); //$NON-NLS-1$
|
||||
assertEquals( look, null );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2703,7 +2703,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
assertTrue( results.contains( aVar ) );
|
||||
assertTrue( results.contains( anotherVar ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2741,7 +2741,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
assertTrue( results.contains( aField ) );
|
||||
assertTrue( results.contains( aMethod ) );
|
||||
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2795,7 +2795,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
assertTrue( results.contains( aVar ) );
|
||||
assertTrue( results.contains( anotherVar2 ) );
|
||||
assertTrue( results.contains( af2 ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2857,7 +2857,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
assertTrue( results != null );
|
||||
assertEquals( results.size(), 1 );
|
||||
assertTrue( results.contains( aa ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2886,7 +2886,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
assertEquals( null, A.qualifiedLookup( "i" ) ); //$NON-NLS-1$
|
||||
assertEquals( i, g.lookup( "i" ) ); //$NON-NLS-1$
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2951,7 +2951,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
assertTrue( table.getCompilationUnit().isVisible(i, C ) );
|
||||
assertTrue( D.isVisible( j, A ) );
|
||||
assertFalse( D.isVisible( j, B ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3035,7 +3035,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
results = f.prefixLookup( new TypeFilter( LookupKind.FIELDS), "a", false, null ); //$NON-NLS-1$
|
||||
assertEquals( results.size(), 1 );
|
||||
assertTrue( results.contains( a3_int ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3061,7 +3061,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "foo", params ); //$NON-NLS-1$
|
||||
|
||||
assertEquals( foo, look );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3091,7 +3091,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "foo", params ); //$NON-NLS-1$
|
||||
|
||||
assertEquals( foo2, look );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3117,7 +3117,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
ISymbol look = table.getCompilationUnit().unqualifiedFunctionLookup( "foo", params ); //$NON-NLS-1$
|
||||
|
||||
assertEquals( foo1, look );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3160,7 +3160,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
assertEquals( iter.next(), var );
|
||||
assertEquals( iter.next(), foo );
|
||||
assertFalse( iter.hasNext() );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3239,7 +3239,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
assertEquals( iter.next(), using );
|
||||
|
||||
assertFalse( iter.hasNext() );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3271,7 +3271,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
params.add( new TypeInfo( TypeInfo.t_int, TypeInfo.isLongLong, null ) );
|
||||
lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$
|
||||
assertEquals( lookup, f1 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3324,7 +3324,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
|
||||
lookup = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$
|
||||
assertEquals( lookup, f );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
public void test_Bool() throws Exception{
|
||||
|
@ -3353,7 +3353,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
params.add( new TypeInfo( TypeInfo.t_int, 0, null ) );
|
||||
look = table.getCompilationUnit().unqualifiedFunctionLookup( "f", params ); //$NON-NLS-1$
|
||||
assertEquals( look, f );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3378,7 +3378,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
f2.addParameter( Int, 0, null, false );
|
||||
|
||||
assertTrue( f1.hasSameParameters( f2 ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3395,7 +3395,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
g2.addParameter( TypeInfo.t_char, 0, new PtrOp( PtrOp.t_array ), false );
|
||||
|
||||
assertTrue( g1.hasSameParameters( g2 ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3415,7 +3415,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
h2.addParameter( f, 0, new PtrOp( PtrOp.t_pointer ), false );
|
||||
|
||||
assertTrue( h1.hasSameParameters( h2 ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3432,7 +3432,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
f2.addParameter( TypeInfo.t_int, TypeInfo.isConst, null, false );
|
||||
|
||||
assertTrue( f1.hasSameParameters( f2 ) );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
|
||||
public void testBug52111RemoveSymbol() throws Exception{
|
||||
|
@ -3502,7 +3502,7 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
assertNull( look );
|
||||
|
||||
assertEquals( A.getContainedSymbols().size(), 0 );
|
||||
assertEquals( ParserSymbolTable.TypeInfoProvider.numAllocated(), 0 );
|
||||
assertEquals( table.getTypeInfoProvider().numAllocated(), 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.core.parser.ast.IReferenceManager;
|
|||
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.TypeInfoProvider;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -175,14 +176,16 @@ public abstract class ASTExpression extends ASTNode implements IASTExpression
|
|||
ExpressionResult result = getResultType();
|
||||
TypeInfo type = (result != null ) ? result.getResult() : null;
|
||||
IContainerSymbol containerSymbol = null;
|
||||
if( type != null ){
|
||||
type = type.getFinalType(true);
|
||||
|
||||
if( type != null && type.getTypeSymbol() != null ){
|
||||
TypeInfoProvider provider = type.getTypeSymbol().getSymbolTable().getTypeInfoProvider();
|
||||
type = type.getFinalType( provider );
|
||||
if( type.isType( TypeInfo.t_type ) &&
|
||||
type.getTypeSymbol() != null && type.getTypeSymbol() instanceof IContainerSymbol )
|
||||
{
|
||||
containerSymbol = (IContainerSymbol) type.getTypeSymbol();
|
||||
}
|
||||
type.release();
|
||||
provider.returnTypeInfo( type );
|
||||
}
|
||||
|
||||
return containerSymbol;
|
||||
|
@ -193,18 +196,15 @@ public abstract class ASTExpression extends ASTNode implements IASTExpression
|
|||
TypeInfo type = ( result != null ) ? result.getResult() : null;
|
||||
if( type != null ){
|
||||
boolean answer = false;
|
||||
type = type.getFinalType(true);
|
||||
if( type.checkBit( TypeInfo.isConst ) && !symbol.getTypeInfo().checkBit( TypeInfo.isConst ) )
|
||||
{
|
||||
|
||||
TypeInfoProvider provider = symbol.getSymbolTable().getTypeInfoProvider();
|
||||
type = type.getFinalType( provider );
|
||||
if( type.checkBit( TypeInfo.isConst ) && !symbol.getTypeInfo().checkBit( TypeInfo.isConst ) )
|
||||
answer = true;
|
||||
}
|
||||
|
||||
if( type.checkBit( TypeInfo.isVolatile ) && !symbol.getTypeInfo().checkBit( TypeInfo.isVolatile ) )
|
||||
{
|
||||
answer = true;
|
||||
}
|
||||
type.release();
|
||||
|
||||
provider.returnTypeInfo( type );
|
||||
return answer;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.core.parser.ast.IASTScope;
|
|||
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTableError;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
|
||||
|
||||
|
@ -43,9 +44,11 @@ public abstract class ASTSymbol extends ASTSymbolOwner implements ISymbolOwner,
|
|||
public IContainerSymbol getLookupQualificationSymbol() throws LookupError {
|
||||
ISymbol sym = getSymbol();
|
||||
IContainerSymbol result = null;
|
||||
ParserSymbolTable.TypeInfoProvider provider = sym.getSymbolTable().getTypeInfoProvider();
|
||||
TypeInfo info = null;
|
||||
|
||||
try{
|
||||
info = sym.getTypeInfo().getFinalType(true);
|
||||
info = sym.getTypeInfo().getFinalType( provider );
|
||||
} catch( ParserSymbolTableError e ){
|
||||
throw new LookupError();
|
||||
}
|
||||
|
@ -55,15 +58,16 @@ public abstract class ASTSymbol extends ASTSymbolOwner implements ISymbolOwner,
|
|||
else if( sym instanceof IContainerSymbol )
|
||||
result = (IContainerSymbol) sym;
|
||||
|
||||
info.release();
|
||||
provider.returnTypeInfo( info );
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean shouldFilterLookupResult( ISymbol sym ){
|
||||
boolean result = false;
|
||||
ParserSymbolTable.TypeInfoProvider provider = sym.getSymbolTable().getTypeInfoProvider();
|
||||
TypeInfo info = null;
|
||||
try{
|
||||
info = getSymbol().getTypeInfo().getFinalType(true);
|
||||
info = getSymbol().getTypeInfo().getFinalType( provider );
|
||||
} catch( ParserSymbolTableError e ){
|
||||
return true;
|
||||
}
|
||||
|
@ -74,7 +78,7 @@ public abstract class ASTSymbol extends ASTSymbolOwner implements ISymbolOwner,
|
|||
if( info.checkBit( TypeInfo.isVolatile ) && !sym.getTypeInfo().checkBit( TypeInfo.isVolatile ) )
|
||||
result = true;
|
||||
|
||||
info.release();
|
||||
provider.returnTypeInfo( info );
|
||||
return result;
|
||||
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@ import org.eclipse.cdt.internal.core.parser.pst.StandardSymbolExtension;
|
|||
import org.eclipse.cdt.internal.core.parser.pst.TemplateSymbolExtension;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension.ExtensionException;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.TypeInfoProvider;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.TypeInfo.PtrOp;
|
||||
import org.eclipse.cdt.internal.core.parser.token.TokenFactory;
|
||||
import org.eclipse.cdt.internal.core.parser.util.TraceUtil;
|
||||
|
@ -1160,9 +1161,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
|
||||
private boolean createConstructorReference( ISymbol classSymbol, ASTExpression expressionList, ITokenDuple duple, List references ){
|
||||
if( classSymbol != null && classSymbol.getTypeInfo().checkBit( TypeInfo.isTypedef ) ){
|
||||
TypeInfo info = classSymbol.getTypeInfo().getFinalType(true);
|
||||
TypeInfoProvider provider = pst.getTypeInfoProvider();
|
||||
TypeInfo info = classSymbol.getTypeInfo().getFinalType( provider );
|
||||
classSymbol = info.getTypeSymbol();
|
||||
info.release();
|
||||
provider.returnTypeInfo( info );
|
||||
}
|
||||
if( classSymbol == null || ! (classSymbol instanceof IDerivableContainerSymbol ) ){
|
||||
return false;
|
||||
|
@ -1294,14 +1296,15 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
{
|
||||
TypeInfo lhsInfo = ((ASTExpression)lhs).getResultType().getResult();
|
||||
if(lhsInfo != null){
|
||||
TypeInfoProvider provider = pst.getTypeInfoProvider();
|
||||
TypeInfo info = null;
|
||||
try{
|
||||
info = lhsInfo.getFinalType(true);
|
||||
info = lhsInfo.getFinalType( provider );
|
||||
} catch ( ParserSymbolTableError e ){
|
||||
return null;
|
||||
}
|
||||
ISymbol containingScope = info.getTypeSymbol();
|
||||
info.release();
|
||||
provider.returnTypeInfo( info );
|
||||
// assert containingScope != null : "Malformed Expression";
|
||||
if( containingScope instanceof IDeferredTemplateInstance )
|
||||
return ((IDeferredTemplateInstance) containingScope).getTemplate().getTemplatedSymbol();
|
||||
|
@ -1335,7 +1338,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
return info;
|
||||
}
|
||||
try{
|
||||
info = ParserSymbolTable.getConditionalOperand(second, third);
|
||||
info = pst.getConditionalOperand(second, third);
|
||||
return info;
|
||||
} catch(ParserSymbolTableException e){
|
||||
// empty info
|
||||
|
@ -3519,9 +3522,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
} catch (ASTSemanticException e) {
|
||||
}
|
||||
if( classSymbol != null && classSymbol.getTypeInfo().checkBit( TypeInfo.isTypedef ) ){
|
||||
TypeInfo info = classSymbol.getTypeInfo().getFinalType(true);
|
||||
TypeInfo info = classSymbol.getTypeInfo().getFinalType( pst.getTypeInfoProvider() );
|
||||
classSymbol = (IContainerSymbol) info.getTypeSymbol();
|
||||
info.release();
|
||||
pst.getTypeInfoProvider().returnTypeInfo( info );
|
||||
}
|
||||
if( classSymbol == null || ! (classSymbol instanceof IDerivableContainerSymbol ) ){
|
||||
return null;
|
||||
|
@ -3607,38 +3610,31 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
*/
|
||||
public boolean validateIndirectMemberOperation(IASTNode node) {
|
||||
List pointerOps = null;
|
||||
TypeInfoProvider provider = pst.getTypeInfoProvider();
|
||||
TypeInfo typeInfo = null;
|
||||
if( ( node instanceof ISymbolOwner ) )
|
||||
{
|
||||
ISymbol symbol = ((ISymbolOwner) node).getSymbol();
|
||||
typeInfo = symbol.getTypeInfo().getFinalType(true);
|
||||
typeInfo = symbol.getTypeInfo().getFinalType( provider );
|
||||
pointerOps = typeInfo.getPtrOperators();
|
||||
typeInfo.release();
|
||||
provider.returnTypeInfo( typeInfo );
|
||||
}
|
||||
else if( node instanceof ASTExpression )
|
||||
{
|
||||
ISymbol typeSymbol = ((ASTExpression)node).getResultType().getResult().getTypeSymbol();
|
||||
if( typeSymbol != null )
|
||||
{
|
||||
typeInfo = typeSymbol.getTypeInfo().getFinalType(true);
|
||||
if( typeSymbol != null ){
|
||||
typeInfo = typeSymbol.getTypeInfo().getFinalType( provider );
|
||||
pointerOps = typeInfo.getPtrOperators();
|
||||
provider.returnTypeInfo( typeInfo );
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
if( pointerOps == null || pointerOps.isEmpty() ) return false;
|
||||
TypeInfo.PtrOp lastOperator = (PtrOp) pointerOps.get( pointerOps.size() - 1 );
|
||||
if( lastOperator.getType() == TypeInfo.PtrOp.t_array || lastOperator.getType() == TypeInfo.PtrOp.t_pointer ) return true;
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if( typeInfo != null )
|
||||
typeInfo.release();
|
||||
}
|
||||
if( pointerOps == null || pointerOps.isEmpty() ) return false;
|
||||
TypeInfo.PtrOp lastOperator = (PtrOp) pointerOps.get( pointerOps.size() - 1 );
|
||||
if( lastOperator.getType() == TypeInfo.PtrOp.t_array || lastOperator.getType() == TypeInfo.PtrOp.t_pointer ) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -3649,9 +3645,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
if( ( node instanceof ISymbolOwner ) )
|
||||
{
|
||||
ISymbol symbol = ((ISymbolOwner) node).getSymbol();
|
||||
TypeInfo typeInfo = symbol.getTypeInfo().getFinalType(true);
|
||||
pointerOps = typeInfo.getPtrOperators();
|
||||
typeInfo.release();
|
||||
TypeInfoProvider provider = pst.getTypeInfoProvider();
|
||||
TypeInfo info = symbol.getTypeInfo().getFinalType( provider );
|
||||
pointerOps = info.getPtrOperators();
|
||||
provider.returnTypeInfo( info );
|
||||
}
|
||||
else if( node instanceof ASTExpression )
|
||||
{
|
||||
|
@ -3688,7 +3685,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
* @return
|
||||
*/
|
||||
public boolean validateCaches() {
|
||||
return cache.isBalanced();
|
||||
return cache.isBalanced() && (pst.getTypeInfoProvider().numAllocated() == 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -381,7 +381,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
List objList = null;
|
||||
|
||||
try{
|
||||
symbol = ParserSymbolTable.resolveAmbiguities( data );
|
||||
symbol = getSymbolTable().resolveAmbiguities( data );
|
||||
} catch ( ParserSymbolTableException e ) {
|
||||
if( e.reason != ParserSymbolTableException.r_UnableToResolveFunction ){
|
||||
throw e;
|
||||
|
@ -463,7 +463,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
|
||||
ParserSymbolTable.lookup( data, this );
|
||||
|
||||
ISymbol found = ParserSymbolTable.resolveAmbiguities( data );
|
||||
ISymbol found = getSymbolTable().resolveAmbiguities( data );
|
||||
|
||||
if( isTemplateMember() && found instanceof ITemplateSymbol ) {
|
||||
boolean areWithinTemplate = false;
|
||||
|
@ -490,7 +490,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
|
||||
ParserSymbolTable.lookup( data, this );
|
||||
|
||||
ISymbol found = ParserSymbolTable.resolveAmbiguities( data );
|
||||
ISymbol found = getSymbolTable().resolveAmbiguities( data );
|
||||
|
||||
if( isTemplateMember() && found instanceof ITemplateSymbol ) {
|
||||
return TemplateEngine.instantiateWithinTemplateScope( this, (ITemplateSymbol) found );
|
||||
|
@ -546,7 +546,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
|
||||
data.foundItems = ParserSymbolTable.lookupInContained( data, container );
|
||||
if( data.foundItems != null )
|
||||
return ParserSymbolTable.resolveAmbiguities( data );
|
||||
return getSymbolTable().resolveAmbiguities( data );
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -571,7 +571,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
data.foundItems = ParserSymbolTable.lookupInContained( data, container );
|
||||
|
||||
if( data.foundItems != null ){
|
||||
ISymbol symbol = ParserSymbolTable.resolveAmbiguities( data );
|
||||
ISymbol symbol = getSymbolTable().resolveAmbiguities( data );
|
||||
return (IParameterizedSymbol) (( symbol instanceof IParameterizedSymbol ) ? symbol : null);
|
||||
}
|
||||
|
||||
|
@ -609,7 +609,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
data.foundItems = ParserSymbolTable.lookupInContained( data, inSymbol );
|
||||
|
||||
if( data.foundItems != null ){
|
||||
foundSymbol = ParserSymbolTable.resolveAmbiguities( data );
|
||||
foundSymbol = getSymbolTable().resolveAmbiguities( data );
|
||||
}
|
||||
|
||||
if( foundSymbol == null && inSymbol.getContainingSymbol() != null ){
|
||||
|
@ -630,7 +630,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
data.qualified = true;
|
||||
ParserSymbolTable.lookup( data, this );
|
||||
|
||||
return ParserSymbolTable.resolveAmbiguities( data );
|
||||
return getSymbolTable().resolveAmbiguities( data );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -651,7 +651,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
data.qualified = true;
|
||||
ParserSymbolTable.lookup( data, this );
|
||||
|
||||
return ParserSymbolTable.resolveAmbiguities( data );
|
||||
return getSymbolTable().resolveAmbiguities( data );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -691,9 +691,9 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
ISymbol paramType = null;
|
||||
for( int i = 0; i < size; i++ ){
|
||||
param = (TypeInfo) parameters.get(i);
|
||||
TypeInfo info = ParserSymbolTable.getFlatTypeInfo( param, true );
|
||||
TypeInfo info = ParserSymbolTable.getFlatTypeInfo( param, getSymbolTable().getTypeInfoProvider() );
|
||||
paramType = info.getTypeSymbol();
|
||||
info.release();
|
||||
getSymbolTable().getTypeInfoProvider().returnTypeInfo( info );
|
||||
|
||||
if( paramType == null ){
|
||||
continue;
|
||||
|
@ -724,7 +724,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
|
||||
ParserSymbolTable.lookup( data, this );
|
||||
|
||||
ISymbol found = ParserSymbolTable.resolveAmbiguities( data );
|
||||
ISymbol found = getSymbolTable().resolveAmbiguities( data );
|
||||
|
||||
//if we haven't found anything, or what we found is not a class member, consider the
|
||||
//associated scopes
|
||||
|
@ -751,7 +751,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
}
|
||||
}
|
||||
|
||||
found = ParserSymbolTable.resolveAmbiguities( data );
|
||||
found = getSymbolTable().resolveAmbiguities( data );
|
||||
}
|
||||
|
||||
if( found instanceof IParameterizedSymbol )
|
||||
|
@ -779,7 +779,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
public TypeFilter getFilter() { return FUNCTION_FILTER; }
|
||||
};
|
||||
ParserSymbolTable.lookup( data, this );
|
||||
return (IParameterizedSymbol) ParserSymbolTable.resolveAmbiguities( data );
|
||||
return (IParameterizedSymbol) getSymbolTable().resolveAmbiguities( data );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -795,7 +795,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
|
||||
ParserSymbolTable.lookup( data, this );
|
||||
|
||||
return (IParameterizedSymbol) ParserSymbolTable.resolveAmbiguities( data );
|
||||
return (IParameterizedSymbol) getSymbolTable().resolveAmbiguities( data );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -806,7 +806,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
LookupData data = new LookupData( name );
|
||||
|
||||
ParserSymbolTable.lookup( data, this );
|
||||
ISymbol found = ParserSymbolTable.resolveAmbiguities( data );
|
||||
ISymbol found = getSymbolTable().resolveAmbiguities( data );
|
||||
if( found != null ){
|
||||
if( (found.isType( TypeInfo.t_templateParameter ) && found.getTypeInfo().getTemplateParameterType() == TypeInfo.t_template) ||
|
||||
found.isType( TypeInfo.t_template ) )
|
||||
|
@ -834,7 +834,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
data.exactFunctionsOnly = forDefinition;
|
||||
|
||||
ParserSymbolTable.lookup( data, this );
|
||||
ISymbol found = ParserSymbolTable.resolveAmbiguities( data );
|
||||
ISymbol found = getSymbolTable().resolveAmbiguities( data );
|
||||
|
||||
return found;
|
||||
}
|
||||
|
@ -885,7 +885,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
if( data.foundItems == null || data.foundItems.isEmpty() ){
|
||||
if( constructors != null ){
|
||||
if( paramList != null ){
|
||||
ParserSymbolTable.resolveFunction( data, constructors );
|
||||
getSymbolTable().resolveFunction( data, constructors );
|
||||
return constructors;
|
||||
}
|
||||
return constructors;
|
||||
|
@ -911,7 +911,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
if( obj instanceof List ){
|
||||
//a list must be all functions?
|
||||
if( paramList != null )
|
||||
ParserSymbolTable.resolveFunction( data, (List) obj );
|
||||
getSymbolTable().resolveFunction( data, (List) obj );
|
||||
list.addAll( (List) obj );
|
||||
} else{
|
||||
if( paramList != null && ((ISymbol)obj).isType( TypeInfo.t_function ) )
|
||||
|
@ -921,7 +921,7 @@ public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
|
|||
else
|
||||
tempList.clear();
|
||||
tempList.add( obj );
|
||||
ParserSymbolTable.resolveFunction( data, tempList );
|
||||
getSymbolTable().resolveFunction( data, tempList );
|
||||
list.addAll( tempList );
|
||||
} else {
|
||||
list.add( obj );
|
||||
|
|
|
@ -184,7 +184,7 @@ public class DerivableContainerSymbol extends ContainerSymbol implements IDeriva
|
|||
paramType = TemplateEngine.instantiateWithinTemplateScope( this, (ITemplateSymbol) getContainingSymbol() );
|
||||
}
|
||||
|
||||
TypeInfo param = ParserSymbolTable.TypeInfoProvider.getTypeInfo();
|
||||
TypeInfo param = getSymbolTable().getTypeInfoProvider().getTypeInfo();
|
||||
param.setType( TypeInfo.t_type );
|
||||
param.setBit( true, TypeInfo.isConst );
|
||||
param.setTypeSymbol( paramType );
|
||||
|
@ -196,7 +196,7 @@ public class DerivableContainerSymbol extends ContainerSymbol implements IDeriva
|
|||
constructor = lookupConstructor( parameters );
|
||||
} catch ( ParserSymbolTableException e ){
|
||||
} finally {
|
||||
param.release();
|
||||
getSymbolTable().getTypeInfoProvider().returnTypeInfo( param );
|
||||
}
|
||||
|
||||
if( constructor == null ){
|
||||
|
@ -223,7 +223,7 @@ public class DerivableContainerSymbol extends ContainerSymbol implements IDeriva
|
|||
constructors = new ArrayList( getConstructors() );
|
||||
}
|
||||
if( constructors != null )
|
||||
return ParserSymbolTable.resolveFunction( data, constructors );
|
||||
return getSymbolTable().resolveFunction( data, constructors );
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ public class DerivableContainerSymbol extends ContainerSymbol implements IDeriva
|
|||
};
|
||||
|
||||
ParserSymbolTable.lookup( data, this );
|
||||
return ParserSymbolTable.resolveAmbiguities( data );
|
||||
return getSymbolTable().resolveAmbiguities( data );
|
||||
}
|
||||
|
||||
public IParameterizedSymbol lookupFunctionForFriendship( String name, final List parameters ) throws ParserSymbolTableException{
|
||||
|
@ -385,7 +385,7 @@ public class DerivableContainerSymbol extends ContainerSymbol implements IDeriva
|
|||
};
|
||||
|
||||
ParserSymbolTable.lookup( data, this );
|
||||
return (IParameterizedSymbol) ParserSymbolTable.resolveAmbiguities( data );
|
||||
return (IParameterizedSymbol) getSymbolTable().resolveAmbiguities( data );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Map;
|
|||
import java.util.TreeMap;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.TypeInfoProvider;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.TypeInfo.PtrOp;
|
||||
|
||||
/**
|
||||
|
@ -217,6 +218,8 @@ public class ParameterizedSymbol extends ContainerSymbol implements IParameteriz
|
|||
TypeInfo info = null;
|
||||
TypeInfo fInfo = null;
|
||||
|
||||
TypeInfoProvider provider = getSymbolTable().getTypeInfoProvider();
|
||||
|
||||
for( int i = 0; i < size; i++ ){
|
||||
ISymbol p = (ISymbol) params.get(i);
|
||||
ISymbol pf = (ISymbol) functionParams.get(i);
|
||||
|
@ -225,8 +228,8 @@ public class ParameterizedSymbol extends ContainerSymbol implements IParameteriz
|
|||
fInfo = pf.getTypeInfo();
|
||||
|
||||
//parameters that differ only in the use of equivalent typedef types are equivalent.
|
||||
info = ParserSymbolTable.getFlatTypeInfo( info, true );
|
||||
fInfo = ParserSymbolTable.getFlatTypeInfo( fInfo, true );
|
||||
info = ParserSymbolTable.getFlatTypeInfo( info, provider );
|
||||
fInfo = ParserSymbolTable.getFlatTypeInfo( fInfo, provider );
|
||||
|
||||
for( TypeInfo nfo = info; nfo != null; nfo = fInfo ){
|
||||
//an array declaration is adjusted to become a pointer declaration
|
||||
|
@ -265,8 +268,8 @@ public class ParameterizedSymbol extends ContainerSymbol implements IParameteriz
|
|||
|
||||
boolean equals = info.equals( fInfo );
|
||||
|
||||
info.release();
|
||||
fInfo.release();
|
||||
provider.returnTypeInfo( info );
|
||||
provider.returnTypeInfo( fInfo );
|
||||
|
||||
if( ! equals )
|
||||
return false;
|
||||
|
|
|
@ -455,9 +455,10 @@ public class ParserSymbolTable {
|
|||
return true;
|
||||
}
|
||||
|
||||
TypeInfo typeInfo = ParserSymbolTable.getFlatTypeInfo( symbol.getTypeInfo(), true );
|
||||
TypeInfoProvider provider = symbol.getSymbolTable().getTypeInfoProvider();
|
||||
TypeInfo typeInfo = ParserSymbolTable.getFlatTypeInfo( symbol.getTypeInfo(), provider );
|
||||
boolean accept = data.getFilter().shouldAccept( symbol, typeInfo ) || data.getFilter().shouldAccept( symbol );
|
||||
typeInfo.release();
|
||||
provider.returnTypeInfo( typeInfo );
|
||||
|
||||
return accept;
|
||||
}
|
||||
|
@ -920,7 +921,7 @@ public class ParserSymbolTable {
|
|||
* all, when looking for functions with no parameters, an empty list must be
|
||||
* provided in data.parameters.
|
||||
*/
|
||||
static protected ISymbol resolveAmbiguities( LookupData data ) throws ParserSymbolTableException{
|
||||
protected ISymbol resolveAmbiguities( LookupData data ) throws ParserSymbolTableException{
|
||||
ISymbol resolvedSymbol = null;
|
||||
|
||||
if( data.foundItems == null || data.foundItems.isEmpty() || data.isPrefixLookup() ){
|
||||
|
@ -970,7 +971,7 @@ public class ParserSymbolTable {
|
|||
return resolvedSymbol;
|
||||
}
|
||||
|
||||
static protected IParameterizedSymbol resolveFunction( LookupData data, List functions ) throws ParserSymbolTableException{
|
||||
protected IParameterizedSymbol resolveFunction( LookupData data, List functions ) throws ParserSymbolTableException{
|
||||
if( functions == null ){
|
||||
return null;
|
||||
}
|
||||
|
@ -1035,10 +1036,12 @@ public class ParserSymbolTable {
|
|||
List sourceParameters = null; //the parameters the function is being called with
|
||||
List targetParameters = null; //the current function's parameters
|
||||
|
||||
TypeInfoProvider infoProvider = getTypeInfoProvider();
|
||||
|
||||
if( numSourceParams == 0 ){
|
||||
//f() is the same as f( void )
|
||||
sourceParameters = new ArrayList(1);
|
||||
voidInfo = TypeInfoProvider.getTypeInfo();
|
||||
voidInfo = infoProvider.getTypeInfo();
|
||||
voidInfo.setType( TypeInfo.t_void );
|
||||
sourceParameters.add( voidInfo );
|
||||
numSourceParams = 1;
|
||||
|
@ -1086,14 +1089,14 @@ public class ParserSymbolTable {
|
|||
varArgs = true;
|
||||
|
||||
if( varArgs ){
|
||||
cost = new Cost( source, null );
|
||||
cost = new Cost( infoProvider, source, null );
|
||||
cost.rank = Cost.ELLIPSIS_CONVERSION;
|
||||
} else if ( target.getHasDefault() && source.isType( TypeInfo.t_void ) && !source.hasPtrOperators() ){
|
||||
//source is just void, ie no parameter, if target had a default, then use that
|
||||
cost = new Cost( source, target );
|
||||
cost = new Cost( infoProvider, source, target );
|
||||
cost.rank = Cost.IDENTITY_RANK;
|
||||
} else if( source.equals( target ) ){
|
||||
cost = new Cost( source, target );
|
||||
cost = new Cost( infoProvider, source, target );
|
||||
cost.rank = Cost.IDENTITY_RANK; //exact match, no cost
|
||||
} else {
|
||||
try{
|
||||
|
@ -1104,17 +1107,17 @@ public class ParserSymbolTable {
|
|||
if( cost.rank == Cost.NO_MATCH_RANK && !data.forUserDefinedConversion ){
|
||||
temp = checkUserDefinedConversionSequence( source, target );
|
||||
if( temp != null ){
|
||||
cost.release();
|
||||
cost.release( infoProvider );
|
||||
cost = temp;
|
||||
}
|
||||
}
|
||||
} catch( ParserSymbolTableException e ) {
|
||||
if( cost != null ) { cost.release(); cost = null; }
|
||||
if( temp != null ) { temp.release(); temp = null; }
|
||||
if( cost != null ) { cost.release( infoProvider ); cost = null; }
|
||||
if( temp != null ) { temp.release( infoProvider ); temp = null; }
|
||||
throw e;
|
||||
} catch( ParserSymbolTableError e ) {
|
||||
if( cost != null ) { cost.release(); cost = null; }
|
||||
if( temp != null ) { temp.release(); temp = null; }
|
||||
if( cost != null ) { cost.release( infoProvider ); cost = null; }
|
||||
if( temp != null ) { temp.release( infoProvider ); temp = null; }
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -1157,7 +1160,7 @@ public class ParserSymbolTable {
|
|||
|
||||
//during a prefix lookup, we don't need to rank the functions
|
||||
if( data.isPrefixLookup() ){
|
||||
releaseCosts( currFnCost );
|
||||
releaseCosts( currFnCost, infoProvider );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1183,12 +1186,12 @@ public class ParserSymbolTable {
|
|||
ambiguous = false;
|
||||
}
|
||||
} catch( ParserSymbolTableException e ) {
|
||||
if( currFnCost != null ) releaseCosts( currFnCost );
|
||||
if( bestFnCost != null ) releaseCosts( bestFnCost );
|
||||
if( currFnCost != null ) releaseCosts( currFnCost, infoProvider );
|
||||
if( bestFnCost != null ) releaseCosts( bestFnCost, infoProvider );
|
||||
throw e;
|
||||
} catch( ParserSymbolTableError e ) {
|
||||
if( currFnCost != null ) releaseCosts( currFnCost );
|
||||
if( bestFnCost != null ) releaseCosts( bestFnCost );
|
||||
if( currFnCost != null ) releaseCosts( currFnCost, infoProvider );
|
||||
if( bestFnCost != null ) releaseCosts( bestFnCost, infoProvider );
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -1208,29 +1211,29 @@ public class ParserSymbolTable {
|
|||
if( hasBetter ){
|
||||
//the new best function.
|
||||
ambiguous = false;
|
||||
releaseCosts( bestFnCost );
|
||||
releaseCosts( bestFnCost, infoProvider );
|
||||
bestFnCost = currFnCost;
|
||||
bestHasAmbiguousParam = currHasAmbiguousParam;
|
||||
currFnCost = null;
|
||||
bestFn = currFn;
|
||||
} else {
|
||||
releaseCosts( currFnCost );
|
||||
releaseCosts( currFnCost, infoProvider );
|
||||
}
|
||||
} else {
|
||||
releaseCosts( currFnCost );
|
||||
releaseCosts( currFnCost, infoProvider );
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if( currFnCost != null ){
|
||||
releaseCosts( currFnCost );
|
||||
releaseCosts( currFnCost, infoProvider );
|
||||
currFnCost = null;
|
||||
}
|
||||
if( bestFnCost != null ){
|
||||
releaseCosts( bestFnCost );
|
||||
releaseCosts( bestFnCost, infoProvider );
|
||||
bestFnCost = null;
|
||||
}
|
||||
if( voidInfo != null )
|
||||
voidInfo.release();
|
||||
infoProvider.returnTypeInfo( voidInfo );
|
||||
}
|
||||
|
||||
if( ambiguous || bestHasAmbiguousParam ){
|
||||
|
@ -1239,11 +1242,11 @@ public class ParserSymbolTable {
|
|||
|
||||
return bestFn;
|
||||
}
|
||||
static private void releaseCosts( Cost [] costs ){
|
||||
if( costs != null ) {
|
||||
static private void releaseCosts( Cost [] costs, TypeInfoProvider provider ){
|
||||
if( costs != null && provider != null) {
|
||||
for( int i = 0; i < costs.length; i++ ){
|
||||
if( costs[i] != null )
|
||||
costs[i].release();
|
||||
costs[i].release( provider );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1572,11 +1575,11 @@ public class ParserSymbolTable {
|
|||
return okToAdd;
|
||||
}
|
||||
|
||||
static private Cost lvalue_to_rvalue( TypeInfo source, TypeInfo target ){
|
||||
static private Cost lvalue_to_rvalue( TypeInfoProvider provider, TypeInfo source, TypeInfo target ){
|
||||
|
||||
//lvalues will have type t_type
|
||||
if( source.isType( TypeInfo.t_type ) ){
|
||||
source = getFlatTypeInfo( source, false );
|
||||
source = getFlatTypeInfo( source, null );
|
||||
}
|
||||
|
||||
if( target.isType( TypeInfo.t_type ) ){
|
||||
|
@ -1588,7 +1591,7 @@ public class ParserSymbolTable {
|
|||
}
|
||||
}
|
||||
|
||||
Cost cost = new Cost( source, target );
|
||||
Cost cost = new Cost( provider, source, target );
|
||||
|
||||
//if either source or target is null here, then there was a problem
|
||||
//with the parameters and we can't match them.
|
||||
|
@ -1848,8 +1851,8 @@ public class ParserSymbolTable {
|
|||
}
|
||||
}
|
||||
|
||||
static protected Cost checkStandardConversionSequence( TypeInfo source, TypeInfo target ) throws ParserSymbolTableException{
|
||||
Cost cost = lvalue_to_rvalue( source, target );
|
||||
protected Cost checkStandardConversionSequence( TypeInfo source, TypeInfo target ) throws ParserSymbolTableException{
|
||||
Cost cost = lvalue_to_rvalue( getTypeInfoProvider(), source, target );
|
||||
|
||||
if( cost.getSource() == null || cost.getTarget() == null ){
|
||||
return cost;
|
||||
|
@ -1893,13 +1896,18 @@ public class ParserSymbolTable {
|
|||
|
||||
if( cost.rank > -1 )
|
||||
return cost;
|
||||
|
||||
derivedToBaseConversion( cost );
|
||||
|
||||
try{
|
||||
derivedToBaseConversion( cost );
|
||||
} catch ( ParserSymbolTableException e ){
|
||||
cost.release( getTypeInfoProvider() );
|
||||
throw e;
|
||||
}
|
||||
|
||||
return cost;
|
||||
}
|
||||
|
||||
static private Cost checkUserDefinedConversionSequence( TypeInfo source, TypeInfo target ) throws ParserSymbolTableException {
|
||||
private Cost checkUserDefinedConversionSequence( TypeInfo source, TypeInfo target ) throws ParserSymbolTableException {
|
||||
Cost cost = null;
|
||||
Cost constructorCost = null;
|
||||
Cost conversionCost = null;
|
||||
|
@ -1942,9 +1950,9 @@ public class ParserSymbolTable {
|
|||
|
||||
//conversion operators
|
||||
if( source.getType() == TypeInfo.t_type ){
|
||||
source = getFlatTypeInfo( source, true );
|
||||
source = getFlatTypeInfo( source, getTypeInfoProvider() );
|
||||
sourceDecl = ( source != null ) ? source.getTypeSymbol() : null;
|
||||
source.release();
|
||||
getTypeInfoProvider().returnTypeInfo( source );
|
||||
|
||||
if( sourceDecl != null && (sourceDecl instanceof IContainerSymbol) ){
|
||||
String name = target.toString();
|
||||
|
@ -1963,18 +1971,18 @@ public class ParserSymbolTable {
|
|||
|
||||
try {
|
||||
if( constructor != null ){
|
||||
TypeInfo info = TypeInfoProvider.getTypeInfo();
|
||||
TypeInfo info = getTypeInfoProvider().getTypeInfo();
|
||||
info.setType( TypeInfo.t_type );
|
||||
info.setTypeSymbol( constructor.getContainingSymbol() );
|
||||
constructorCost = checkStandardConversionSequence( info, target );
|
||||
info.release();
|
||||
getTypeInfoProvider().returnTypeInfo( info );
|
||||
}
|
||||
if( conversion != null ){
|
||||
TypeInfo info = TypeInfoProvider.getTypeInfo();
|
||||
TypeInfo info = getTypeInfoProvider().getTypeInfo();
|
||||
info.setType( target.getType() );
|
||||
info.setTypeSymbol( target.getTypeSymbol() );
|
||||
conversionCost = checkStandardConversionSequence( info, target );
|
||||
info.release();
|
||||
getTypeInfoProvider().returnTypeInfo( info );
|
||||
}
|
||||
|
||||
//if both are valid, then the conversion is ambiguous
|
||||
|
@ -1997,9 +2005,9 @@ public class ParserSymbolTable {
|
|||
}
|
||||
} finally {
|
||||
if( constructorCost != null && constructorCost != cost )
|
||||
constructorCost.release();
|
||||
constructorCost.release( getTypeInfoProvider() );
|
||||
if( conversionCost != null && conversionCost != cost )
|
||||
conversionCost.release();
|
||||
conversionCost.release( getTypeInfoProvider() );
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
@ -2016,31 +2024,31 @@ public class ParserSymbolTable {
|
|||
* - If neither can be converted, further checking must be done (return null)
|
||||
* - If exactly one conversion is possible, that conversion is applied ( return the other TypeInfo )
|
||||
*/
|
||||
static public TypeInfo getConditionalOperand( TypeInfo secondOp, TypeInfo thirdOp ) throws ParserSymbolTableException{
|
||||
public TypeInfo getConditionalOperand( TypeInfo secondOp, TypeInfo thirdOp ) throws ParserSymbolTableException{
|
||||
Cost thirdCost = null, secondCost = null;
|
||||
TypeInfo temp = null;
|
||||
|
||||
TypeInfoProvider provider = getTypeInfoProvider();
|
||||
try{
|
||||
//can secondOp convert to thirdOp ?
|
||||
temp = getFlatTypeInfo( thirdOp, true );
|
||||
temp = getFlatTypeInfo( thirdOp, provider );
|
||||
secondCost = checkStandardConversionSequence( secondOp, temp );
|
||||
|
||||
if( secondCost.rank == Cost.NO_MATCH_RANK ){
|
||||
secondCost.release();
|
||||
secondCost.release( provider );
|
||||
secondCost = checkUserDefinedConversionSequence( secondOp, temp );
|
||||
}
|
||||
temp.release();
|
||||
temp = getFlatTypeInfo( secondOp, true );
|
||||
getTypeInfoProvider().returnTypeInfo( temp );
|
||||
temp = getFlatTypeInfo( secondOp, provider );
|
||||
|
||||
thirdCost = checkStandardConversionSequence( thirdOp, temp );
|
||||
if( thirdCost.rank == Cost.NO_MATCH_RANK ){
|
||||
thirdCost.release();
|
||||
thirdCost.release( provider );
|
||||
thirdCost = checkUserDefinedConversionSequence( thirdOp, temp );
|
||||
}
|
||||
} finally {
|
||||
if( thirdCost != null ) thirdCost.release();
|
||||
if( secondCost != null ) secondCost.release();
|
||||
if( temp != null ) temp.release();
|
||||
if( thirdCost != null ) thirdCost.release( provider );
|
||||
if( secondCost != null ) secondCost.release( provider );
|
||||
if( temp != null ) provider.returnTypeInfo( temp );
|
||||
}
|
||||
|
||||
boolean canConvertSecond = ( secondCost != null && secondCost.rank != Cost.NO_MATCH_RANK );
|
||||
|
@ -2070,19 +2078,19 @@ public class ParserSymbolTable {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param usePool TODO
|
||||
* @param infoProvider - if using the pool, an instance of the symbol table must be provided
|
||||
* @param decl
|
||||
* @return TypeInfo
|
||||
* The top level TypeInfo represents modifications to the object and the
|
||||
* remaining TypeInfo's represent the object.
|
||||
*/
|
||||
static protected TypeInfo getFlatTypeInfo( TypeInfo topInfo, boolean usePool ){
|
||||
static protected TypeInfo getFlatTypeInfo( TypeInfo topInfo, TypeInfoProvider infoProvider ){
|
||||
TypeInfo returnInfo = null;
|
||||
TypeInfo info = null;
|
||||
|
||||
if( topInfo.getType() == TypeInfo.t_type && topInfo.getTypeSymbol() != null ){
|
||||
if( usePool ) returnInfo = TypeInfoProvider.getTypeInfo();
|
||||
else returnInfo = new TypeInfo();
|
||||
if( infoProvider != null ) returnInfo = infoProvider.getTypeInfo();
|
||||
else returnInfo = new TypeInfo();
|
||||
|
||||
returnInfo.setTypeInfo( topInfo.getTypeInfo() );
|
||||
ISymbol typeSymbol = topInfo.getTypeSymbol();
|
||||
|
@ -2096,8 +2104,8 @@ public class ParserSymbolTable {
|
|||
returnInfo.setTypeInfo( ( returnInfo.getTypeInfo() | info.getTypeInfo() ) & ~TypeInfo.isTypedef & ~TypeInfo.isForward );
|
||||
info = typeSymbol.getTypeInfo();
|
||||
if( ++j > TYPE_LOOP_THRESHOLD ){
|
||||
if( usePool )
|
||||
returnInfo.release();
|
||||
if( infoProvider != null )
|
||||
infoProvider.returnTypeInfo( returnInfo );
|
||||
throw new ParserSymbolTableError();
|
||||
}
|
||||
}
|
||||
|
@ -2122,8 +2130,8 @@ public class ParserSymbolTable {
|
|||
returnInfo.addPtrOperator( ptr );
|
||||
}
|
||||
} else {
|
||||
if( usePool ){
|
||||
returnInfo = TypeInfoProvider.getTypeInfo();
|
||||
if( infoProvider != null ){
|
||||
returnInfo = infoProvider.getTypeInfo();
|
||||
returnInfo.copy( topInfo );
|
||||
} else
|
||||
returnInfo = new TypeInfo( topInfo );
|
||||
|
@ -2132,6 +2140,14 @@ public class ParserSymbolTable {
|
|||
return returnInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public TypeInfoProvider getTypeInfoProvider() {
|
||||
return _provider;
|
||||
}
|
||||
|
||||
private TypeInfoProvider _provider = new TypeInfoProvider();
|
||||
private IContainerSymbol _compilationUnit;
|
||||
private ParserLanguage _language;
|
||||
private ParserMode _mode;
|
||||
|
@ -2238,12 +2254,12 @@ public class ParserSymbolTable {
|
|||
static protected class Cost
|
||||
{
|
||||
|
||||
public Cost( TypeInfo s, TypeInfo t ){
|
||||
source = TypeInfoProvider.getTypeInfo();
|
||||
public Cost( TypeInfoProvider provider, TypeInfo s, TypeInfo t ){
|
||||
source = provider.getTypeInfo();
|
||||
if( s != null )
|
||||
source.copy( s );
|
||||
|
||||
target = TypeInfoProvider.getTypeInfo();
|
||||
target = provider.getTypeInfo();
|
||||
if( t != null )
|
||||
target.copy( t );
|
||||
}
|
||||
|
@ -2273,9 +2289,9 @@ public class ParserSymbolTable {
|
|||
public static final int USERDEFINED_CONVERSION_RANK = 4;
|
||||
public static final int ELLIPSIS_CONVERSION = 5;
|
||||
|
||||
public void release(){
|
||||
getSource().release();
|
||||
getTarget().release();
|
||||
public void release( TypeInfoProvider provider ){
|
||||
provider.returnTypeInfo( getSource() );
|
||||
provider.returnTypeInfo( getTarget() );
|
||||
}
|
||||
|
||||
public int compare( Cost cost ){
|
||||
|
@ -2443,12 +2459,12 @@ public class ParserSymbolTable {
|
|||
|
||||
public static class TypeInfoProvider
|
||||
{
|
||||
private static final int POOL_SIZE = 16;
|
||||
private static final TypeInfo [] pool;
|
||||
private static final boolean [] free;
|
||||
private static int firstFreeHint = 0;
|
||||
private final int POOL_SIZE = 16;
|
||||
private final TypeInfo [] pool;
|
||||
private final boolean [] free;
|
||||
private int firstFreeHint = 0;
|
||||
|
||||
static
|
||||
public TypeInfoProvider()
|
||||
{
|
||||
pool = new TypeInfo[ POOL_SIZE ];
|
||||
free = new boolean[POOL_SIZE];
|
||||
|
@ -2459,7 +2475,7 @@ public class ParserSymbolTable {
|
|||
}
|
||||
}
|
||||
|
||||
public static synchronized TypeInfo getTypeInfo()
|
||||
public TypeInfo getTypeInfo()
|
||||
{
|
||||
for( int i = firstFreeHint; i < POOL_SIZE; ++i )
|
||||
{
|
||||
|
@ -2474,7 +2490,7 @@ public class ParserSymbolTable {
|
|||
return new TypeInfo();
|
||||
}
|
||||
|
||||
public static synchronized void returnTypeInfo( TypeInfo t )
|
||||
public void returnTypeInfo( TypeInfo t )
|
||||
{
|
||||
for( int i = 0; i < POOL_SIZE; i++ ){
|
||||
if( pool[i] == t ){
|
||||
|
@ -2489,14 +2505,13 @@ public class ParserSymbolTable {
|
|||
//else it was one allocated outside the pool
|
||||
}
|
||||
|
||||
public static synchronized int numAllocated(){
|
||||
// int num = 0;
|
||||
// for( int i = 0; i < POOL_SIZE; i++ ){
|
||||
// if( !free[i] )
|
||||
// num++;
|
||||
// }
|
||||
// return num;
|
||||
return 0;
|
||||
public int numAllocated(){
|
||||
int num = 0;
|
||||
for( int i = 0; i < POOL_SIZE; i++ ){
|
||||
if( !free[i] )
|
||||
num++;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ public final class TemplateEngine {
|
|||
try {
|
||||
TypeInfo info = new TypeInfo( param.getTypeInfo() );
|
||||
info.setType( info.getTemplateParameterType() );
|
||||
cost = ParserSymbolTable.checkStandardConversionSequence( arg, info );
|
||||
cost = param.getSymbolTable().checkStandardConversionSequence( arg, info );
|
||||
} catch (ParserSymbolTableException e) {
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ public final class TemplateEngine {
|
|||
}
|
||||
} finally{
|
||||
if( cost != null )
|
||||
cost.release();
|
||||
cost.release( param.getSymbolTable().getTypeInfoProvider() );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -312,7 +312,7 @@ public final class TemplateEngine {
|
|||
*/
|
||||
static private TypeInfo getArgumentTypeForDeduction( TypeInfo aInfo, boolean pIsAReferenceType ) throws ParserSymbolTableException{
|
||||
|
||||
TypeInfo a = ParserSymbolTable.getFlatTypeInfo( aInfo, false );
|
||||
TypeInfo a = ParserSymbolTable.getFlatTypeInfo( aInfo, null );
|
||||
|
||||
if( !pIsAReferenceType ){
|
||||
ISymbol aSymbol = a.getTypeSymbol();
|
||||
|
@ -694,7 +694,7 @@ public final class TemplateEngine {
|
|||
|
||||
static private boolean deduceArgument( Map map, ISymbol p, TypeInfo a ){
|
||||
|
||||
a = ParserSymbolTable.getFlatTypeInfo( a, false );
|
||||
a = ParserSymbolTable.getFlatTypeInfo( a, null );
|
||||
|
||||
if( map.containsKey( p ) ){
|
||||
TypeInfo current = (TypeInfo)map.get( p );
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||
import java.util.ListIterator;
|
||||
|
||||
import org.eclipse.cdt.core.parser.Enum;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.TypeInfoProvider;
|
||||
|
||||
|
||||
public class TypeInfo {
|
||||
|
@ -287,12 +288,13 @@ public class TypeInfo {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param usePool - whether or not use to the pool, if true, TypeInfo.release() must
|
||||
* be called on the returned TypeInfo when itis no longer needed
|
||||
* @param infoProvider - TypeInfoProvider to use if pooling the TypeInfo created, if null,
|
||||
* pooling is not used. If pooling is used, TypeInfoProvider.returnTypeInfo
|
||||
* must be called when the TypeInfo is no longer needed
|
||||
* @return
|
||||
*/
|
||||
public TypeInfo getFinalType(boolean usePool){
|
||||
return ParserSymbolTable.getFlatTypeInfo( this, usePool );
|
||||
public TypeInfo getFinalType(TypeInfoProvider infoProvider){
|
||||
return ParserSymbolTable.getFlatTypeInfo( this, infoProvider );
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -565,9 +567,9 @@ public class TypeInfo {
|
|||
_operatorExpressions = Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
public void release() {
|
||||
ParserSymbolTable.TypeInfoProvider.returnTypeInfo( this );
|
||||
}
|
||||
// public void release() {
|
||||
// ParserSymbolTable.TypeInfoProvider.returnTypeInfo( this );
|
||||
// }
|
||||
|
||||
|
||||
private int _typeBits = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue