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


C# AstGenerator.TransformStatementsToExpression方法代码示例

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


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

示例1: TransformRead

 internal override MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen) {
     return AstFactory.Condition(
         Methods.IsFalse.OpCall(AstFactory.Box(_condition.TransformRead(gen))),
         gen.TransformStatementsToExpression(_statements),
         gen.TransformStatementsToExpression(_elseClause != null ? _elseClause.Statements : null)
     );
 }
开发者ID:aslakhellesoy,项目名称:ironruby,代码行数:7,代码来源:UnlessExpression.cs

示例2: TransformRead

        internal override MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen) {

            MSA.Expression result;

            int i = _elseIfClauses.Count - 1;

            if (i >= 0 && _elseIfClauses[i].Condition == null) {
                // ... else body end
                result = gen.TransformStatementsToExpression(_elseIfClauses[i].Statements);
                i--;
            } else {
                // no else clause => the result of the if-expression is nil:
                result = AstUtils.Constant(null);
            }

            while (i >= 0) {
                // emit: else (if (condition) body else result)
                result = AstFactory.Condition(
                    _elseIfClauses[i].Condition.TransformCondition(gen, true),
                    gen.TransformStatementsToExpression(_elseIfClauses[i].Statements),
                    result
                );
                i--;
            }

            // if (condition) body else result
            return AstFactory.Condition(
                _condition.TransformCondition(gen, true),
                gen.TransformStatementsToExpression(_body),
                result
            );
        }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:32,代码来源:IfExpression.cs

示例3: TransformRead

 internal override MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen) {
     return AstFactory.Condition(
         _condition.TransformCondition(gen, false),            
         gen.TransformStatementsToExpression(_statements),
         gen.TransformStatementsToExpression(_elseClause != null ? _elseClause.Statements : null)
     );
 }
开发者ID:jschementi,项目名称:iron,代码行数:7,代码来源:UnlessExpression.cs

示例4: TransformRead

        internal override MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen) {
            Assert.NotNull(gen);

            if (HasExceptionHandling) {
                MSA.Expression resultVariable = gen.CurrentScope.DefineHiddenVariable("#block-result", typeof(object));

                return AstFactory.Block(
                    TransformExceptionHandling(gen, ResultOperation.Store(resultVariable)),
                    resultVariable
                );

            } else {
                return gen.TransformStatementsToExpression(_statements);
            }
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:15,代码来源:Body.cs

示例5: TransformRead

 internal override MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen) {
     return gen.TransformStatementsToExpression(_statements);
 }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:3,代码来源:BlockExpression.cs

示例6: TransformRead

        internal override MSA.Expression/*!*/ TransformRead(AstGenerator/*!*/ gen) {
            MSA.Expression result;
            if (_elseStatements != null) {
                // ... else body end
                result = gen.TransformStatementsToExpression(_elseStatements);
            } else {
                // no else clause => the result of the if-expression is nil:
                result = Ast.Constant(null);
            }

            MSA.Expression value;
            if (_value != null) {
                value = gen.CurrentScope.DefineHiddenVariable("#case-compare-value", typeof(object));
            } else {
                value = null;
            }
            
            for (int i = _whenClauses.Count - 1; i >= 0; i-- ) {
                // emit: else (if (condition) body else result)
                result = AstFactory.Condition(
                    TransformWhenCondition(gen, _whenClauses[i].Comparisons, _whenClauses[i].ComparisonArray, value),
                    gen.TransformStatementsToExpression(_whenClauses[i].Statements),
                    result
                );
            }

            if (_value != null) {
                result = AstFactory.Block(
                    Ast.Assign(value, Ast.Convert(_value.TransformRead(gen), typeof(object))),
                    result
                );
            }

            return result;
        }
开发者ID:joshholmes,项目名称:ironruby,代码行数:35,代码来源:CaseExpression.cs


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