本文整理汇总了C#中P6any.SetSlot方法的典型用法代码示例。如果您正苦于以下问题:C# P6any.SetSlot方法的具体用法?C# P6any.SetSlot怎么用?C# P6any.SetSlot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P6any
的用法示例。
在下文中一共展示了P6any.SetSlot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EstablishSlot
public static void EstablishSlot(P6any n, P6how.AttrInfo ai,
Variable vx)
{
Variable obj;
if ((ai.flags & P6how.A_TYPE) == P6how.A_SCALAR) {
if (ai.type == null)
obj = Kernel.NewMuScalar(
vx != null ? vx.Fetch() : n.mo.setting.AnyMO.typeObj);
else
obj = Kernel.NewRWScalar(ai.type,
vx != null ? vx.Fetch() : ai.type.initObj);
} else {
obj = (ai.flags & P6how.A_HASH) != 0 ?
n.mo.setting.CreateHash() : n.mo.setting.CreateArray();
if (vx != null) {
// https://github.com/sorear/niecza/issues/104
if (!vx.List)
vx = Kernel.NewRWListVar(vx.Fetch());
Kernel.Assign(obj, vx);
}
}
n.SetSlot(ai.owner, ai.name, obj);
}
示例2: UnpackCaps
public void UnpackCaps(P6any into)
{
List<VarDeque> posr = new List<VarDeque>();
Dictionary<string,VarDeque> namr = new Dictionary<string,VarDeque>();
CapInfo it = captures;
for (; it != null; it = it.prev) {
if (it.names[0] == null)
continue; // special node
foreach (string name in it.names) {
int nami;
VarDeque t;
if (int.TryParse(name, out nami) && nami >= 0) {
while(posr.Count <= nami) posr.Add(new VarDeque());
t = posr[nami];
} else {
if (!namr.TryGetValue(name, out t))
namr[name] = t = new VarDeque();
}
t.Unshift(it.cap);
}
}
VarHash nam = new VarHash();
Variable[] pos = new Variable[posr.Count];
foreach (KeyValuePair<string, VarDeque> kv in namr)
nam[kv.Key] = FixupList(kv.Value);
for (int i = 0; i < pos.Length; i++)
pos[i] = FixupList(posr[i]);
into.SetSlot(Kernel.CaptureMO, "$!positionals", pos);
into.SetSlot(Kernel.CaptureMO, "$!named", nam);
}
示例3: EstablishSlot
public static void EstablishSlot(P6any n, P6how.AttrInfo ai,
Variable vx)
{
Variable obj;
if ((ai.flags & P6how.A_TYPE) == P6how.A_SCALAR) {
if (ai.type == null)
obj = Kernel.NewMuScalar(
vx != null ? vx.Fetch() : Kernel.AnyMO.typeObject);
else
obj = Kernel.NewRWScalar(ai.type,
vx != null ? vx.Fetch() : ai.type.initObject);
} else {
obj = (ai.flags & P6how.A_HASH) != 0 ?
Kernel.CreateHash() : Kernel.CreateArray();
if (vx != null) Kernel.Assign(obj, vx);
}
n.SetSlot(ai.owner, ai.name, obj);
}