|
1 | 1 | using System;
|
2 | 2 | using System.Collections.Generic;
|
| 3 | +using System.Diagnostics; |
3 | 4 | using System.Linq;
|
4 | 5 | using CppSharp.AST;
|
5 | 6 | using CppSharp.AST.Extensions;
|
@@ -69,38 +70,40 @@ public override bool VisitFunctionDecl(AST.Function function)
|
69 | 70 |
|
70 | 71 | private bool CheckDefaultParametersForAmbiguity(Function function, Function overload)
|
71 | 72 | {
|
72 |
| - // detect if function and overload are copy assignment or move assignment operators |
73 |
| - // if both are either one of those types, ignore move assignment operator |
74 |
| - if (function.OperatorKind == CXXOperatorKind.Equal && overload.OperatorKind == CXXOperatorKind.Equal && |
75 |
| - function.Parameters.Count == 1 && overload.Parameters.Count == 1) |
| 73 | + if (function.IsInNamespace("Kyt")) |
76 | 74 | {
|
77 |
| - var functionParamType = function.Parameters[0].Type; |
78 |
| - var overloadParamType = overload.Parameters[0].Type; |
79 |
| - |
80 |
| - if (functionParamType is PointerType && overloadParamType is PointerType) |
| 75 | + // detect if function and overload are copy assignment or move assignment operators |
| 76 | + // if both are either one of those types, ignore move assignment operator |
| 77 | + if (function.OperatorKind == CXXOperatorKind.Equal && overload.OperatorKind == CXXOperatorKind.Equal && |
| 78 | + function.Parameters.Count == 1 && overload.Parameters.Count == 1) |
81 | 79 | {
|
82 |
| - var functionParamPointerType = functionParamType as PointerType; |
83 |
| - var overloadParamPointerType = overloadParamType as PointerType; |
| 80 | + var functionParamType = function.Parameters[0].Type; |
| 81 | + var overloadParamType = overload.Parameters[0].Type; |
84 | 82 |
|
85 |
| - var functionPointee = functionParamPointerType.GetPointee(); |
86 |
| - var overloadPointee = overloadParamPointerType.GetPointee(); |
| 83 | + if (functionParamType is PointerType && overloadParamType is PointerType) |
| 84 | + { |
| 85 | + var functionParamPointerType = functionParamType as PointerType; |
| 86 | + var overloadParamPointerType = overloadParamType as PointerType; |
87 | 87 |
|
88 |
| - functionPointee.TryGetClass(out Class @functionPointeeClass); |
89 |
| - overloadPointee.TryGetClass(out Class @overloadPointeeClass); |
| 88 | + var functionPointee = functionParamPointerType.GetPointee(); |
| 89 | + var overloadPointee = overloadParamPointerType.GetPointee(); |
90 | 90 |
|
91 |
| - if (functionPointeeClass == function.Namespace && @overloadPointeeClass == overload.Namespace) |
92 |
| - { |
93 |
| - if (functionParamPointerType.Modifier == PointerType.TypeModifier.RVReference && |
94 |
| - overloadParamPointerType.Modifier == PointerType.TypeModifier.LVReference) |
95 |
| - { |
96 |
| - function.ExplicitlyIgnore(); |
97 |
| - return true; |
98 |
| - } |
99 |
| - else if (functionParamPointerType.Modifier == PointerType.TypeModifier.LVReference && |
100 |
| - overloadParamPointerType.Modifier == PointerType.TypeModifier.RVReference) |
| 91 | + functionPointee.TryGetClass(out Class @functionPointeeClass); |
| 92 | + overloadPointee.TryGetClass(out Class @overloadPointeeClass); |
| 93 | + if (functionPointeeClass == function.Namespace && @overloadPointeeClass == overload.Namespace) |
101 | 94 | {
|
102 |
| - overload.ExplicitlyIgnore(); |
103 |
| - return true; |
| 95 | + if (functionParamPointerType.Modifier == PointerType.TypeModifier.RVReference && |
| 96 | + overloadParamPointerType.Modifier == PointerType.TypeModifier.LVReference) |
| 97 | + { |
| 98 | + function.ExplicitlyIgnore(); |
| 99 | + return true; |
| 100 | + } |
| 101 | + else if (functionParamPointerType.Modifier == PointerType.TypeModifier.LVReference && |
| 102 | + overloadParamPointerType.Modifier == PointerType.TypeModifier.RVReference) |
| 103 | + { |
| 104 | + overload.ExplicitlyIgnore(); |
| 105 | + return true; |
| 106 | + } |
104 | 107 | }
|
105 | 108 | }
|
106 | 109 | }
|
|
0 commit comments