File tree 4 files changed +34
-4
lines changed
4 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -199,9 +199,9 @@ where typedefDecl.Type.Desugar() is FunctionType
199
199
declarations . AddRange ( @class . TemplateParameters ) ;
200
200
}
201
201
202
- var result = declarations . Any ( d => d != decl && d . Name == newName ) ;
203
- if ( result )
204
- return true ;
202
+ var existing = declarations . Find ( d => d != decl && d . Name == newName ) ;
203
+ if ( existing != null )
204
+ return CheckExisting ( decl , existing ) ;
205
205
206
206
if ( decl is Method && decl . IsGenerated )
207
207
return @class . GetPropertyByName ( newName ) != null ;
@@ -226,6 +226,19 @@ private static IEnumerable<Function> GetFunctionsWithTheSameParams(Function func
226
226
f => ! f . Ignore && f . Parameters . SequenceEqual ( function . Parameters , new ParameterComparer ( ) ) ) ;
227
227
}
228
228
229
+ private static bool CheckExisting ( Declaration decl , Declaration existing )
230
+ {
231
+ var method = decl as Method ;
232
+ var property = decl as Property ;
233
+ if ( method ? . IsOverride != true && property ? . IsOverride != true )
234
+ return true ;
235
+
236
+ existing . Name = existing . Name == existing . OriginalName ||
237
+ string . IsNullOrEmpty ( existing . OriginalName ) ?
238
+ existing . Name + "_" : existing . OriginalName ;
239
+ return false ;
240
+ }
241
+
229
242
public override bool VisitClassDecl ( Class @class )
230
243
{
231
244
if ( ! base . VisitClassDecl ( @class ) )
Original file line number Diff line number Diff line change @@ -61,7 +61,11 @@ public void TestUncompilableCode()
61
61
hasOverride . CauseRenamingError ( ) ;
62
62
using ( var qux = new Qux ( ) )
63
63
{
64
- new Bar ( qux ) . Dispose ( ) ;
64
+ qux . Type . GetHashCode ( ) ;
65
+ using ( Bar bar = new Bar ( qux ) )
66
+ {
67
+ bar . Type . GetHashCode ( ) ;
68
+ }
65
69
}
66
70
using ( var quux = new Quux ( ) )
67
71
{
Original file line number Diff line number Diff line change @@ -230,6 +230,11 @@ int Qux::takeReferenceToPointer(Foo*& ret)
230
230
return ret->A ;
231
231
}
232
232
233
+ int Qux::type () const
234
+ {
235
+ return 0 ;
236
+ }
237
+
233
238
Bar::Bar (Qux qux)
234
239
{
235
240
}
@@ -286,6 +291,11 @@ void Bar::setIndex(int value)
286
291
index = value;
287
292
}
288
293
294
+ int Bar::type () const
295
+ {
296
+ return 1 ;
297
+ }
298
+
289
299
ForceCreationOfInterface::ForceCreationOfInterface ()
290
300
{
291
301
}
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ class DLL_API Qux
85
85
void setInterface (Qux* qux);
86
86
virtual void makeClassDynamic ();
87
87
virtual int takeReferenceToPointer (Foo*& ret);
88
+ virtual int type () const ;
88
89
};
89
90
90
91
class DLL_API Bar : public Qux
@@ -115,6 +116,8 @@ class DLL_API Bar : public Qux
115
116
int publicInt;
116
117
double publicDouble;
117
118
};
119
+ static const int Type = 4 ;
120
+ int type () const override ;
118
121
119
122
protected:
120
123
enum class ProtectedNestedEnum
You can’t perform that action at this time.
0 commit comments