本文整理汇总了C#中FunctionObject.SetupParameters方法的典型用法代码示例。如果您正苦于以下问题:C# FunctionObject.SetupParameters方法的具体用法?C# FunctionObject.SetupParameters怎么用?C# FunctionObject.SetupParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionObject
的用法示例。
在下文中一共展示了FunctionObject.SetupParameters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterMethod
public int RegisterMethod(MethodInfo info, int type_id)
{
int num = this.FindMethod(info);
if (num <= 0)
{
num = this.AppVar();
this[num].Name = info.Name;
this[num].Level = type_id;
this[num].Kind = MemberKind.Method;
this[num].TypeId = this.RegisterType(info.ReturnType, false);
FunctionObject m = new FunctionObject(this.scripter, num, type_id);
if (info.IsPublic)
{
m.Modifiers.Add(Modifier.Public);
}
if (info.IsStatic)
{
m.Modifiers.Add(Modifier.Static);
}
if (info.IsAbstract)
{
m.Modifiers.Add(Modifier.Abstract);
}
if (info.IsVirtual)
{
m.Modifiers.Add(Modifier.Virtual);
}
m.Imported = true;
m.Method_Info = info;
this[num].Value = m;
this.AppVar();
int num2 = this.AppVar();
this[num2].Level = num;
this[num2].TypeId = this.RegisterType(info.ReturnType, false);
int num3 = this.AppVar();
this[num3].Level = num;
if (!info.IsStatic)
{
this[num3].Name = "this";
}
bool flag = false;
int id = 0;
foreach (ParameterInfo info2 in info.GetParameters())
{
id = this.AppVar();
this[id].Level = num;
this[id].TypeId = this.RegisterType(info2.ParameterType, false);
m.AddParam(id, ParamMod.None);
if (flag || ((info2.DefaultValue != null) && (info2.DefaultValue != DBNull.Value)))
{
int typeId = this[id].TypeId;
object defaultValue = info2.DefaultValue;
if (info2.ParameterType.IsEnum)
{
defaultValue = ConvertHelper.ToEnum(info2.ParameterType, defaultValue);
}
int num6 = this.AppConst(defaultValue, typeId);
m.AddDefaultValueId(id, num6);
flag = true;
}
}
if (id != 0)
{
int num7 = this[id].TypeId;
if (CSLite_System.GetRank(this[num7].Name) == 1)
{
m.ParamsId = id;
int num8 = this[m.ParamsId].TypeId;
string elementTypeName = CSLite_System.GetElementTypeName(this[num8].Name);
int num9 = this.scripter.GetTypeId(elementTypeName);
m.ParamsElementId = this.AppVar();
this[m.ParamsElementId].TypeId = num9;
}
}
m.SetupParameters();
((ClassObject) this[type_id].Val).AddMember(m);
}
return num;
}
示例2: RegisterConstructor
public int RegisterConstructor(ConstructorInfo info, int type_id)
{
int num = this.AppVar();
this[num].Name = info.Name;
this[num].Level = type_id;
this[num].Kind = MemberKind.Constructor;
FunctionObject m = new FunctionObject(this.scripter, num, type_id);
if (info.IsPublic)
{
m.Modifiers.Add(Modifier.Public);
}
if (info.IsStatic)
{
m.Modifiers.Add(Modifier.Static);
}
if (info.IsAbstract)
{
m.Modifiers.Add(Modifier.Abstract);
}
if (info.IsVirtual)
{
m.Modifiers.Add(Modifier.Virtual);
}
m.Imported = true;
m.Constructor_Info = info;
this[num].Value = m;
int num2 = this.AppVar();
int num3 = this.AppVar();
if (!info.IsStatic)
{
this[num3].Name = "this";
}
foreach (ParameterInfo info2 in info.GetParameters())
{
int id = this.AppVar();
this[id].Level = num;
this[id].TypeId = this.RegisterType(info2.ParameterType, false);
object defaultValue = null;
if ((info2.DefaultValue != null) && (info2.DefaultValue != DBNull.Value))
{
defaultValue = info2.DefaultValue;
}
m.AddParam(id, ParamMod.None);
}
m.SetupParameters();
((ClassObject) this[type_id].Val).AddMember(m);
return num;
}