FunctionDeclarator
using System.Collections.Generic;
namespace CLanguage.Syntax
{
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) + ")";
}
}
}