14 lines
738 B
C#
14 lines
738 B
C#
using Nub.Lang.Frontend.Lexing;
|
|
|
|
namespace Nub.Lang.Frontend.Parsing;
|
|
|
|
public class LocalFuncDefinitionNode(IReadOnlyList<Token> tokens, Optional<string> documentation, string name, List<FuncParameter> parameters, BlockNode body, Optional<NubType> returnType, bool global) : DefinitionNode(tokens, documentation)
|
|
{
|
|
public string Name { get; } = name;
|
|
public List<FuncParameter> Parameters { get; } = parameters;
|
|
public BlockNode Body { get; } = body;
|
|
public Optional<NubType> ReturnType { get; } = returnType;
|
|
public bool Global { get; } = global;
|
|
|
|
public override string ToString() => $"{Name}({string.Join(", ", Parameters.Select(p => p.ToString()))}){(ReturnType.HasValue ? ": " + ReturnType.Value : "")}";
|
|
} |