本文整理汇总了C#中clojure.lang.CljCompiler.Ast.ObjExpr类的典型用法代码示例。如果您正苦于以下问题:C# ObjExpr类的具体用法?C# ObjExpr怎么用?C# ObjExpr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjExpr类属于clojure.lang.CljCompiler.Ast命名空间,在下文中一共展示了ObjExpr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenCode
public Expression GenCode(RHC rhc, ObjExpr objx, GenContext context)
{
int n = _bindingInits.count();
List<ParameterExpression> parms = new List<ParameterExpression>(n);
List<Expression> forms = new List<Expression>(n);
/// First, set up the environment.
for (int i = 0; i < n; i++)
{
BindingInit bi = (BindingInit)_bindingInits.nth(i);
ParameterExpression parmExpr = Expression.Parameter(typeof(IFn), bi.Binding.Name);
bi.Binding.ParamExpression = parmExpr;
parms.Add(parmExpr);
}
// Then initialize
for (int i = 0; i < n; i++)
{
BindingInit bi = (BindingInit)_bindingInits.nth(i);
ParameterExpression parmExpr = (ParameterExpression)bi.Binding.ParamExpression;
forms.Add(Expression.Assign(parmExpr, bi.Init.GenCode(RHC.Expression,objx,context)));
}
// The work
forms.Add(_body.GenCode(rhc,objx,context));
return Expression.Block(parms,forms);
}
示例2: Emit
public override void Emit(RHC rhc, ObjExpr objx, CljILGen ilg)
{
ilg.EmitBoolean(_val);
ilg.Emit(OpCodes.Box,typeof(bool));
if (rhc == RHC.Statement)
ilg.Emit(OpCodes.Pop);
}
示例3: GenCode
public override Expression GenCode(RHC rhc, ObjExpr objx, GenContext context)
{
Expression exc = _excExpr.GenCode(RHC.Expression, objx, context);
Expression exc2 = Expression.Convert(exc, typeof(Exception));
return Expression.Throw(exc2,typeof(object));
}
示例4: Emit
public void Emit(RHC rhc, ObjExpr objx, CljILGen ilg)
{
EmitUnboxed(rhc, objx, ilg);
HostExpr.EmitBoxReturn(objx, ilg, typeof(bool));
if (rhc == RHC.Statement)
ilg.Emit(OpCodes.Pop);
}
示例5: GenCode
public Expression GenCode(RHC rhc, ObjExpr objx, GenContext context)
{
List<Expression> exprs = new List<Expression>();
ParameterExpression parm = Expression.Parameter(typeof(Var), "v");
Expression varExpr = objx.GenVar(context,_var);
exprs.Add(Expression.Assign(parm, varExpr));
// The Java code does the following in the opposite order (as modified in commit #430dd4f, Jan 19, 2010)
// However, the call to bindRoot sets :macro to False. I'm not sure how it works now in the JVM version.
if (_initProvided )
// Java doesn't Box here, but we have to deal with unboxed bool values
exprs.Add(Expression.Call(parm, Compiler.Method_Var_bindRoot, Compiler.MaybeBox(_init.GenCode(RHC.Expression,objx,context))));
if (_meta != null)
{
if (_initProvided || IncludesExplicitMetadata((MapExpr)_meta))
{
// Java casts to IPersistentMap on the _meta, but Expression.Call can handle that for us.
exprs.Add(Expression.Call(parm, Compiler.Method_Var_setMeta, _meta.GenCode(RHC.Expression,objx,context)));
}
}
exprs.Add(parm);
return Expression.Block(new ParameterExpression[] { parm }, exprs);
}
示例6: Emit
public void Emit(RHC rhc, ObjExpr objx, CljILGen ilg)
{
objx.EmitVar(ilg, _var);
if (_isDynamic)
{
ilg.Emit(OpCodes.Call, Compiler.Method_Var_setDynamic0);
}
if (_meta != null)
{
if (_initProvided || true) //IncludesExplicitMetadata((MapExpr)_meta))
{
ilg.Emit(OpCodes.Dup);
_meta.Emit(RHC.Expression, objx, ilg);
ilg.Emit(OpCodes.Castclass, typeof(IPersistentMap));
ilg.Emit(OpCodes.Call, Compiler.Method_Var_setMeta);
}
}
if (_initProvided)
{
ilg.Emit(OpCodes.Dup);
if (_init is FnExpr)
((FnExpr)_init).EmitForDefn(objx, ilg);
else
_init.Emit(RHC.Expression, objx, ilg);
ilg.Emit(OpCodes.Call,Compiler.Method_Var_bindRoot);
}
if (rhc == RHC.Statement)
ilg.Emit(OpCodes.Pop);
}
示例7: EmitAssign
public void EmitAssign(RHC rhc, ObjExpr objx, CljILGen ilg, Expr val)
{
objx.EmitVar(ilg, _var);
val.Emit(RHC.Expression, objx, ilg);
ilg.Emit(OpCodes.Call, Compiler.Method_Var_set);
if (rhc == RHC.Statement)
ilg.Emit(OpCodes.Pop);
}
示例8: Emit
public void Emit(RHC rhc, ObjExpr objx, CljILGen ilg)
{
for (int i = 0; i < _exprs.count() - 1; i++)
{
Expr e = (Expr)_exprs.nth(i);
e.Emit(RHC.Statement, objx, ilg);
}
LastExpr.Emit(rhc, objx, ilg);
}
示例9: Emit
public void Emit(RHC rhc, ObjExpr objx, CljILGen ilg)
{
ilg.Emit(OpCodes.Call,Compiler.Method_Compiler_CurrentNamespace.GetGetMethod());
ilg.Emit(OpCodes.Ldstr, _c);
ilg.Emit(OpCodes.Call, Compiler.Method_RT_classForName);
ilg.Emit(OpCodes.Call, Compiler.Method_Namespace_importClass1);
if (rhc == RHC.Statement)
ilg.Emit(OpCodes.Pop);
}
示例10: Emit
public void Emit(RHC rhc, ObjExpr objx, CljILGen ilg)
{
_expr.Emit(RHC.Expression, objx, ilg);
ilg.Emit(OpCodes.Castclass, typeof(IObj));
_meta.Emit(RHC.Expression, objx, ilg);
ilg.Emit(OpCodes.Castclass, typeof(IPersistentMap));
ilg.EmitCall(Compiler.Method_IObj_withMeta);
if (rhc == RHC.Statement)
ilg.Emit(OpCodes.Pop);
}
示例11: EmitUnboxed
public void EmitUnboxed(RHC rhc, ObjExpr objx, CljILGen ilg)
{
for (int i = 0; i < _exprs.count() - 1; i++)
{
Expr e = (Expr)_exprs.nth(i);
e.Emit(RHC.Statement, objx, ilg);
}
MaybePrimitiveExpr mbe = (MaybePrimitiveExpr)LastExpr;
mbe.EmitUnboxed(rhc, objx, ilg);
}
示例12: GenCode
public override Expression GenCode(RHC rhc, ObjExpr objx, GenContext context)
{
Expression call;
if (_method != null)
call = GenDlrForMethod(objx, context);
else
call = GenerateComplexCall(objx, context);
call = Compiler.MaybeAddDebugInfo(call, _spanMap, context.IsDebuggable);
return call;
}
示例13: GenCode
public Expression GenCode(RHC rhc, ObjExpr objx, GenContext context)
{
Expression objExpr = _expr.GenCode(RHC.Expression, objx, context);
Expression iobjExpr = Expression.Convert(objExpr, typeof(IObj));
Expression metaExpr = _meta.GenCode(RHC.Expression, objx, context);
// Do we need a conversion here? probably not.
Expression ret = Expression.Call(iobjExpr, Compiler.Method_IObj_withMeta, metaExpr);
return ret;
}
示例14: GenCode
public Expression GenCode(RHC rhc, ObjExpr objx, GenContext context)
{
Expression objExpr = _expr.GenCode(RHC.Expression, objx, context);
Expression iobjExpr = Expression.Convert(objExpr, typeof(IObj));
Expression metaExpr = _meta.GenCode(RHC.Expression, objx, context);
metaExpr = Expression.Convert(metaExpr, typeof(IPersistentMap));
Expression ret = Expression.Call(iobjExpr, Compiler.Method_IObj_withMeta, metaExpr);
return ret;
}
示例15: EmitUnboxed
public void EmitUnboxed(RHC rhc, ObjExpr objx, CljILGen ilg)
{
Type t = _n.GetType();
if (t == typeof(int))
ilg.EmitLong((long)(int)_n);
else if (t == typeof(double))
ilg.EmitDouble((double)_n);
else if (t == typeof(long))
ilg.EmitLong((long)_n);
else
throw new ArgumentException("Unsupported Number type: " + _n.GetType().Name);
}