Browse Source

Fixed retrieval of method overloads in case the provided function is an operator.

pull/219/merge
Elias Holzer 12 years ago committed by triton
parent
commit
cff1349d2c
  1. 3
      src/AST/Class.cs
  2. 9
      tests/Basic/Basic.h

3
src/AST/Class.cs

@ -201,6 +201,9 @@ namespace CppSharp.AST
public override IEnumerable<Function> GetOverloads(Function function) public override IEnumerable<Function> GetOverloads(Function function)
{ {
if (function.IsOperator)
return Methods.Where(fn => fn.OperatorKind == function.OperatorKind);
var methods = Methods.Where(m => m.Name == function.Name); var methods = Methods.Where(m => m.Name == function.Name);
if (methods.ToList().Count != 0) if (methods.ToList().Count != 0)
return methods; return methods;

9
tests/Basic/Basic.h

@ -324,3 +324,12 @@ namespace SomeNamespace
virtual void AbstractMethod() = 0; virtual void AbstractMethod() = 0;
}; };
} }
// Test operator overloads
class ClassWithOverloadedOperators
{
public:
operator char();
operator int();
operator short();
};
Loading…
Cancel
Save