Пример #1
0
        public override MSAst.Expression Reduce()
        {
            if (Parent.IsGeneratorMethod)
            {
                // Reduce to a yield return with a marker of -2, this will be interpreted as a yield break with a return value
                return(GlobalParent.AddDebugInfo(AstUtils.YieldReturn(GeneratorLabel, TransformOrConstantNull(Expression, typeof(object)), -2), Span));
            }

            return(GlobalParent.AddDebugInfo(
                       Ast.Return(
                           FunctionDefinition._returnLabel,
                           TransformOrConstantNull(Expression, typeof(object))
                           ),
                       Span
                       ));
        }