本文整理汇总了C#中Stack.ToSList方法的典型用法代码示例。如果您正苦于以下问题:C# Stack.ToSList方法的具体用法?C# Stack.ToSList怎么用?C# Stack.ToSList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stack
的用法示例。
在下文中一共展示了Stack.ToSList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DynamicWind
public static void DynamicWind(Arguments args, VM vm, SourceInfo info)
{
ValueCont cont = vm.GetCont();
var winder = new KeyValuePair<IValue, IValue>(args[0], args[2]);
var winders = SList.Cons(winder, vm.Winders);
Stack<IInsn> insnStack = new Stack<IInsn>();
insnStack.Push(new InsnCall(0, info));
insnStack.Push(InsnPop.Instance);
insnStack.Push(new InsnSetWinders(winders));
insnStack.Push(new InsnPush(args[1]));
insnStack.Push(new InsnCall(0, info));
insnStack.Push(new InsnCall(1, info));
vm.Insns = insnStack.ToSList();
vm.Stack = SList.List<IValue>(args[0], cont);
}
示例2: SetCont
public void SetCont(IValue returnValue, ValueCont cont, SourceInfo info)
{
var winders = cont.Winders;
if (winders == Winders)
{
Insns = cont.Insns;
Stack = cont.Stack;
Env = cont.Env;
Push(returnValue);
}
else if (winders.ContainsList(Winders))
{
var newWinders = winders.GetPreviousList(Winders);
IValue before = newWinders.Head.Key;
Stack<IInsn> insnStack = new Stack<IInsn>();
insnStack.Push(new InsnPush(before));
insnStack.Push(new InsnCall(0, info));
insnStack.Push(InsnPop.Instance);
insnStack.Push(new InsnSetWinders(newWinders));
insnStack.Push(new InsnPush(cont));
insnStack.Push(new InsnPush(returnValue));
insnStack.Push(new InsnCall(1, info));
Insns = insnStack.ToSList();
Stack = SList.Nil<IValue>();
}
else
{
IValue after = Winders.Head.Value;
Winders = Winders.Tail;
Stack<IInsn> insnStack = new Stack<IInsn>();
insnStack.Push(new InsnPush(after));
insnStack.Push(new InsnCall(0, info));
insnStack.Push(InsnPop.Instance);
insnStack.Push(new InsnPush(cont));
insnStack.Push(new InsnPush(returnValue));
insnStack.Push(new InsnCall(1, info));
Insns = insnStack.ToSList();
Stack = SList.Nil<IValue>();
}
}
示例3: Assign
private ISList<IInsn> Assign(IList<IValue> args, SourceInfo info)
{
Stack<IInsn> insnStack = new Stack<IInsn>();
IEnumerator<IValue> argsEtor = args.GetEnumerator();
foreach (ValueSymbol symbol in mParams)
{
if (!argsEtor.MoveNext())
{
throw new RheaException(
this.WrongNumberOfArguments(mParams.Count, args.Count), info
);
}
insnStack.Push(new InsnPush(argsEtor.Current));
insnStack.Push(new InsnDefVar(symbol, mInfo));
insnStack.Push(InsnPop.Instance);
}
if (argsEtor.MoveNext())
{
throw new RheaException(
this.WrongNumberOfArguments(mParams.Count, args.Count), info
);
}
return insnStack.ToSList();
}