@ -25,10 +25,10 @@ namespace CppSharp.Passes
if ( decl . Name ! = Name )
if ( decl . Name ! = Name )
throw new Exception ( "Invalid name" ) ;
throw new Exception ( "Invalid name" ) ;
var method = decl as Method ;
var function = decl as Function ;
if ( method ! = null )
if ( function ! = null )
{
{
return UpdateName ( method ) ;
return UpdateName ( function ) ;
}
}
var property = decl as Property ;
var property = decl as Property ;
@ -46,9 +46,9 @@ namespace CppSharp.Passes
return true ;
return true ;
}
}
private bool UpdateName ( Method method )
private bool UpdateName ( Function function )
{
{
var @params = method . Parameters . Where ( p = > p . Kind ! = ParameterKind . IndirectReturnType )
var @params = function . Parameters . Where ( p = > p . Kind ! = ParameterKind . IndirectReturnType )
. Select ( p = > p . QualifiedType . ToString ( ) ) ;
. Select ( p = > p . QualifiedType . ToString ( ) ) ;
var signature = string . Format ( "{0}({1})" , Name , string . Join ( ", " , @params ) ) ;
var signature = string . Format ( "{0}({1})" , Name , string . Join ( ", " , @params ) ) ;
@ -66,19 +66,21 @@ namespace CppSharp.Passes
if ( Count < methodCount + 1 )
if ( Count < methodCount + 1 )
Count = methodCount + 1 ;
Count = methodCount + 1 ;
if ( method . IsOperator )
var method = function as Method ;
if ( function . IsOperator )
{
{
// TODO: turn into a method; append the original type (say, "signed long") of the last parameter to the type so that the user knows which overload is called
// TODO: turn into a method; append the original type (say, "signed long") of the last parameter to the type so that the user knows which overload is called
Driver . Diagnostics . EmitWarning ( "Duplicate operator {0} ignored" , method . Name ) ;
Driver . Diagnostics . EmitWarning ( "Duplicate operator {0} ignored" , function . Name ) ;
method . ExplicityIgnored = true ;
function . ExplicityIgnored = true ;
}
}
else if ( method . IsConstructor )
else if ( method ! = null & & method . IsConstructor )
{
{
Driver . Diagnostics . EmitWarning ( "Duplicate constructor {0} ignored" , method . Name ) ;
Driver . Diagnostics . EmitWarning ( "Duplicate constructor {0} ignored" , function . Name ) ;
method . ExplicityIgnored = true ;
function . ExplicityIgnored = true ;
}
}
else
else
method . Name + = methodCount . ToString ( CultureInfo . InvariantCulture ) ;
function . Name + = methodCount . ToString ( CultureInfo . InvariantCulture ) ;
return true ;
return true ;
}
}
}
}
@ -149,6 +151,15 @@ namespace CppSharp.Passes
foreach ( var property in @class . Properties )
foreach ( var property in @class . Properties )
VisitProperty ( property ) ;
VisitProperty ( property ) ;
var total = ( uint ) 0 ;
foreach ( var method in @class . Methods . Where ( m = > m . IsConstructor & &
! m . IsCopyConstructor & & ! m . IsMoveConstructor ) )
method . Index = total + + ;
total = 0 ;
foreach ( var method in @class . Methods . Where ( m = > m . IsCopyConstructor ) )
method . Index = total + + ;
return false ;
return false ;
}
}