Skip to content

Commit 05c70ea

Browse files
committed
Generate valid C# when an external module has an unsupported operator
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 67b3058 commit 05c70ea

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/Generator/Passes/MoveFunctionToClassPass.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ public override bool VisitFunctionDecl(Function function)
2424

2525
Class @class = FindClassToMoveFunctionTo(function);
2626

27-
if (@class == null ||
28-
@class.TranslationUnit.Module != function.TranslationUnit.Module)
27+
if (@class == null)
2928
return false;
3029

3130
// Create a new fake method so it acts as a static method.

tests/NamespacesDerived/NamespacesDerived.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,8 @@ DerivedFromSecondaryBaseInDependency::DerivedFromSecondaryBaseInDependency()
9292
DerivedFromSecondaryBaseInDependency::~DerivedFromSecondaryBaseInDependency()
9393
{
9494
}
95+
96+
bool operator<<(const Base& b, const char* str)
97+
{
98+
return false;
99+
}

tests/NamespacesDerived/NamespacesDerived.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class DLL_API DerivedFromSecondaryBaseInDependency : public Derived, public Seco
8787
~DerivedFromSecondaryBaseInDependency();
8888
};
8989

90+
DLL_API bool operator<<(const Base& b, const char* str);
91+
9092
namespace NamespacesBase
9193
{
9294
class DLL_API ClassInNamespaceNamedAfterDependency

0 commit comments

Comments
 (0)