clojure.lang.CljCompiler.Ast.VectorExpr.Parse C# (CSharp) Method

Parse() public static method

public static Parse ( ParserContext pcon, IPersistentVector form ) : clojure.lang.CljCompiler.Ast.Expr
pcon ParserContext
form IPersistentVector
return clojure.lang.CljCompiler.Ast.Expr
        public static Expr Parse(ParserContext pcon, IPersistentVector form)
        {
            ParserContext pconToUse = pcon.EvalOrExpr();
            bool constant = true;

            IPersistentVector args = PersistentVector.EMPTY;
            for (int i = 0; i < form.count(); i++ )
            {
                Expr v = Compiler.Analyze(pconToUse, form.nth(i));
                args = (IPersistentVector)args.cons(v);
                if ( !(v is LiteralExpr) )
                    constant = false;
            }

            Expr ret = new VectorExpr(args);
            IObj iobjForm = form as IObj;
            if (iobjForm != null && iobjForm.meta() != null)
                return Compiler.OptionallyGenerateMetaInit(pcon,form, ret);
            else if ( constant )
            {
                IPersistentVector rv = PersistentVector.EMPTY;
                for ( int i=0; i<args.count(); i++ )
                {
                    LiteralExpr ve = (LiteralExpr)args.nth(i);
                    rv = (IPersistentVector)rv.cons(ve.Val);
                }
                return new ConstantExpr(rv);
            }
            else
                return ret;
        }