本文整理汇总了C#中clojure.lang.CljCompiler.Ast.Expr类的典型用法代码示例。如果您正苦于以下问题:C# Expr类的具体用法?C# Expr怎么用?C# Expr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Expr类属于clojure.lang.CljCompiler.Ast命名空间,在下文中一共展示了Expr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IfExpr
public IfExpr(int line, Expr testExpr, Expr thenExpr, Expr elseExpr)
{
_line = line;
_testExpr = testExpr;
_thenExpr = thenExpr;
_elseExpr = elseExpr;
}
示例2: CaseExpr
public CaseExpr( IPersistentMap sourceSpan, LocalBindingExpr expr, int shift, int mask, int low, int high, Expr defaultExpr,
SortedDictionary<int, Expr> tests, Dictionary<int, Expr> thens, Keyword switchType, Keyword testType, IPersistentSet skipCheck)
{
_sourceSpan = sourceSpan;
_expr = expr;
_shift = shift;
_mask = mask;
//_low = low;
//_high = high;
_defaultExpr = defaultExpr;
_tests = tests;
_thens = thens;
if (switchType != _compactKey && switchType != _sparseKey)
throw new ArgumentException("Unexpected switch type: " + switchType);
//_switchType = switchType;
if (testType != _intKey && testType != _hashEquivKey && testType != _hashIdentityKey)
throw new ArgumentException("Unexpected test type: " + testType);
_testType = testType;
_skipCheck = skipCheck;
ICollection<Expr> returns = new List<Expr>(thens.Values);
returns.Add(defaultExpr);
_returnType = Compiler.MaybeClrType(returns);
if (RT.count(skipCheck) > 0 && RT.booleanCast(RT.WarnOnReflectionVar.deref()))
{
RT.errPrintWriter().WriteLine("Performance warning, {0}:{1} - hash collision of some case test constants; if selected, those entries will be tested sequentially.",
Compiler.SourcePathVar.deref(),RT.get(sourceSpan,RT.StartLineKey));
}
}
示例3: IfExpr
public IfExpr( IPersistentMap sourceSpan, Expr testExpr, Expr thenExpr, Expr elseExpr)
{
_sourceSpan = sourceSpan;
_testExpr = testExpr;
_thenExpr = thenExpr;
_elseExpr = elseExpr;
}
示例4: DefExpr
public DefExpr(Var var, Expr init, Expr meta, bool initProvided)
{
_var = var;
_init = init;
_meta = meta;
_initProvided = initProvided;
}
示例5: InstanceOfExpr
#pragma warning restore 414
#endregion
#region C-tors
public InstanceOfExpr(string source, IPersistentMap spanMap, Type t, Expr expr)
{
_source = source;
_spanMap = spanMap;
_t = t;
_expr = expr;
}
示例6: InvokeExpr
public InvokeExpr(string source, IPersistentMap spanMap, Symbol tag, Expr fexpr, IPersistentVector args)
{
_source = source;
_spanMap = spanMap;
_fexpr = fexpr;
_args = args;
VarExpr varFexpr = fexpr as VarExpr;
if (varFexpr != null)
{
Var fvar = varFexpr.Var;
Var pvar = (Var)RT.get(fvar.meta(), Compiler.ProtocolKeyword);
if (pvar != null && Compiler.ProtocolCallsitesVar.isBound)
{
_isProtocol = true;
_siteIndex = Compiler.RegisterProtocolCallsite(fvar);
Object pon = RT.get(pvar.get(), _onKey);
_protocolOn = HostExpr.MaybeType(pon, false);
if (_protocolOn != null)
{
IPersistentMap mmap = (IPersistentMap)RT.get(pvar.get(), _methodMapKey);
Keyword mmapVal = (Keyword)mmap.valAt(Keyword.intern(fvar.sym));
if (mmapVal == null)
{
throw new ArgumentException(String.Format("No method of interface: {0} found for function: {1} of protocol: {2} (The protocol method may have been defined before and removed.)",
_protocolOn.FullName, fvar.Symbol, pvar.Symbol));
}
String mname = Compiler.munge(mmapVal.Symbol.ToString());
IList<MethodBase> methods = Reflector.GetMethods(_protocolOn, mname, null, args.count() - 1, false);
if (methods.Count != 1)
throw new ArgumentException(String.Format("No single method: {0} of interface: {1} found for function: {2} of protocol: {3}",
mname, _protocolOn.FullName, fvar.Symbol, pvar.Symbol));
_onMethod = (MethodInfo) methods[0];
}
}
}
if (tag != null)
_tag = tag;
else if (varFexpr != null)
{
object arglists = RT.get(RT.meta(varFexpr.Var), Compiler.ArglistsKeyword);
object sigTag = null;
for (ISeq s = RT.seq(arglists); s != null; s = s.next())
{
APersistentVector sig = (APersistentVector)s.first();
int restOffset = sig.IndexOf(Compiler.AmpersandSym);
if (args.count() == sig.count() || (restOffset > -1 && args.count() >= restOffset))
{
sigTag = Compiler.TagOf(sig);
break;
}
}
_tag = sigTag ?? varFexpr.Tag;
}
else
_tag = null;
}
示例7: GenTypedArg
internal static Expression GenTypedArg(GenContext context, Type type, Expr arg)
{
if (Compiler.MaybePrimitiveType(arg) == type)
return ((MaybePrimitiveExpr)arg).GenDlrUnboxed(context);
else
// Java has emitUnboxArg -- should we do something similar?
return arg.GenDlr(context);
}
示例8: InstanceMethodExpr
public InstanceMethodExpr(Expr target, string methodName, IPersistentVector args)
{
_target = target;
_methodName = methodName;
_args = args;
_method = GetMatchingMethod(target, _args, _methodName);
}
示例9: TryExpr
public TryExpr(Expr tryExpr, IPersistentVector catchExprs, Expr finallyExpr, int retLocal, int finallyLocal)
{
_tryExpr = tryExpr;
_catchExprs = catchExprs;
_finallyExpr = finallyExpr;
_retLocal = retLocal;
_finallyLocal = finallyLocal;
}
示例10: 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);
}
示例11: InvokeExpr
public InvokeExpr(string source, int line, Symbol tag, Expr fexpr, IPersistentVector args)
{
_source = source;
_line = line;
_fexpr = fexpr;
_args = args;
_tag = tag ?? (fexpr is VarExpr ? ((VarExpr)fexpr).Tag : null);
}
示例12: KeywordInvokeExpr
public KeywordInvokeExpr(string source, IPersistentMap spanMap, Symbol tag, KeywordExpr kw, Expr target)
{
_source = source;
_spanMap = spanMap;
_kw = kw;
_target = target;
_tag = tag;
_siteIndex = Compiler.RegisterKeywordCallsite(kw.Kw);
}
示例13: GenTypedArg
internal static Expression GenTypedArg(GenContext context, Type type, Expr arg)
{
if (Compiler.MaybePrimitiveType(arg) == type)
return ((MaybePrimitiveExpr)arg).GenDlrUnboxed(context);
else
{
Expression argExpr = arg.GenDlr(context);
return GenMaybeUnboxedArg(type, argExpr);
}
}
示例14: InstanceZeroArityCallExpr
internal InstanceZeroArityCallExpr(string source, IPersistentMap spanMap, Symbol tag, Expr target, string memberName)
{
_source = source;
_spanMap = spanMap;
_memberName = memberName;
_target = target;
_tag = tag;
_targetType = target.HasClrType ? target.ClrType : null;
}
示例15: InstanceMethodExpr
public InstanceMethodExpr(string source, IPersistentMap spanMap, Symbol tag, Expr target, string methodName, List<Type> typeArgs, List<HostArg> args)
: base(source,spanMap,tag,methodName,typeArgs,args)
{
_target = target;
if (target.HasClrType && target.ClrType == null)
throw new ArgumentException(String.Format("Attempt to call instance method {0} on nil", methodName));
_method = Reflector.GetMatchingMethod(spanMap, target, _args, _methodName, _typeArgs);
}