Exemple #1
0
        protected override IValue VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node)
        {
            var info = ModelExtensions.GetTypeInfo(state.Context.RoslynModel, node);
            var ct   = state.Context.Roslyn_ResolveType(info.ConvertedType);

            if (!ct.BaseType.IsMulticastDelegate())
            {
                throw new NotImplementedException();
            }
            var lv   = new LangVisitor(state);
            var pl   = lv.rVisit(node.ParameterList);
            var body = lv.Visit(node.Body);

            if (!(body is IStatement))
            {
                var iv = body as IValue;
                if (iv != null)
                {
                    body = new ReturnStatement(iv);
                }

                if (!(body is IStatement))
                {
                    throw new Exception("body is not IStatement");
                }
            }

            var h = new LambdaExpression(ct, pl, body as IStatement);

            return(Simplify(h));
            // throw new NotSupportedException();
        }
Exemple #2
0
        // Protected Methods 

        protected FunctionDeclarationParameter _VisitParameter(SyntaxNode node)
        {
            LangVisitor lv = new LangVisitor(state);

            return(lv.Visit(node) as FunctionDeclarationParameter);
        }