@ -125,9 +125,14 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
if ( context . DecompileRun . RecordDecompilers . TryGetValue ( currentCtor . DeclaringTypeDefinition , out var record )
if ( context . DecompileRun . RecordDecompilers . TryGetValue ( currentCtor . DeclaringTypeDefinition , out var record )
& & currentCtor . Equals ( record . PrimaryConstructor ) )
& & currentCtor . Equals ( record . PrimaryConstructor ) )
{
{
if ( record . IsInheritedRecord & &
if ( ci ? . ConstructorInitializerType = = ConstructorInitializerType . Base & &
ci ? . ConstructorInitializerType = = ConstructorInitializerType . Base & &
constructorDeclaration . Parent is TypeDeclaration { BaseTypes : { Count : > = 1 } } typeDecl )
constructorDeclaration . Parent is TypeDeclaration { BaseTypes : { Count : > = 1 } } typeDecl )
{
// Only perform this transformation if the declaring type actually has a non-object class base.
// This prevents converting implemented interfaces into an invocation type (which caused the
// spurious trailing '()' in the decompiled output).
var baseClassType = currentCtor . DeclaringTypeDefinition . DirectBaseTypes . FirstOrDefault ( b = > b . Kind = = TypeKind . Class ) ;
if ( baseClassType ! = null & & ! baseClassType . IsKnownType ( KnownTypeCode . Object ) )
{
{
var baseType = typeDecl . BaseTypes . First ( ) ;
var baseType = typeDecl . BaseTypes . First ( ) ;
var newBaseType = new InvocationAstType ( ) ;
var newBaseType = new InvocationAstType ( ) ;
@ -135,6 +140,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
newBaseType . BaseType = baseType ;
newBaseType . BaseType = baseType ;
ci . Arguments . MoveTo ( newBaseType . Arguments ) ;
ci . Arguments . MoveTo ( newBaseType . Arguments ) ;
}
}
}
if ( constructorDeclaration . Parent is TypeDeclaration { PrimaryConstructorParameters : var parameters } )
if ( constructorDeclaration . Parent is TypeDeclaration { PrimaryConstructorParameters : var parameters } )
{
{
foreach ( var ( cpd , ppd ) in constructorDeclaration . Parameters . Zip ( parameters ) )
foreach ( var ( cpd , ppd ) in constructorDeclaration . Parameters . Zip ( parameters ) )