public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
List<CLS_Content.Value> list = new List<CLS_Content.Value>();
foreach (ICLS_Expression p in listParam)
{
if (p != null)
{
list.Add(p.ComputeValue(content));
}
}
CLS_Content.Value v = null;
SType.Function retFunc = null;
bool bFind = false;
if (content.CallType != null)
bFind = content.CallType.functions.TryGetValue(funcname, out retFunc);
if (bFind)
{
if (retFunc.bStatic)
{
v = content.CallType.StaticCall(content, funcname, list);
}
else
{
v = content.CallType.MemberCall(content, content.CallThis, funcname, list);
}
}
else
{
v = content.GetQuiet(funcname);
if (v != null && v.value is Delegate)
{
//if(v.value is Delegate)
{
Delegate d = v.value as Delegate;
v = new CLS_Content.Value();
object[] obja = new object[list.Count];
for (int i = 0; i < list.Count; i++)
{
obja[i] = list[i].value;
}
v.value = d.DynamicInvoke(obja);
if (v.value == null)
{
v.type = null;
}
else
{
v.type = v.value.GetType();
}
}
//else
//{
// throw new Exception(funcname + "不是函数");
//}
}
else
{
v = content.environment.GetFunction(funcname).Call(content, list);
}
}
//操作变量之
//做数学计算
//从上下文取值
//_value = null;
content.OutStack(this);
return v;
}
public string funcname;