mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-13 13:09:25 +08:00
优化了脚本生成AST时的代码提示,增加了脚本运行时错误提示。
This commit is contained in:
@@ -146,24 +146,28 @@ namespace Serein.NodeFlow.Model
|
||||
partial void OnIsPublicChanged(bool oldValue, bool newValue)
|
||||
{
|
||||
var list = CanvasDetails.PublicNodes.ToList();
|
||||
if (newValue)
|
||||
_ = SereinEnv.TriggerEvent(() =>
|
||||
{
|
||||
// 公开节点
|
||||
if (!CanvasDetails.PublicNodes.Contains(this))
|
||||
if (newValue)
|
||||
{
|
||||
list.Add(this);
|
||||
CanvasDetails.PublicNodes= list;
|
||||
// 公开节点
|
||||
if (!CanvasDetails.PublicNodes.Contains(this))
|
||||
{
|
||||
list.Add(this);
|
||||
CanvasDetails.PublicNodes = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 取消公开
|
||||
if (CanvasDetails.PublicNodes.Contains(this))
|
||||
else
|
||||
{
|
||||
list.Remove(this);
|
||||
CanvasDetails.PublicNodes = list;
|
||||
// 取消公开
|
||||
if (CanvasDetails.PublicNodes.Contains(this))
|
||||
{
|
||||
list.Remove(this);
|
||||
CanvasDetails.PublicNodes = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -132,19 +132,31 @@ namespace Serein.NodeFlow.Model
|
||||
|
||||
throw new Exception($"节点{this.Guid}不存在对应委托");
|
||||
}
|
||||
var instance = Env.IOC.Get(md.ActingInstanceType);
|
||||
if (instance is null)
|
||||
if (md.IsStatic)
|
||||
{
|
||||
Env.IOC.Register(md.ActingInstanceType).Build();
|
||||
instance = Env.IOC.Get(md.ActingInstanceType);
|
||||
object[] args = await this.GetParametersAsync(context, token);
|
||||
var result = await dd.InvokeAsync(null, args);
|
||||
var flowReslt = new FlowResult(this.Guid, context, result);
|
||||
return flowReslt;
|
||||
}
|
||||
object[] args = await this.GetParametersAsync(context, token);
|
||||
var result = await dd.InvokeAsync(instance, args);
|
||||
var flowReslt = new FlowResult(this.Guid, context, result);
|
||||
return flowReslt;
|
||||
else
|
||||
{
|
||||
var instance = Env.IOC.Get(md.ActingInstanceType);
|
||||
if (instance is null)
|
||||
{
|
||||
Env.IOC.Register(md.ActingInstanceType).Build();
|
||||
instance = Env.IOC.Get(md.ActingInstanceType);
|
||||
}
|
||||
object[] args = await this.GetParametersAsync(context, token);
|
||||
var result = await dd.InvokeAsync(instance, args);
|
||||
var flowReslt = new FlowResult(this.Guid, context, result);
|
||||
return flowReslt;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -317,7 +317,8 @@ namespace Serein.NodeFlow.Model
|
||||
_ => base.ExecutingAsync(context, token)
|
||||
});
|
||||
|
||||
|
||||
// 对于目标节点的后续节点,如果入参参数来源指定为它(目标节点)时,就需要从上下文中根据它的Guid获取流程数据
|
||||
context.AddOrUpdateFlowData(TargetNode.Guid, flowData);
|
||||
if (IsShareParam)
|
||||
{
|
||||
// 设置运行时上一节点
|
||||
@@ -325,7 +326,6 @@ namespace Serein.NodeFlow.Model
|
||||
// 此处代码与SereinFlow.Library.FlowNode.ParameterDetails
|
||||
// ToMethodArgData()方法中判断流程接口节点分支逻辑耦合
|
||||
// 不要轻易修改
|
||||
context.AddOrUpdateFlowData(TargetNode.Guid, flowData);
|
||||
foreach (ConnectionInvokeType ctType in NodeStaticConfig.ConnectionTypes)
|
||||
{
|
||||
if (this.SuccessorNodes[ctType] == null) continue;
|
||||
|
||||
@@ -158,13 +158,14 @@ namespace Serein.NodeFlow.Model
|
||||
varNames.Add(pd.Name);
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var sb = new StringBuilder();
|
||||
foreach (var pd in MethodDetails.ParameterDetailss)
|
||||
{
|
||||
sb.AppendLine($"let {pd.Name};"); // 提前声明这些变量
|
||||
}
|
||||
sb.Append(Script);
|
||||
var p = new SereinScriptParser(sb.ToString());
|
||||
var script = sb.ToString();
|
||||
var p = new SereinScriptParser(script);
|
||||
//var p = new SereinScriptParser(Script);
|
||||
mainNode = p.Parse(); // 开始解析
|
||||
|
||||
|
||||
Reference in New Issue
Block a user