当前位置: 首页>>代码示例>>C#>>正文


C# Stack.ToSList方法代码示例

本文整理汇总了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);
 }
开发者ID:takuto-h,项目名称:rhea,代码行数:15,代码来源:Primitive.cs

示例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>();
     }
 }
开发者ID:takuto-h,项目名称:rhea,代码行数:40,代码来源:VM.cs

示例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();
 }
开发者ID:takuto-h,项目名称:rhea,代码行数:24,代码来源:ValueClosure.cs


注:本文中的Stack.ToSList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。