Skip to content

Commit

Permalink
Corrected the type
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaeldui committed Jan 11, 2022
1 parent 80a7a39 commit ad424e3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.CodeAnalysis.CSharp.Syntax
{
using static SyntaxFactory;
using DeclarationSyntax = ConstructorDeclarationSyntax;

public static class ConstructorDeclarationSyntaxExtensions
{
public static DeclarationSyntax WithBody(this DeclarationSyntax @this, string bodyStatement) =>
@this.WithBody(bodyStatement.ToBlock());

public static DeclarationSyntax WithBaseConstructorInitializer(this DeclarationSyntax @this) =>
@this.WithInitializer(ConstructorInitializer(SyntaxKind.BaseConstructorInitializer));

public static DeclarationSyntax WithBaseConstructorInitializer(this DeclarationSyntax @this, params string[] argumentIdentifiers) =>
@this.WithInitializer(ConstructorInitializer(SyntaxKind.BaseConstructorInitializer)
.WithArgumentList(argumentIdentifiers.ToArgumentList()));

public static DeclarationSyntax WithModifier(this DeclarationSyntax @this, SyntaxKind modifier) =>
@this.WithModifiers(modifier.ToTokenList());

public static DeclarationSyntax WithModifiers(this DeclarationSyntax @this, params SyntaxKind[] modifiers) =>
@this.WithModifiers(modifiers.ToTokenList());

public static DeclarationSyntax AddModifier(this DeclarationSyntax @this, SyntaxKind modifier) =>
@this.AddModifiers(modifier.ToToken());

public static DeclarationSyntax AddModifiers(this DeclarationSyntax @this, params SyntaxKind[] modifiers) =>
@this.AddModifiers(modifiers.ToTokens());

public static DeclarationSyntax AddAttribute(this DeclarationSyntax @this, AttributeSyntax attribute) =>
@this.AddAttributeLists(attribute.ToAttributeList());

public static DeclarationSyntax AddAttributes(this DeclarationSyntax @this, params AttributeSyntax[] attributes) =>
@this.AddAttributeLists(attributes.ToAttributeList());

public static ConstructorDeclarationSyntax WithParameter(this ConstructorDeclarationSyntax @this, string parameterType, string parameterIdentifier) =>
@this.WithParameterList((parameterIdentifier, parameterType).ToParameterList());

public static ConstructorDeclarationSyntax WithParameters(this ConstructorDeclarationSyntax @this, IEnumerable<KeyValuePair<string, string>> parameters) =>
@this.WithParameterList(parameters.ToParameterList());

}
}
using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.CodeAnalysis.CSharp.Syntax
{
using static SyntaxFactory;
using DeclarationSyntax = ConstructorDeclarationSyntax;

public static class ConstructorDeclarationSyntaxExtensions
{
public static DeclarationSyntax WithBody(this DeclarationSyntax @this, string bodyStatement) =>
@this.WithBody(bodyStatement.ToBlock());

public static DeclarationSyntax WithBaseConstructorInitializer(this DeclarationSyntax @this) =>
@this.WithInitializer(ConstructorInitializer(SyntaxKind.BaseConstructorInitializer));

public static DeclarationSyntax WithBaseConstructorInitializer(this DeclarationSyntax @this, params string[] argumentIdentifiers) =>
@this.WithInitializer(ConstructorInitializer(SyntaxKind.BaseConstructorInitializer)
.WithArgumentList(argumentIdentifiers.ToArgumentList()));

public static DeclarationSyntax WithModifier(this DeclarationSyntax @this, SyntaxKind modifier) =>
@this.WithModifiers(modifier.ToTokenList());

public static DeclarationSyntax WithModifiers(this DeclarationSyntax @this, params SyntaxKind[] modifiers) =>
@this.WithModifiers(modifiers.ToTokenList());

public static DeclarationSyntax AddModifier(this DeclarationSyntax @this, SyntaxKind modifier) =>
@this.AddModifiers(modifier.ToToken());

public static DeclarationSyntax AddModifiers(this DeclarationSyntax @this, params SyntaxKind[] modifiers) =>
@this.AddModifiers(modifiers.ToTokens());

public static DeclarationSyntax AddAttribute(this DeclarationSyntax @this, AttributeSyntax attribute) =>
@this.AddAttributeLists(attribute.ToAttributeList());

public static DeclarationSyntax AddAttributes(this DeclarationSyntax @this, params AttributeSyntax[] attributes) =>
@this.AddAttributeLists(attributes.ToAttributeList());

public static DeclarationSyntax WithParameter(this DeclarationSyntax @this, string parameterType, string parameterIdentifier) =>
@this.WithParameterList((parameterIdentifier, parameterType).ToParameterList());

public static DeclarationSyntax WithParameters(this DeclarationSyntax @this, IEnumerable<KeyValuePair<string, string>> parameters) =>
@this.WithParameterList(parameters.ToParameterList());

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public static DeclarationSyntax AddAttribute(this DeclarationSyntax @this, strin
public static DeclarationSyntax WithBody(this DeclarationSyntax @this, string bodyStatement) =>
@this.WithBody(bodyStatement.ToBlock());

public static ConstructorDeclarationSyntax WithParameter(this ConstructorDeclarationSyntax @this, string parameterType, string parameterIdentifier) =>
public static DeclarationSyntax WithParameter(this DeclarationSyntax @this, string parameterType, string parameterIdentifier) =>
@this.WithParameterList((parameterIdentifier, parameterType).ToParameterList());

public static ConstructorDeclarationSyntax WithParameters(this ConstructorDeclarationSyntax @this, IEnumerable<KeyValuePair<string, string>> parameters) =>
public static DeclarationSyntax WithParameters(this DeclarationSyntax @this, IEnumerable<KeyValuePair<string, string>> parameters) =>
@this.WithParameterList(parameters.ToParameterList());
}
}

0 comments on commit ad424e3

Please sign in to comment.