File tree Expand file tree Collapse file tree 4 files changed +33
-4
lines changed Expand file tree Collapse file tree 4 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -199,9 +199,9 @@ where typedefDecl.Type.Desugar() is FunctionType
199199 declarations . AddRange ( @class . TemplateParameters ) ;
200200 }
201201
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 ) ;
205205
206206 if ( decl is Method && decl . IsGenerated )
207207 return @class . GetPropertyByName ( newName ) != null ;
@@ -226,6 +226,18 @@ private static IEnumerable<Function> GetFunctionsWithTheSameParams(Function func
226226 f => ! f . Ignore && f . Parameters . SequenceEqual ( function . Parameters , new ParameterComparer ( ) ) ) ;
227227 }
228228
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+ existing . Name + "_" : existing . OriginalName ;
238+ return false ;
239+ }
240+
229241 public override bool VisitClassDecl ( Class @class )
230242 {
231243 if ( ! base . VisitClassDecl ( @class ) )
Original file line number Diff line number Diff line change @@ -61,7 +61,11 @@ public void TestUncompilableCode()
6161 hasOverride . CauseRenamingError ( ) ;
6262 using ( var qux = new Qux ( ) )
6363 {
64- new Bar ( qux ) . Dispose ( ) ;
64+ qux . Type . GetHashCode ( ) ;
65+ using ( Bar bar = new Bar ( qux ) )
66+ {
67+ bar . Type . GetHashCode ( ) ;
68+ }
6569 }
6670 using ( var quux = new Quux ( ) )
6771 {
Original file line number Diff line number Diff line change @@ -230,6 +230,11 @@ int Qux::takeReferenceToPointer(Foo*& ret)
230230 return ret->A ;
231231}
232232
233+ int Qux::type () const
234+ {
235+ return 0 ;
236+ }
237+
233238Bar::Bar (Qux qux)
234239{
235240}
@@ -286,6 +291,11 @@ void Bar::setIndex(int value)
286291 index = value;
287292}
288293
294+ int Bar::type () const
295+ {
296+ return 1 ;
297+ }
298+
289299ForceCreationOfInterface::ForceCreationOfInterface ()
290300{
291301}
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ class DLL_API Qux
8585 void setInterface (Qux* qux);
8686 virtual void makeClassDynamic ();
8787 virtual int takeReferenceToPointer (Foo*& ret);
88+ virtual int type () const ;
8889};
8990
9091class DLL_API Bar : public Qux
@@ -115,6 +116,8 @@ class DLL_API Bar : public Qux
115116 int publicInt;
116117 double publicDouble;
117118 };
119+ static const int Type = 4 ;
120+ int type () const override ;
118121
119122protected:
120123 enum class ProtectedNestedEnum
You can’t perform that action at this time.
0 commit comments