本文整理汇总了C#中RHC类的典型用法代码示例。如果您正苦于以下问题:C# RHC类的具体用法?C# RHC怎么用?C# RHC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RHC类属于命名空间,在下文中一共展示了RHC类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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);
}
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:7,代码来源:BooleanExpr.cs
示例2: 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);
}
开发者ID:christianblunden,项目名称:clojure-clr,代码行数:27,代码来源:LetFnExpr.cs
示例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));
}
开发者ID:christianblunden,项目名称:clojure-clr,代码行数:7,代码来源:ThrowExpr.cs
示例4: SetRhc
public ParserContext SetRhc(RHC rhc)
{
if (_rhc == rhc)
return this;
return new ParserContext(rhc, _isAssignContext);
}
开发者ID:TerabyteX,项目名称:clojure-clr,代码行数:7,代码来源:ParserContext.cs
示例5: 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);
}
开发者ID:chrisortman,项目名称:clojure-clr,代码行数:7,代码来源:InstanceOfExpr.cs
示例6: 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);
}
开发者ID:christianblunden,项目名称:clojure-clr,代码行数:30,代码来源:DefExpr.cs
示例7: 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);
}
开发者ID:robertlj,项目名称:clojure-clr,代码行数:29,代码来源:DefExpr.cs
示例8: 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);
}
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:8,代码来源:VarExpr.cs
示例9: 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);
}
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:9,代码来源:BodyExpr.cs
示例10: 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);
}
开发者ID:JvJ,项目名称:clojure-clr,代码行数:9,代码来源:ImportExpr.cs
示例11: 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);
}
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:10,代码来源:MetaExpr.cs
示例12: 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);
}
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:10,代码来源:BodyExpr.cs
示例13: 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;
}
开发者ID:christianblunden,项目名称:clojure-clr,代码行数:11,代码来源:MethodExpr.cs
示例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;
}
开发者ID:richhickey,项目名称:clojure-clr,代码行数:12,代码来源:MetaExpr.cs
示例15: 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;
}
开发者ID:christianblunden,项目名称:clojure-clr,代码行数:12,代码来源:MetaExpr.cs
示例16: 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);
}
}
开发者ID:mjmcaulay,项目名称:clojure-clr,代码行数:13,代码来源:ThrowExpr.cs
示例17: 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);
}
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:13,代码来源:NumberExpr.cs
示例18: GenCodeUnboxed
public Expression GenCodeUnboxed(RHC rhc, ObjExpr objx, GenContext context)
{
Type t = _n.GetType();
if (t == typeof(int))
return Expression.Constant((long)(int)_n, typeof(long));
else if (t == typeof(double))
return Expression.Constant((double)_n, typeof(double));
else if ( t == typeof(long) )
return Expression.Constant((long)_n,typeof(long));
throw new ArgumentException("Unsupported Number type: " + _n.GetType().Name);
}
开发者ID:richhickey,项目名称:clojure-clr,代码行数:13,代码来源:NumberExpr.cs
示例19: 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);
}
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:51,代码来源:DefExpr.cs
示例20: 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();
}
}
开发者ID:corvusalba,项目名称:clojure-clr,代码行数:49,代码来源:LetExpr.cs
注:本文中的RHC类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论