Ejemplo n.º 1
0
        public CodeExpression VisitGeneratorExp(GeneratorExp g)
        {
            m.EnsureImport("System.Linq");
            var compFor = (CompFor)g.Collection;
            var v       = g.Projection.Accept(this);
            var c       = TranslateToLinq(v, compFor);

            return(c);
        }
Ejemplo n.º 2
0
        public CodeExpression VisitGeneratorExp(GeneratorExp g)
        {
            m.EnsureImport(TypeReferenceTranslator.LinqNamespace);
            var compFor = (CompFor)g.Collection;
            var v       = g.Projection.Accept(this);
            var c       = TranslateToLinq(v, compFor);

            return(c);
        }
Ejemplo n.º 3
0
            internal static expr Convert(Compiler.Ast.Expression expr, expr_context ctx) {
                expr ast;

                if (expr is ConstantExpression)
                    ast = Convert((ConstantExpression)expr);
                else if (expr is NameExpression)
                    ast = new Name((NameExpression)expr, ctx);
                else if (expr is UnaryExpression)
                    ast = new UnaryOp((UnaryExpression)expr);
                else if (expr is BinaryExpression)
                    ast = Convert((BinaryExpression)expr);
                else if (expr is AndExpression)
                    ast = new BoolOp((AndExpression)expr);
                else if (expr is OrExpression)
                    ast = new BoolOp((OrExpression)expr);
                else if (expr is CallExpression)
                    ast = new Call((CallExpression)expr);
                else if (expr is ParenthesisExpression)
                    return Convert(((ParenthesisExpression)expr).Expression);
                else if (expr is LambdaExpression)
                    ast = new Lambda((LambdaExpression)expr);
                else if (expr is ListExpression)
                    ast = new List((ListExpression)expr, ctx);
                else if (expr is TupleExpression)
                    ast = new Tuple((TupleExpression)expr, ctx);
                else if (expr is DictionaryExpression)
                    ast = new Dict((DictionaryExpression)expr);
                else if (expr is ListComprehension)
                    ast = new ListComp((ListComprehension)expr);
                else if (expr is GeneratorExpression)
                    ast = new GeneratorExp((GeneratorExpression)expr);
                else if (expr is MemberExpression)
                    ast = new Attribute((MemberExpression)expr, ctx);
                else if (expr is YieldExpression)
                    ast = new Yield((YieldExpression)expr);
                else if (expr is ConditionalExpression)
                    ast = new IfExp((ConditionalExpression)expr);
                else if (expr is IndexExpression)
                    ast = new Subscript((IndexExpression)expr, ctx);
                else if (expr is SliceExpression)
                    ast = new Slice((SliceExpression)expr);
                else if (expr is BackQuoteExpression)
                    ast = new Repr((BackQuoteExpression)expr);
                else
                    throw new ArgumentTypeException("Unexpected expression type: " + expr.GetType());

                ast.GetSourceLocation(expr);
                return ast;
            }
Ejemplo n.º 4
0
 public void VisitGeneratorExp(GeneratorExp exp)
 {
     throw new NotImplementedException();
 }