本文整理汇总了C#中clojure.lang.CljCompiler.Ast.CljILGen类的典型用法代码示例。如果您正苦于以下问题:C# CljILGen类的具体用法?C# CljILGen怎么用?C# CljILGen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CljILGen类属于clojure.lang.CljCompiler.Ast命名空间,在下文中一共展示了CljILGen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例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: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
示例9: Emit
public override void Emit(RHC rhc, ObjExpr objx, CljILGen ilg)
{
if (_excExpr == null)
{
ilg.Emit(OpCodes.Rethrow);
}
else
{
_excExpr.Emit(RHC.Expression, objx, ilg);
ilg.Emit(OpCodes.Castclass, typeof(Exception));
ilg.Emit(OpCodes.Throw);
}
}
示例10: 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);
}
示例11: Emit
public void Emit(RHC rhc, ObjExpr objx, CljILGen ilg)
{
objx.EmitVar(ilg, _var);
if ( _shadowsCoreMapping )
{
LocalBuilder locNs = ilg.DeclareLocal(typeof(Namespace));
GenContext.SetLocalName(locNs, "ns");
ilg.Emit(OpCodes.Dup);
ilg.EmitFieldGet(VarNsFI);
ilg.Emit(OpCodes.Stloc,locNs);
LocalBuilder locSym = ilg.DeclareLocal(typeof(Symbol));
GenContext.SetLocalName(locSym, "sym");
ilg.Emit(OpCodes.Dup);
ilg.EmitFieldGet(VarSymFI);
ilg.Emit(OpCodes.Stloc, locSym);
ilg.Emit(OpCodes.Ldloc, locNs);
ilg.Emit(OpCodes.Ldloc, locSym);
ilg.Emit(OpCodes.Call, NamespaceReferMI);
}
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);
}
示例12: DoEmit
void DoEmit(RHC rhc, ObjExpr objx, CljILGen ilg, bool emitUnboxed)
{
List<LocalBuilder> locals = new List<LocalBuilder>();
for (int i = 0; i < _bindingInits.count(); i++)
{
BindingInit bi = (BindingInit)_bindingInits.nth(i);
Type primType = Compiler.MaybePrimitiveType(bi.Init);
if (primType != null)
{
LocalBuilder local = ilg.DeclareLocal(primType);
locals.Add(local);
GenContext.SetLocalName(local, bi.Binding.Name);
bi.Binding.LocalVar = local;
((MaybePrimitiveExpr)bi.Init).EmitUnboxed(RHC.Expression, objx, ilg);
ilg.Emit(OpCodes.Stloc, local);
}
else
{
LocalBuilder local = ilg.DeclareLocal(typeof(Object));
locals.Add(local);
GenContext.SetLocalName(local, bi.Binding.Name);
bi.Binding.LocalVar = local;
bi.Init.Emit(RHC.Expression, objx, ilg);
ilg.Emit(OpCodes.Stloc, local);
}
}
Label loopLabel = ilg.DefineLabel();
ilg.MarkLabel(loopLabel);
try
{
if (_isLoop)
Var.pushThreadBindings(PersistentHashMap.create(Compiler.LoopLabelVar, loopLabel));
if (emitUnboxed)
((MaybePrimitiveExpr)_body).EmitUnboxed(rhc, objx, ilg);
else
_body.Emit(rhc, objx, ilg);
}
finally
{
if (_isLoop)
Var.popThreadBindings();
}
}
示例13: Emit
//static readonly FieldInfo VectorEmptyFI = typeof(PersistentVector).GetField("EMPTY");
public void Emit(RHC rhc, ObjExpr objx, CljILGen ilg)
{
if (_coll is IPersistentList || _coll is LazySeq) // JVM does not include LazySeq test. I'm getting it in some places. LazySeq of 0 size got us here, we'll treat as an empty list
ilg.EmitFieldGet(ListEmptyFI);
else if (_coll is IPersistentVector)
ilg.EmitFieldGet(TupleEmptyFI);
else if (_coll is IPersistentMap)
ilg.EmitFieldGet(HashMapEmptyFI);
else if (_coll is IPersistentSet)
ilg.EmitFieldGet(HashSetEmptyFI);
else
throw new InvalidOperationException("Unknown collection type.");
if (rhc == RHC.Statement)
ilg.Emit(OpCodes.Pop);
}
示例14: Emit
public void Emit(RHC rhc, ObjExpr objx, CljILGen ilg)
{
if (_coll is IPersistentList)
ilg.EmitFieldGet(ListEmptyFI);
else if (_coll is IPersistentVector)
ilg.EmitFieldGet(VectorEmptyFI);
else if (_coll is IPersistentMap)
ilg.EmitFieldGet(HashMapEmptyFI);
else if (_coll is IPersistentSet)
ilg.EmitFieldGet(HashSetEmptyFI);
else
throw new InvalidOperationException("Unknown collection type.");
if (rhc == RHC.Statement)
ilg.Emit(OpCodes.Pop);
}
示例15: EmitUnboxed
public void EmitUnboxed(RHC rhc, ObjExpr objx, CljILGen ilg)
{
_expr.Emit(RHC.Expression, objx, ilg);
// This corresponds to the most general case code in System.Linq.Expressions.Compiler.LambdaCompiler
Type opType = _expr.HasClrType && _expr.ClrType != null ? _expr.ClrType : typeof(object);
if (opType.IsValueType)
{
ilg.Emit(OpCodes.Box, opType);
}
ilg.Emit(OpCodes.Isinst, _t);
ilg.Emit(OpCodes.Ldnull);
ilg.Emit(OpCodes.Cgt_Un);
}