本文整理汇总了C#中clojure.lang.CljCompiler.Ast.ObjExpr.GenVar方法的典型用法代码示例。如果您正苦于以下问题:C# ObjExpr.GenVar方法的具体用法?C# ObjExpr.GenVar怎么用?C# ObjExpr.GenVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clojure.lang.CljCompiler.Ast.ObjExpr
的用法示例。
在下文中一共展示了ObjExpr.GenVar方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
if (_isDynamic)
varExpr = Expression.Call(varExpr, Compiler.Method_Var_setDynamic0);
exprs.Add(Expression.Assign(parm, varExpr));
if (_meta != null)
{
if (_initProvided || true) //IncludesExplicitMetadata((MapExpr)_meta))
{
exprs.Add(Expression.Call(parm, Compiler.Method_Var_setMeta, Expression.Convert(_meta.GenCode(RHC.Expression, objx, context), typeof(IPersistentMap))));
}
}
if (_initProvided )
// RETYPE: get rid of Box?
// 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))));
exprs.Add(parm);
return Expression.Block(new ParameterExpression[] { parm }, exprs);
}
示例2: GenCode
public Expression GenCode(RHC rhc, ObjExpr objx, GenContext context)
{
return objx.GenVar(context,_var);
}
示例3: 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);
}
示例4: GenProtoLight
// TODO: remove duplicate code between GenProtoLight and GenProtoFull
private Expression GenProtoLight(RHC rhc, ObjExpr objx, GenContext context, Expression fn)
{
Var v = ((VarExpr)_fexpr).Var;
Expr e = (Expr)_args.nth(0);
ParameterExpression targetParam = Expression.Parameter(typeof(Object), "target");
ParameterExpression targetTypeParam = Expression.Parameter(typeof(Type), "targetType");
ParameterExpression vpfnParam = Expression.Parameter(typeof(AFunction), "vpfn");
ParameterExpression thisParam = objx.ThisParam;
Expression targetParamAssign = Expression.Assign(targetParam, Compiler.MaybeBox(e.GenCode(RHC.Expression,objx,context)));
Expression targetTypeParamAssign =
Expression.Assign(
targetTypeParam,
Expression.Call(null, Compiler.Method_Util_classOf, targetParam));
Expression vpfnParamAssign =
Expression.Assign(
vpfnParam,
Expression.Convert(Expression.Call(objx.GenVar(context, v), Compiler.Method_Var_getRawRoot), typeof(AFunction)));
if (_protocolOn == null)
{
return Expression.Block(
new ParameterExpression[] { targetParam, targetTypeParam, vpfnParam },
targetParamAssign,
targetTypeParamAssign,
vpfnParamAssign,
GenerateArgsAndCall(rhc, objx, context, vpfnParam, targetParam));
}
else
{
Expression[] args = new Expression[_args.count() - 1];
for (int i = 1; i < _args.count(); i++)
{
Expression bare = ((Expr)_args.nth(i)).GenCode(RHC.Expression,objx,context);
args[i - 1] = Compiler.MaybeBox(bare);
}
return Expression.Block(
new ParameterExpression[] { targetParam, targetTypeParam, vpfnParam },
targetParamAssign,
targetTypeParamAssign,
Expression.Condition(
Expression.Not(Expression.TypeIs(targetParam, _protocolOn)),
Expression.Block(
vpfnParamAssign,
GenerateArgsAndCall(rhc, objx, context, vpfnParam, targetParam)),
Compiler.MaybeBox(Expression.Call(Expression.Convert(targetParam, _protocolOn), _onMethod, args))));
}
}
示例5: GenCode
public Expression GenCode(RHC rhc, ObjExpr objx, GenContext context)
{
Expression varExpr = objx.GenVar(context,_var);
return Expression.Call(varExpr, Compiler.Method_Var_get);
}
示例6: GenAssign
public Expression GenAssign(RHC rhc, ObjExpr objx, GenContext context, Expr val)
{
Expression varExpr = objx.GenVar(context, _var);
Expression valExpr = val.GenCode(RHC.Expression,objx,context);
return Expression.Call(varExpr, Compiler.Method_Var_set, Compiler.MaybeBox(valExpr));
}