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


C# Scope.Leave方法代码示例

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


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

示例1: Apply

        public bool Apply(Scope scope, TextWriter output, out Value result)
        {
            bool    halt;

            foreach (Branch branch in this.branches)
            {
                if (branch.Test.Evaluate (scope, output).AsBoolean)
                {
                    scope.Enter ();

                    halt = branch.Body.Apply (scope, output, out result);

                    scope.Leave ();

                    return halt;
                }
            }

            if (this.fallback != null)
            {
                scope.Enter ();

                halt = this.fallback.Apply (scope, output, out result);

                scope.Leave ();

                return halt;
            }

            result = UndefinedValue.Instance;

            return false;
        }
开发者ID:WMeszar,项目名称:Cottle,代码行数:33,代码来源:IfNode.cs

示例2: Apply

        public bool Apply(Scope scope, TextWriter output, out Value result)
        {
            KeyValuePair<Value, Value>[]    fields = this.from.Evaluate (scope, output).Fields;

            if (fields.Length > 0)
            {
                foreach (KeyValuePair<Value, Value> pair in fields)
                {
                    scope.Enter ();

                    if (this.key != null)
                        this.key.Set (scope, pair.Key, ScopeMode.Local);

                    if (this.value != null)
                        this.value.Set (scope, pair.Value, ScopeMode.Local);

                    if (this.body.Apply (scope, output, out result))
                    {
                        scope.Leave ();

                        return true;
                    }

                    scope.Leave ();
                }
            }
            else if (this.empty != null)
            {
                scope.Enter ();

                if (this.empty.Apply (scope, output, out result))
                {
                    scope.Leave ();

                    return true;
                }

                scope.Leave ();
            }

            result = UndefinedValue.Instance;

            return false;
        }
开发者ID:WMeszar,项目名称:Cottle,代码行数:44,代码来源:ForNode.cs

示例3: Apply

        public bool Apply(Scope scope, TextWriter output, out Value result)
        {
            while (this.test.Evaluate (scope, output).AsBoolean)
            {
                scope.Enter ();

                if (this.body.Apply (scope, output, out result))
                {
                    scope.Leave ();

                    return true;
                }

                scope.Leave ();
            }

            result = UndefinedValue.Instance;

            return false;
        }
开发者ID:WMeszar,项目名称:Cottle,代码行数:20,代码来源:WhileNode.cs

示例4: Execute

        public Value Execute(IList<Value> values, Scope scope, TextWriter output)
        {
            Value   result;
            int     i = 0;

            scope.Enter ();

            foreach (NameExpression argument in this.arguments)
            {
                argument.Set (scope, i < values.Count ? values[i] : UndefinedValue.Instance, ScopeMode.Local);

                ++i;
            }

            this.body.Apply (scope, output, out result);

            scope.Leave ();

            return result;
        }
开发者ID:WMeszar,项目名称:Cottle,代码行数:20,代码来源:NodeFunction.cs


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