ParameterDeclaration
using System.Runtime.CompilerServices;
namespace CLanguage.Syntax
{
[System.Runtime.CompilerServices.NullableContext(2)]
[System.Runtime.CompilerServices.Nullable(0)]
public class ParameterDeclaration
{
[System.Runtime.CompilerServices.Nullable(1)]
[field: System.Runtime.CompilerServices.Nullable(1)]
public string Name {
[System.Runtime.CompilerServices.NullableContext(1)]
get;
[System.Runtime.CompilerServices.NullableContext(1)]
private set;
}
public DeclarationSpecifiers DeclarationSpecifiers { get; set; }
public Declarator Declarator { get; set; }
public Expression DefaultValue { get; }
public Expression CtorArgumentValue { get; set; }
[System.Runtime.CompilerServices.NullableContext(1)]
public ParameterDeclaration(string name)
{
Name = name;
}
[System.Runtime.CompilerServices.NullableContext(1)]
public ParameterDeclaration(Expression ctorArgumentValue)
{
Name = "";
CtorArgumentValue = ctorArgumentValue;
}
[System.Runtime.CompilerServices.NullableContext(1)]
public ParameterDeclaration(DeclarationSpecifiers specs)
{
DeclarationSpecifiers = specs;
Name = "";
}
[System.Runtime.CompilerServices.NullableContext(1)]
public ParameterDeclaration(DeclarationSpecifiers specs, Declarator dec)
{
DeclarationSpecifiers = specs;
Name = dec.DeclaredIdentifier;
Declarator = dec;
}
[System.Runtime.CompilerServices.NullableContext(1)]
public ParameterDeclaration(DeclarationSpecifiers specs, Declarator dec, Expression defaultValue)
{
DeclarationSpecifiers = specs;
Name = dec.DeclaredIdentifier;
Declarator = dec;
DefaultValue = defaultValue;
}
[System.Runtime.CompilerServices.NullableContext(1)]
public override string ToString()
{
return DeclarationSpecifiers?.ToString() + " " + Declarator?.ToString();
}
}
}