123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using System;
- using System.Diagnostics;
- namespace NTERA.Interpreter.Compiler
- {
- [DebuggerDisplay("{Name} ({Parameters.Length})")]
- public class FunctionDefinition
- {
- public string Name { get; }
- public FunctionParameter[] Parameters { get; }
- public FunctionVariable[] Variables { get; }
- public bool IsReturnFunction { get; }
- public string Filename { get; }
- public Marker Position { get; }
- public FunctionDefinition(string name, FunctionParameter[] parameters, FunctionVariable[] methodVariables, bool isReturnFunction, string filename, Marker position)
- {
- Name = name;
- Parameters = parameters;
- Variables = methodVariables;
- IsReturnFunction = isReturnFunction;
- Filename = filename;
- Position = position;
- }
- }
- [Flags]
- public enum VariableType
- {
- None = 0,
- Constant = 1,
- Reference = 2,
- Dynamic = 4,
- }
- public class FunctionVariable
- {
- public string Name { get; }
- public System.ValueType ValueType { get; }
- public VariableType VariableType { get; }
- public Value? DefaultValue { get; }
- public FunctionVariable(string name, System.ValueType valueType, VariableType variableType = VariableType.None, Value? defaultValue = null)
- {
- Name = name;
- ValueType = valueType;
- VariableType = variableType;
- DefaultValue = defaultValue;
- }
- }
- public class FunctionParameter
- {
- public string Name { get; }
- public string[] Indices { get; }
- public Value? DefaultValue { get; }
- public FunctionParameter(string name, string[] indices, Value? defaultValue = null)
- {
- Name = name;
- Indices = indices;
- DefaultValue = defaultValue;
- }
- }
- }
|