当设置变量值时如果找不到变量则优先在临时变量上下文中声明变量
This commit is contained in:
@@ -151,6 +151,7 @@ namespace Deedy.Testing
|
|||||||
/// <param name="script">要执行的脚本</param>
|
/// <param name="script">要执行的脚本</param>
|
||||||
public void Init(string script)
|
public void Init(string script)
|
||||||
{
|
{
|
||||||
|
//TODO:这里需要进行语法校验
|
||||||
this.Script.Clear();
|
this.Script.Clear();
|
||||||
|
|
||||||
string[] cmdLines = script.Split(['\r', '\n'], StringSplitOptions.RemoveEmptyEntries);
|
string[] cmdLines = script.Split(['\r', '\n'], StringSplitOptions.RemoveEmptyEntries);
|
||||||
@@ -583,7 +584,6 @@ namespace Deedy.Testing
|
|||||||
if (func.Name == funcName)
|
if (func.Name == funcName)
|
||||||
{
|
{
|
||||||
this.Invoke_FuncStack.Push(new Def_FuncInvoke(this.Control_CurrentLine + 1));
|
this.Invoke_FuncStack.Push(new Def_FuncInvoke(this.Control_CurrentLine + 1));
|
||||||
//TODO:根据「Func」指令定义声明局部变量
|
|
||||||
string[] funcArgs = this.Script[func.Line].Split(' ', options: StringSplitOptions.RemoveEmptyEntries)[2..];
|
string[] funcArgs = this.Script[func.Line].Split(' ', options: StringSplitOptions.RemoveEmptyEntries)[2..];
|
||||||
Array.Reverse(funcArgs);
|
Array.Reverse(funcArgs);
|
||||||
for (int i = 0; i < funcArgs.Length; i++)
|
for (int i = 0; i < funcArgs.Length; i++)
|
||||||
@@ -1084,7 +1084,10 @@ namespace Deedy.Testing
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.Param_Global.Add(paramName, paramValue);
|
// 如果找不到已经定义好的参数,优先在局部变量表中声明参数
|
||||||
|
Dictionary<string, object> paramsContext = this.Param_Global;
|
||||||
|
if (this.Invoke_FuncStack.TryPeek(out var funcSpace)) paramsContext = funcSpace.LocalParams;
|
||||||
|
paramsContext.Add(paramName, paramValue);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 从参数表中获取参数
|
/// 从参数表中获取参数
|
||||||
|
|||||||
Reference in New Issue
Block a user