Browse Source

Fixed the incorrect C++ in the tests for left shift operators. The test still fails, though, now C is always 0.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/49/head
Dimitar Dobrev 13 years ago
parent
commit
3f7790c67d
  1. 9
      src/Generator/Passes/CheckDuplicatedNamesPass.cs
  2. 4
      tests/Basic/Basic.cpp
  3. 4
      tests/Basic/Basic.h

9
src/Generator/Passes/CheckDuplicatedNamesPass.cs

@ -8,12 +8,14 @@ namespace CppSharp.Passes @@ -8,12 +8,14 @@ namespace CppSharp.Passes
{
class DeclarationName
{
public Driver Driver { get; set; }
private readonly string Name;
private readonly Dictionary<string, int> methodSignatures;
private int Count;
public DeclarationName(string name)
public DeclarationName(string name, Driver driver)
{
Driver = driver;
Name = name;
methodSignatures = new Dictionary<string, int>();
}
@ -58,8 +60,11 @@ namespace CppSharp.Passes @@ -58,8 +60,11 @@ namespace CppSharp.Passes
Count = methodCount+1;
if (method.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
Driver.Diagnostics.EmitWarning("Duplicate operator {0} ignored", method.Name);
method.ExplicityIgnored = true;
}
else
method.Name += methodCount.ToString(CultureInfo.InvariantCulture);
return true;
@ -136,7 +141,7 @@ namespace CppSharp.Passes @@ -136,7 +141,7 @@ namespace CppSharp.Passes
// If the name is not yet on the map, then add it.
if (!names.ContainsKey(fullName))
names.Add(fullName, new DeclarationName(decl.Name));
names.Add(fullName, new DeclarationName(decl.Name, Driver));
if (names[fullName].UpdateName(decl))
Driver.Diagnostics.EmitWarning("Duplicate name {0}, renamed to {1}", fullName, decl.Name);

4
tests/Basic/Basic.cpp

@ -4,14 +4,14 @@ Foo::Foo() @@ -4,14 +4,14 @@ Foo::Foo()
{
}
Foo2& Foo2::operator <<(signed int i)
Foo2 Foo2::operator<<(signed int i)
{
Foo2 foo;
foo.C = C << i;
return foo;
}
Foo2& Foo2::operator <<(signed long l)
Foo2 Foo2::operator<<(signed long l)
{
Foo2 foo;
foo.C = C << l;

4
tests/Basic/Basic.h

@ -23,8 +23,8 @@ public: @@ -23,8 +23,8 @@ public:
int C;
Foo2& operator<<(signed int i);
Foo2& operator<<(signed long l);
Foo2 operator<<(signed int i);
Foo2 operator<<(signed long l);
};
struct DLL_API Bar

Loading…
Cancel
Save