Skip to content

Commit 2a53e07

Browse files
committed
Fixed broken class instance check in FunctionToInstanceMethodPass.
Fixes #1081.
1 parent 7b0aaf5 commit 2a53e07

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Generator/Passes/FunctionToInstanceMethodPass.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public override bool VisitMethodDecl(Method method)
1818

1919
public override bool VisitFunctionDecl(Function function)
2020
{
21+
if (AlreadyVisited(function))
22+
return false;
23+
2124
if (!function.IsGenerated)
2225
return false;
2326

@@ -79,7 +82,7 @@ public static bool GetClassParameter(Parameter classParam, out Class @class)
7982
if (classParam.Type.IsPointerTo(out tag))
8083
{
8184
@class = tag.Declaration as Class;
82-
return true;
85+
return @class != null;
8386
}
8487

8588
return classParam.Type.TryGetClass(out @class);

tests/Native/Passes.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,10 @@ class ClassWithAbstractOperator
7777
{
7878
virtual operator int() = 0;
7979
};
80+
81+
enum ConnectionRole
82+
{
83+
Role1, Role2
84+
};
85+
86+
bool ConnectionRoleToString(const ConnectionRole& role, const char* role_str);

0 commit comments

Comments
 (0)