EP 0.1.1 转换
This commit is contained in:
@@ -8,9 +8,9 @@ namespace Convention.Symbolization.Internal
|
||||
{
|
||||
public readonly FunctionSymbol FunctionInfo;
|
||||
|
||||
protected Function(string symbolName,string functionName, Type returnType, Type[] parameterTypes, Modification[] modifiers) : base(symbolName)
|
||||
protected Function(string symbolName,string functionName, Type returnType, Type[] parameterTypes) : base(symbolName)
|
||||
{
|
||||
FunctionInfo = new(functionName, returnType, parameterTypes, modifiers);
|
||||
FunctionInfo = new(functionName, returnType, parameterTypes);
|
||||
}
|
||||
public abstract Variable Invoke(SymbolizationContext context, Variable[] parameters);
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace Convention.Symbolization.Internal
|
||||
public readonly MethodInfo methodInfo;
|
||||
|
||||
public DelegationalFunction(string symbolName, MethodInfo methodInfo)
|
||||
: base(symbolName, methodInfo.Name, methodInfo.ReturnType, methodInfo.GetParameters().ToList().ConvertAll(x => x.ParameterType).ToArray(), Array.Empty<Modification>())
|
||||
: base(symbolName, methodInfo.Name, methodInfo.ReturnType, methodInfo.GetParameters().ToList().ConvertAll(x => x.ParameterType).ToArray())
|
||||
{
|
||||
this.methodInfo = methodInfo!;
|
||||
}
|
||||
@@ -44,22 +44,43 @@ namespace Convention.Symbolization.Internal
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ScriptFunction : Function
|
||||
{
|
||||
public ScriptFunction(string symbolName,
|
||||
string functionName, Type returnType, Type[] parameterTypes)
|
||||
: base(symbolName, functionName, returnType, parameterTypes)
|
||||
{
|
||||
}
|
||||
|
||||
public override Function CloneVariable(string targetSymbolName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool Equals(Function other)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override Variable Invoke(SymbolizationContext context, Variable[] parameters)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public readonly struct FunctionSymbol
|
||||
{
|
||||
public readonly string FunctionName;
|
||||
public readonly Type ReturnType;
|
||||
public readonly Type[] ParameterTypes;
|
||||
public readonly Modification[] Modifiers;
|
||||
public readonly string FullName;
|
||||
|
||||
public FunctionSymbol(string symbolName, Type returnType, Type[] parameterTypes, Modification[] modifiers)
|
||||
public FunctionSymbol(string symbolName, Type returnType, Type[] parameterTypes)
|
||||
{
|
||||
this.FunctionName = symbolName;
|
||||
this.ReturnType = returnType;
|
||||
this.ParameterTypes = parameterTypes;
|
||||
this.Modifiers = modifiers;
|
||||
this.FullName = $"{returnType.FullName} {symbolName}({string.Join(',', parameterTypes.ToList().ConvertAll(x => x.FullName))}) {string.Join(' ', modifiers.ToList().ConvertAll(x => x.ToString()))}";
|
||||
this.FullName = $"{returnType.FullName} {symbolName}({string.Join(',', parameterTypes.ToList().ConvertAll(x => x.FullName))})";
|
||||
}
|
||||
|
||||
public bool Equals(FunctionSymbol other)
|
||||
|
Reference in New Issue
Block a user