FunctionDeclarator
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace CLanguage.Syntax
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class FunctionDeclarator : Declarator
{
public List<ParameterDeclaration> Parameters { get; set; }
public override string DeclaredIdentifier {
get {
if (base.InnerDeclarator == null)
return "";
return base.InnerDeclarator.DeclaredIdentifier;
}
}
public FunctionDeclarator(Declarator innerDeclarator, List<ParameterDeclaration> parameters)
: base(innerDeclarator)
{
Parameters = parameters;
}
public FunctionDeclarator(List<ParameterDeclaration> parameters)
: base(null)
{
Parameters = parameters;
}
public override string ToString()
{
return DeclaredIdentifier + "(" + string.Join(", ", Parameters) + ")";
}
}
}