本文整理汇总了C#中clojure.lang.CljCompiler.Ast.Expr类的典型用法代码示例。如果您正苦于以下问题:C# Expr类的具体用法?C# Expr怎么用?C# Expr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Expr类属于clojure.lang.CljCompiler.Ast命名空间,在下文中一共展示了Expr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: IfExpr
public IfExpr(int line, Expr testExpr, Expr thenExpr, Expr elseExpr)
{
_line = line;
_testExpr = testExpr;
_thenExpr = thenExpr;
_elseExpr = elseExpr;
}
开发者ID:jlomax,项目名称:clojure-clr,代码行数:7,代码来源:IfExpr.cs
示例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));
}
}
开发者ID:richhickey,项目名称:clojure-clr,代码行数:28,代码来源:CaseExpr.cs
示例3: IfExpr
public IfExpr( IPersistentMap sourceSpan, Expr testExpr, Expr thenExpr, Expr elseExpr)
{
_sourceSpan = sourceSpan;
_testExpr = testExpr;
_thenExpr = thenExpr;
_elseExpr = elseExpr;
}
开发者ID:JvJ,项目名称:clojure-clr,代码行数:7,代码来源:IfExpr.cs
示例4: DefExpr
public DefExpr(Var var, Expr init, Expr meta, bool initProvided)
{
_var = var;
_init = init;
_meta = meta;
_initProvided = initProvided;
}
开发者ID:jlomax,项目名称:clojure-clr,代码行数:7,代码来源:DefExpr.cs
示例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;
}
开发者ID:chrisortman,项目名称:clojure-clr,代码行数:13,代码来源:InstanceOfExpr.cs
示例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;
}
开发者ID:EricThorsen,项目名称:clojure-clr,代码行数:60,代码来源:InvokeExpr.cs
示例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);
}
开发者ID:jlomax,项目名称:clojure-clr,代码行数:8,代码来源:HostExpr.cs
示例8: InstanceMethodExpr
public InstanceMethodExpr(Expr target, string methodName, IPersistentVector args)
{
_target = target;
_methodName = methodName;
_args = args;
_method = GetMatchingMethod(target, _args, _methodName);
}
开发者ID:kmartin,项目名称:clojure-contrib,代码行数:8,代码来源:InstanceMethodExpr.cs
示例9: TryExpr
public TryExpr(Expr tryExpr, IPersistentVector catchExprs, Expr finallyExpr, int retLocal, int finallyLocal)
{
_tryExpr = tryExpr;
_catchExprs = catchExprs;
_finallyExpr = finallyExpr;
_retLocal = retLocal;
_finallyLocal = finallyLocal;
}
开发者ID:kmartin,项目名称:clojure-contrib,代码行数:8,代码来源:TryExpr.cs
示例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);
}
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:8,代码来源:VarExpr.cs
示例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);
}
开发者ID:starapor,项目名称:clojure-clr,代码行数:8,代码来源:InvokeExpr.cs
示例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);
}
开发者ID:richhickey,项目名称:clojure-clr,代码行数:9,代码来源:KeywordInvokeExpr.cs
示例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);
}
}
开发者ID:starapor,项目名称:clojure-clr,代码行数:10,代码来源:HostExpr.cs
示例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;
}
开发者ID:christianblunden,项目名称:clojure-clr,代码行数:10,代码来源:InstanceZeroArityCallExpr.cs
示例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);
}
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:10,代码来源:InstanceMethodExpr.cs
示例16: DefExpr
public DefExpr(string source, int line, Var var, Expr init, Expr meta, bool initProvided, bool isDyanamic)
{
_source = source;
_line = line;
_var = var;
_init = init;
_meta = meta;
_isDynamic = isDyanamic;
_initProvided = initProvided;
}
开发者ID:roffster,项目名称:clojure-clr,代码行数:10,代码来源:DefExpr.cs
示例17: LocalBinding
public LocalBinding(int index, Symbol sym, Symbol tag, Expr init)
{
if (Compiler.MaybePrimitiveType(init) != null && tag != null)
throw new InvalidOperationException("Can't type hint a local with a primitive initializer");
_index = index;
_sym = sym;
_tag = tag;
_init = init;
_name = Compiler.Munge(sym.Name);
}
开发者ID:starapor,项目名称:clojure-clr,代码行数:11,代码来源:LocalBinding.cs
示例18: DefExpr
public DefExpr(string source, int line, int column, Var var, Expr init, Expr meta, bool initProvided, bool isDyanamic, bool shadowsCoreMapping)
{
_source = source;
_line = line;
_column = column;
_var = var;
_init = init;
_meta = meta;
_isDynamic = isDyanamic;
_shadowsCoreMapping = shadowsCoreMapping;
_initProvided = initProvided;
}
开发者ID:telefunkenvf14,项目名称:clojure-clr,代码行数:12,代码来源:DefExpr.cs
示例19: InstanceZeroArityCallExpr
internal InstanceZeroArityCallExpr(string source, IPersistentMap spanMap, Symbol tag, Expr target, string memberName)
{
_source = source;
_spanMap = spanMap;
_memberName = memberName;
_target = target;
_tag = tag;
if ( RT.booleanCast(RT.WarnOnReflectionVar.deref()))
RT.errPrintWriter().WriteLine("Reflection warning, {0}:{1}:{2} - reference to field/property {3} can't be resolved.",
Compiler.SourcePathVar.deref(), Compiler.GetLineFromSpanMap(_spanMap), Compiler.GetColumnFromSpanMap(_spanMap), memberName);
}
开发者ID:jiangwh,项目名称:clojure-clr,代码行数:12,代码来源:InstanceZeroArityCallExpr.cs
示例20: InstanceFieldExpr
public InstanceFieldExpr(Expr target, string fieldName)
{
_target = target;
_fieldName = fieldName;
_targetType = target.HasClrType ? target.ClrType : null;
_fieldInfo = _targetType != null ? _targetType.GetField(_fieldName, BindingFlags.Instance | BindingFlags.Public) : null;
_propertyInfo = _targetType != null ? _targetType.GetProperty(_fieldName, BindingFlags.Instance | BindingFlags.Public) : null;
if ( _fieldInfo == null && _propertyInfo == null && RT.booleanCast(RT.WARN_ON_REFLECTION.deref()))
((TextWriter)RT.ERR.deref()).WriteLine("Reflection warning {0}:{1} - reference to field/property {2} can't be resolved.",
Compiler.SOURCE_PATH.deref(), /* line */ 0,_fieldName);
}
开发者ID:kmartin,项目名称:clojure-contrib,代码行数:13,代码来源:InstanceFieldExpr.cs
注:本文中的clojure.lang.CljCompiler.Ast.Expr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论