clojure.lang.CljCompiler.Ast.LocalBindingExpr.GenCode C# (CSharp) Method

GenCode() public method

public GenCode ( RHC rhc, ObjExpr objx, GenContext context ) : Expression
rhc RHC
objx ObjExpr
context GenContext
return Expression
        public Expression GenCode(RHC rhc, ObjExpr objx, GenContext context)
        {
            return objx.GenLocal(context,_b);
        }

Usage Example

Example #1
0
        private Expression GenTestExprForInts(ObjExpr objx, GenContext context, Type exprType, LabelTarget defaultLabel)
        {
            if (exprType == null)
            {
                if (RT.booleanCast(RT.WarnOnReflectionVar.deref()))
                {
                    RT.errPrintWriter().WriteLine("Performance warning, {0}:{1} - case has int tests, but tested expression is not primitive.",
                                                  Compiler.SourcePathVar.deref(), RT.get(_sourceSpan, RT.StartLineKey));
                }

                ParameterExpression parm     = Expression.Parameter(typeof(object), "p");
                Expression          initParm = Expression.Assign(parm, _expr.GenCode(RHC.Expression, objx, context));
                Expression          testType = Expression.Call(null, Compiler.Method_Util_IsNonCharNumeric, parm); // matching JVM's handling of char as non-integer
                Expression          expr     = GenShiftMask(Expression.Call(null, Compiler.Method_Util_ConvertToInt, parm));
                return(Expression.Block(
                           new ParameterExpression[] { parm },
                           initParm,
                           Expression.IfThen(Expression.Not(testType), Expression.Goto(defaultLabel)),
                           expr));
            }
            else if (exprType == typeof(long) || exprType == typeof(int) || exprType == typeof(short) || exprType == typeof(byte) || exprType == typeof(ulong) || exprType == typeof(uint) || exprType == typeof(ushort) || exprType == typeof(sbyte))
            {
                Expression expr = Expression.Convert(_expr.GenCodeUnboxed(RHC.Expression, objx, context), typeof(int));
                return(GenShiftMask(expr));
            }
            else
            {
                return(Expression.Goto(defaultLabel));
            }
        }