From 17a8fc732f739ad0f8e102eeda1dff0b53b24589 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Sun, 26 Oct 2014 23:25:01 +0200 Subject: [PATCH] Removed redundant "new" key-words in generated C# code. Signed-off-by: Dimitar Dobrev --- src/AST/Class.cs | 10 ++++++ .../CSharp/i686-apple-darwin12.4.0/AST.cs | 34 +++++++++---------- .../i686-apple-darwin12.4.0/CppParser.cs | 8 ++--- .../CSharp/i686-apple-darwin12.4.0/Sources.cs | 2 +- .../CSharp/i686-apple-darwin12.4.0/Target.cs | 2 +- .../Bindings/CSharp/i686-pc-win32-msvc/AST.cs | 34 +++++++++---------- .../CSharp/i686-pc-win32-msvc/CppParser.cs | 8 ++--- .../CSharp/i686-pc-win32-msvc/Sources.cs | 2 +- .../CSharp/i686-pc-win32-msvc/Target.cs | 2 +- .../Bindings/CSharp/x86_64-linux-gnu/AST.cs | 34 +++++++++---------- .../CSharp/x86_64-linux-gnu/CppParser.cs | 8 ++--- .../CSharp/x86_64-linux-gnu/Sources.cs | 2 +- .../CSharp/x86_64-linux-gnu/Target.cs | 2 +- .../Generators/CSharp/CSharpTextTemplate.cs | 10 +++--- 14 files changed, 84 insertions(+), 74 deletions(-) diff --git a/src/AST/Class.cs b/src/AST/Class.cs index 18063e1d..7292184c 100644 --- a/src/AST/Class.cs +++ b/src/AST/Class.cs @@ -161,6 +161,16 @@ namespace CppSharp.AST } } + public bool HasGeneratedBase + { + get + { + return HasBaseClass && !IsValueType + && !Bases[0].Class.IsValueType + && Bases[0].Class.IsGenerated; + } + } + public Class OriginalClass { get; set; } public bool IsValueType diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs index 9f1d090c..a33b36b2 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/AST.cs @@ -251,7 +251,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Type __CreateInstance(global::System.IntPtr native) + public static Type __CreateInstance(global::System.IntPtr native) { return new Type((Type.Internal*) native); } @@ -351,7 +351,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new TypeQualifiers __CreateInstance(global::System.IntPtr native) + public static TypeQualifiers __CreateInstance(global::System.IntPtr native) { return new TypeQualifiers((TypeQualifiers.Internal*) native); } @@ -466,7 +466,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new QualifiedType __CreateInstance(global::System.IntPtr native) + public static QualifiedType __CreateInstance(global::System.IntPtr native) { return new QualifiedType((QualifiedType.Internal*) native); } @@ -1443,7 +1443,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new TemplateArgument __CreateInstance(global::System.IntPtr native) + public static TemplateArgument __CreateInstance(global::System.IntPtr native) { return new TemplateArgument((TemplateArgument.Internal*) native); } @@ -1745,7 +1745,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new TemplateParameter __CreateInstance(global::System.IntPtr native) + public static TemplateParameter __CreateInstance(global::System.IntPtr native) { return new TemplateParameter((TemplateParameter.Internal*) native); } @@ -2404,7 +2404,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new VTableComponent __CreateInstance(global::System.IntPtr native) + public static VTableComponent __CreateInstance(global::System.IntPtr native) { return new VTableComponent((VTableComponent.Internal*) native); } @@ -2539,7 +2539,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new VTableLayout __CreateInstance(global::System.IntPtr native) + public static VTableLayout __CreateInstance(global::System.IntPtr native) { return new VTableLayout((VTableLayout.Internal*) native); } @@ -2649,7 +2649,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new VFTableInfo __CreateInstance(global::System.IntPtr native) + public static VFTableInfo __CreateInstance(global::System.IntPtr native) { return new VFTableInfo((VFTableInfo.Internal*) native); } @@ -2821,7 +2821,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ClassLayout __CreateInstance(global::System.IntPtr native) + public static ClassLayout __CreateInstance(global::System.IntPtr native) { return new ClassLayout((ClassLayout.Internal*) native); } @@ -3094,7 +3094,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Declaration __CreateInstance(global::System.IntPtr native) + public static Declaration __CreateInstance(global::System.IntPtr native) { return new Declaration((Declaration.Internal*) native); } @@ -3942,7 +3942,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Statement __CreateInstance(global::System.IntPtr native) + public static Statement __CreateInstance(global::System.IntPtr native) { return new Statement((Statement.Internal*) native); } @@ -5497,7 +5497,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new BaseClassSpecifier __CreateInstance(global::System.IntPtr native) + public static BaseClassSpecifier __CreateInstance(global::System.IntPtr native) { return new BaseClassSpecifier((BaseClassSpecifier.Internal*) native); } @@ -7152,7 +7152,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new FunctionTemplateSpecialization __CreateInstance(global::System.IntPtr native) + public static FunctionTemplateSpecialization __CreateInstance(global::System.IntPtr native) { return new FunctionTemplateSpecialization((FunctionTemplateSpecialization.Internal*) native); } @@ -8033,7 +8033,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new NativeLibrary __CreateInstance(global::System.IntPtr native) + public static NativeLibrary __CreateInstance(global::System.IntPtr native) { return new NativeLibrary((NativeLibrary.Internal*) native); } @@ -8212,7 +8212,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ASTContext __CreateInstance(global::System.IntPtr native) + public static ASTContext __CreateInstance(global::System.IntPtr native) { return new ASTContext((ASTContext.Internal*) native); } @@ -8308,7 +8308,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Comment __CreateInstance(global::System.IntPtr native) + public static Comment __CreateInstance(global::System.IntPtr native) { return new Comment((Comment.Internal*) native); } @@ -8482,7 +8482,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new RawComment __CreateInstance(global::System.IntPtr native) + public static RawComment __CreateInstance(global::System.IntPtr native) { return new RawComment((RawComment.Internal*) native); } diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs index ea22d7dc..aca945a6 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs @@ -234,7 +234,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserOptions __CreateInstance(global::System.IntPtr native) + public static ParserOptions __CreateInstance(global::System.IntPtr native) { return new ParserOptions((ParserOptions.Internal*) native); } @@ -656,7 +656,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserDiagnostic __CreateInstance(global::System.IntPtr native) + public static ParserDiagnostic __CreateInstance(global::System.IntPtr native) { return new ParserDiagnostic((ParserDiagnostic.Internal*) native); } @@ -838,7 +838,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserResult __CreateInstance(global::System.IntPtr native) + public static ParserResult __CreateInstance(global::System.IntPtr native) { return new ParserResult((ParserResult.Internal*) native); } @@ -986,7 +986,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ClangParser __CreateInstance(global::System.IntPtr native) + public static ClangParser __CreateInstance(global::System.IntPtr native) { return new ClangParser((ClangParser.Internal*) native); } diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Sources.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Sources.cs index deae31fd..c0aa572b 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Sources.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Sources.cs @@ -34,7 +34,7 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - public static new SourceLocation __CreateInstance(global::System.IntPtr native) + public static SourceLocation __CreateInstance(global::System.IntPtr native) { return new SourceLocation((SourceLocation.Internal*) native); } diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs index 77baaf4b..a88275e8 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs @@ -174,7 +174,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserTargetInfo __CreateInstance(global::System.IntPtr native) + public static ParserTargetInfo __CreateInstance(global::System.IntPtr native) { return new ParserTargetInfo((ParserTargetInfo.Internal*) native); } diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs index ba46883d..0b1d591c 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/AST.cs @@ -251,7 +251,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Type __CreateInstance(global::System.IntPtr native) + public static Type __CreateInstance(global::System.IntPtr native) { return new Type((Type.Internal*) native); } @@ -351,7 +351,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new TypeQualifiers __CreateInstance(global::System.IntPtr native) + public static TypeQualifiers __CreateInstance(global::System.IntPtr native) { return new TypeQualifiers((TypeQualifiers.Internal*) native); } @@ -466,7 +466,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new QualifiedType __CreateInstance(global::System.IntPtr native) + public static QualifiedType __CreateInstance(global::System.IntPtr native) { return new QualifiedType((QualifiedType.Internal*) native); } @@ -1443,7 +1443,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new TemplateArgument __CreateInstance(global::System.IntPtr native) + public static TemplateArgument __CreateInstance(global::System.IntPtr native) { return new TemplateArgument((TemplateArgument.Internal*) native); } @@ -1745,7 +1745,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new TemplateParameter __CreateInstance(global::System.IntPtr native) + public static TemplateParameter __CreateInstance(global::System.IntPtr native) { return new TemplateParameter((TemplateParameter.Internal*) native); } @@ -2404,7 +2404,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new VTableComponent __CreateInstance(global::System.IntPtr native) + public static VTableComponent __CreateInstance(global::System.IntPtr native) { return new VTableComponent((VTableComponent.Internal*) native); } @@ -2539,7 +2539,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new VTableLayout __CreateInstance(global::System.IntPtr native) + public static VTableLayout __CreateInstance(global::System.IntPtr native) { return new VTableLayout((VTableLayout.Internal*) native); } @@ -2649,7 +2649,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new VFTableInfo __CreateInstance(global::System.IntPtr native) + public static VFTableInfo __CreateInstance(global::System.IntPtr native) { return new VFTableInfo((VFTableInfo.Internal*) native); } @@ -2821,7 +2821,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ClassLayout __CreateInstance(global::System.IntPtr native) + public static ClassLayout __CreateInstance(global::System.IntPtr native) { return new ClassLayout((ClassLayout.Internal*) native); } @@ -3094,7 +3094,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Declaration __CreateInstance(global::System.IntPtr native) + public static Declaration __CreateInstance(global::System.IntPtr native) { return new Declaration((Declaration.Internal*) native); } @@ -3942,7 +3942,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Statement __CreateInstance(global::System.IntPtr native) + public static Statement __CreateInstance(global::System.IntPtr native) { return new Statement((Statement.Internal*) native); } @@ -5497,7 +5497,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new BaseClassSpecifier __CreateInstance(global::System.IntPtr native) + public static BaseClassSpecifier __CreateInstance(global::System.IntPtr native) { return new BaseClassSpecifier((BaseClassSpecifier.Internal*) native); } @@ -7152,7 +7152,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new FunctionTemplateSpecialization __CreateInstance(global::System.IntPtr native) + public static FunctionTemplateSpecialization __CreateInstance(global::System.IntPtr native) { return new FunctionTemplateSpecialization((FunctionTemplateSpecialization.Internal*) native); } @@ -8033,7 +8033,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new NativeLibrary __CreateInstance(global::System.IntPtr native) + public static NativeLibrary __CreateInstance(global::System.IntPtr native) { return new NativeLibrary((NativeLibrary.Internal*) native); } @@ -8212,7 +8212,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ASTContext __CreateInstance(global::System.IntPtr native) + public static ASTContext __CreateInstance(global::System.IntPtr native) { return new ASTContext((ASTContext.Internal*) native); } @@ -8308,7 +8308,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Comment __CreateInstance(global::System.IntPtr native) + public static Comment __CreateInstance(global::System.IntPtr native) { return new Comment((Comment.Internal*) native); } @@ -8482,7 +8482,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new RawComment __CreateInstance(global::System.IntPtr native) + public static RawComment __CreateInstance(global::System.IntPtr native) { return new RawComment((RawComment.Internal*) native); } diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs index f9a4ebe3..4349b437 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs @@ -234,7 +234,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserOptions __CreateInstance(global::System.IntPtr native) + public static ParserOptions __CreateInstance(global::System.IntPtr native) { return new ParserOptions((ParserOptions.Internal*) native); } @@ -656,7 +656,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserDiagnostic __CreateInstance(global::System.IntPtr native) + public static ParserDiagnostic __CreateInstance(global::System.IntPtr native) { return new ParserDiagnostic((ParserDiagnostic.Internal*) native); } @@ -838,7 +838,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserResult __CreateInstance(global::System.IntPtr native) + public static ParserResult __CreateInstance(global::System.IntPtr native) { return new ParserResult((ParserResult.Internal*) native); } @@ -986,7 +986,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ClangParser __CreateInstance(global::System.IntPtr native) + public static ClangParser __CreateInstance(global::System.IntPtr native) { return new ClangParser((ClangParser.Internal*) native); } diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Sources.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Sources.cs index c92c9973..deadc99d 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Sources.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Sources.cs @@ -34,7 +34,7 @@ namespace CppSharp internal static extern global::System.IntPtr cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - public static new SourceLocation __CreateInstance(global::System.IntPtr native) + public static SourceLocation __CreateInstance(global::System.IntPtr native) { return new SourceLocation((SourceLocation.Internal*) native); } diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs index cb6fc8f4..75100dfb 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs @@ -174,7 +174,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserTargetInfo __CreateInstance(global::System.IntPtr native) + public static ParserTargetInfo __CreateInstance(global::System.IntPtr native) { return new ParserTargetInfo((ParserTargetInfo.Internal*) native); } diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs index a0c7febf..cf9b6c18 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/AST.cs @@ -251,7 +251,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Type __CreateInstance(global::System.IntPtr native) + public static Type __CreateInstance(global::System.IntPtr native) { return new Type((Type.Internal*) native); } @@ -351,7 +351,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new TypeQualifiers __CreateInstance(global::System.IntPtr native) + public static TypeQualifiers __CreateInstance(global::System.IntPtr native) { return new TypeQualifiers((TypeQualifiers.Internal*) native); } @@ -466,7 +466,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new QualifiedType __CreateInstance(global::System.IntPtr native) + public static QualifiedType __CreateInstance(global::System.IntPtr native) { return new QualifiedType((QualifiedType.Internal*) native); } @@ -1443,7 +1443,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new TemplateArgument __CreateInstance(global::System.IntPtr native) + public static TemplateArgument __CreateInstance(global::System.IntPtr native) { return new TemplateArgument((TemplateArgument.Internal*) native); } @@ -1745,7 +1745,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new TemplateParameter __CreateInstance(global::System.IntPtr native) + public static TemplateParameter __CreateInstance(global::System.IntPtr native) { return new TemplateParameter((TemplateParameter.Internal*) native); } @@ -2404,7 +2404,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new VTableComponent __CreateInstance(global::System.IntPtr native) + public static VTableComponent __CreateInstance(global::System.IntPtr native) { return new VTableComponent((VTableComponent.Internal*) native); } @@ -2539,7 +2539,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new VTableLayout __CreateInstance(global::System.IntPtr native) + public static VTableLayout __CreateInstance(global::System.IntPtr native) { return new VTableLayout((VTableLayout.Internal*) native); } @@ -2648,7 +2648,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new VFTableInfo __CreateInstance(global::System.IntPtr native) + public static VFTableInfo __CreateInstance(global::System.IntPtr native) { return new VFTableInfo((VFTableInfo.Internal*) native); } @@ -2820,7 +2820,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ClassLayout __CreateInstance(global::System.IntPtr native) + public static ClassLayout __CreateInstance(global::System.IntPtr native) { return new ClassLayout((ClassLayout.Internal*) native); } @@ -3093,7 +3093,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Declaration __CreateInstance(global::System.IntPtr native) + public static Declaration __CreateInstance(global::System.IntPtr native) { return new Declaration((Declaration.Internal*) native); } @@ -3941,7 +3941,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Statement __CreateInstance(global::System.IntPtr native) + public static Statement __CreateInstance(global::System.IntPtr native) { return new Statement((Statement.Internal*) native); } @@ -5496,7 +5496,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new BaseClassSpecifier __CreateInstance(global::System.IntPtr native) + public static BaseClassSpecifier __CreateInstance(global::System.IntPtr native) { return new BaseClassSpecifier((BaseClassSpecifier.Internal*) native); } @@ -7151,7 +7151,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new FunctionTemplateSpecialization __CreateInstance(global::System.IntPtr native) + public static FunctionTemplateSpecialization __CreateInstance(global::System.IntPtr native) { return new FunctionTemplateSpecialization((FunctionTemplateSpecialization.Internal*) native); } @@ -8032,7 +8032,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new NativeLibrary __CreateInstance(global::System.IntPtr native) + public static NativeLibrary __CreateInstance(global::System.IntPtr native) { return new NativeLibrary((NativeLibrary.Internal*) native); } @@ -8211,7 +8211,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ASTContext __CreateInstance(global::System.IntPtr native) + public static ASTContext __CreateInstance(global::System.IntPtr native) { return new ASTContext((ASTContext.Internal*) native); } @@ -8307,7 +8307,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new Comment __CreateInstance(global::System.IntPtr native) + public static Comment __CreateInstance(global::System.IntPtr native) { return new Comment((Comment.Internal*) native); } @@ -8481,7 +8481,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new RawComment __CreateInstance(global::System.IntPtr native) + public static RawComment __CreateInstance(global::System.IntPtr native) { return new RawComment((RawComment.Internal*) native); } diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs index 91961b71..f2cf7132 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs @@ -234,7 +234,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserOptions __CreateInstance(global::System.IntPtr native) + public static ParserOptions __CreateInstance(global::System.IntPtr native) { return new ParserOptions((ParserOptions.Internal*) native); } @@ -656,7 +656,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserDiagnostic __CreateInstance(global::System.IntPtr native) + public static ParserDiagnostic __CreateInstance(global::System.IntPtr native) { return new ParserDiagnostic((ParserDiagnostic.Internal*) native); } @@ -838,7 +838,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserResult __CreateInstance(global::System.IntPtr native) + public static ParserResult __CreateInstance(global::System.IntPtr native) { return new ParserResult((ParserResult.Internal*) native); } @@ -986,7 +986,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ClangParser __CreateInstance(global::System.IntPtr native) + public static ClangParser __CreateInstance(global::System.IntPtr native) { return new ClangParser((ClangParser.Internal*) native); } diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Sources.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Sources.cs index deae31fd..c0aa572b 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Sources.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Sources.cs @@ -34,7 +34,7 @@ namespace CppSharp internal static extern void cctor_2(global::System.IntPtr instance, global::System.IntPtr _0); } - public static new SourceLocation __CreateInstance(global::System.IntPtr native) + public static SourceLocation __CreateInstance(global::System.IntPtr native) { return new SourceLocation((SourceLocation.Internal*) native); } diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs index 62d6958a..ef4b6a35 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Target.cs @@ -174,7 +174,7 @@ namespace CppSharp private readonly bool __ownsNativeInstance; - public static new ParserTargetInfo __CreateInstance(global::System.IntPtr native) + public static ParserTargetInfo __CreateInstance(global::System.IntPtr native) { return new ParserTargetInfo((ParserTargetInfo.Internal*) native); } diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index 41d613d9..89c330a3 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -744,9 +744,7 @@ namespace CppSharp.Generators.CSharp var bases = new List(); - var needsBase = @class.HasBaseClass && !@class.IsValueType && @class.IsGenerated - && !@class.Bases[0].Class.IsValueType - && @class.Bases[0].Class.IsGenerated; + var needsBase = @class.HasGeneratedBase; if (needsBase) { @@ -1903,11 +1901,13 @@ namespace CppSharp.Generators.CSharp if (!@class.IsAbstract) { PushBlock(CSharpBlockKind.Method); - WriteLine("public static new {0} {1}(global::System.IntPtr native)", safeIdentifier, Helpers.CreateInstanceIdentifier); + WriteLine("public static {0}{1} {2}(global::System.IntPtr native)", + @class.HasGeneratedBase && !@class.BaseClass.IsAbstract ? "new " : string.Empty, + safeIdentifier, Helpers.CreateInstanceIdentifier); WriteStartBraceIndent(); WriteLine("return new {0}(({1}.Internal*) native);", safeIdentifier, className); WriteCloseBraceIndent(); - PopBlock(NewLineKind.BeforeNextBlock); + PopBlock(NewLineKind.BeforeNextBlock); } GenerateNativeConstructorByValue(@class, className, safeIdentifier);