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


C# Action.ClearResult方法代码示例

本文整理汇总了C#中System.Action.ClearResult方法的典型用法代码示例。如果您正苦于以下问题:C# Action.ClearResult方法的具体用法?C# Action.ClearResult怎么用?C# Action.ClearResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Action的用法示例。


在下文中一共展示了Action.ClearResult方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Act


//.........这里部分代码省略.........
                            call.next);
                        goto NextCall;
                    }

                    // Continue assignment.  We've just evaluated the
                    // value, so assign it to the curried name.

                    case Actor.ExecuteSetQ:
                    {
                        call.env.Set((Symbol)call.arg, call.Result);

                        call.target = Actor.Continue;
                        call.arg = new Unspecified();
                        goto NextCall;
                    }

                    // Similarly, continue definition by binding the
                    // result expression to the curried name.

                    case Actor.ExecuteDefine:
                    {

                        call.env.Bind((Symbol)call.arg, call.Result);

                        call.target = Actor.Continue;
                        call.arg = new Unspecified();
                        goto NextCall;
                    }

                    // Evaluate multiple expressions in order, discarding
                    // all but the last result.

                    case Actor.EvalSequence:
                    {
                        if (null == call.arg)
                        {
                            call.target = Actor.Continue;
                            call.arg = new Pair(new Unspecified(), null);
                        }

                        Pair exps = (Pair)call.arg;
                        Environment env = call.env;

                        if (null == exps.cdr)
                        {
                            call.target = Actor.Eval;
                            call.arg = exps.car;
                            call.env = env;
                            goto NextCall;
                        }
                        else
                        {
                            call.target = Actor.Eval;
                            call.arg = exps.car;
                            call.env = env;
                            call.next = new Action(
                                Actor.EvalSequence,
                                exps.cdr,
                                env,
                                call.next);
                            goto NextCall;
                        }
                    }
                }

            NextCall:
                // Ahh, the fabled land of NextCall, whither go all actors
                // when their part is played out.  Here we process the
                // Continue actor by shuffling arg and result.  We cdr down
                // the action chain and then finish the body of the while,
                // returning back to the very top of Evaluator.Act to begin
                // the cycle again.

                if (call.target != Actor.Continue)
                {
                    call.ClearResult();
                }

                if (call.target == Actor.Continue &&
                    call.next != null)
                {
                    Shell.Trace("Continuing with result ", call.arg);
                    call.next.Result = call.arg;
                    call = call.next;
                }
            }

            // Well, we've managed to exit the great cosmic while loop.
            // Ths means that we hit an Actor.Continue token which didn't
            // have a next; in other words, the last actor told us to
            // continue but there's nothing to continue doing.  This means
            // we've finally finished performing the act that we were
            // originally called for, "called" in (for once!) the prosaic
            // C# sense.  And so... we return!  Actually, honest-to-gosh
            // return, pop the CLR stack, bid a fond farewell to CPS-land.
            // Sayonara!

            Shell.Trace("Returning...");
            return call.arg;
        }
开发者ID:jleen,项目名称:sharpf,代码行数:101,代码来源:eval.cs


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