本文整理汇总了C#中Microsoft.Scripting.Actions.ActionBinder类的典型用法代码示例。如果您正苦于以下问题:C# ActionBinder类的具体用法?C# ActionBinder怎么用?C# ActionBinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionBinder类属于Microsoft.Scripting.Actions命名空间,在下文中一共展示了ActionBinder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetBoundValue
protected override DynamicMetaObject SetBoundValue(OverloadResolverFactory factory, ActionBinder binder, Type type, DynamicMetaObject value, DynamicMetaObject instance, DynamicMetaObject errorSuggestion) {
return new DynamicMetaObject(
Expression.Condition(
Ast.Call(
typeof(PythonOps).GetMethod("SlotTrySetValue"),
((PythonOverloadResolverFactory)factory)._codeContext,
AstUtils.Constant(GetSlot(), typeof(PythonTypeSlot)),
AstUtils.Convert(
instance.Expression,
typeof(object)
),
AstUtils.Constant(DynamicHelpers.GetPythonTypeFromType(type)),
value.Expression
),
AstUtils.Convert(value.Expression, typeof(object)),
errorSuggestion != null ?
errorSuggestion.Expression :
Expression.Throw(
Expression.Call(
typeof(PythonOps).GetMethod("AttributeErrorForMissingAttribute", new Type[] { typeof(object), typeof(string) }),
instance.Expression,
Expression.Constant(Name)
),
typeof(object)
)
),
BindingRestrictions.Empty
);
}
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:29,代码来源:CustomAttributeTracker.cs
示例2: ParameterWrapper
public ParameterWrapper(ActionBinder binder, ParameterInfo info)
: this(binder, info.ParameterType)
{
_name = SymbolTable.StringToId(info.Name ?? "<unknown>");
_isParams = info.IsDefined(typeof(ParamArrayAttribute), false);
}
开发者ID:robertlj,项目名称:IronScheme,代码行数:7,代码来源:ParameterWrapper.cs
示例3: ToyEngine
public ToyEngine(LanguageProvider provider, EngineOptions engineOptions) : base(provider, engineOptions) {
IronPython.Runtime.Operations.Ops.Bool2Object(true); //awful initialization hack
IronPython.Runtime.Operations.Ops.RegisterAssembly(typeof(ToyEngine).Assembly);
_defaultContext = new ToyContext(this);
_defaultBinder = new DefaultActionBinder(new CodeContext(null, _defaultContext));
}
开发者ID:xxjeng,项目名称:nuxleus,代码行数:8,代码来源:ToyEngine.cs
示例4: MakeErrorForRule
/// <summary>
/// Internal helper to produce the actual expression used for the error when emitting
/// the error into a rule.
/// </summary>
public Statement MakeErrorForRule(StandardRule rule, ActionBinder binder) {
if (_value != null) {
rule.IsError = true;
return rule.MakeReturn(binder, _value);
}
return rule.MakeError(_exception);
}
开发者ID:JamesTryand,项目名称:IronScheme,代码行数:12,代码来源:ErrorInfo.cs
示例5: DefaultOverloadResolver
public DefaultOverloadResolver(ActionBinder binder, IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType)
: base(binder) {
ContractUtils.RequiresNotNullItems(args, "args");
Debug.Assert((callType == CallTypes.ImplicitInstance ? 1 : 0) + signature.ArgumentCount == args.Count);
_args = args;
_signature = signature;
_callType = callType;
}
开发者ID:jschementi,项目名称:iron,代码行数:9,代码来源:DefaultOverloadResolver.cs
示例6: GetBoundPythonValue
public Expression GetBoundPythonValue(RuleBuilder builder, ActionBinder binder, PythonType accessing) {
return Ast.Call(
typeof(PythonOps).GetMethod("SlotGetValue"),
builder.Context,
Ast.Constant(GetSlot(), typeof(PythonTypeSlot)),
Ast.Constant(null),
Ast.Constant(accessing)
);
}
开发者ID:octavioh,项目名称:ironruby,代码行数:9,代码来源:CustomAttributeTracker.cs
示例7: RubyParameterBinder
public RubyParameterBinder(ActionBinder/*!*/ binder, Expression/*!*/ scopeOrContextExpression, bool isScope)
: base(binder) {
Assert.NotNull(binder, scopeOrContextExpression);
if (isScope) {
_scopeExpression = AstUtils.Convert(scopeOrContextExpression, typeof(RubyScope));
} else {
_contextExpression = AstUtils.Convert(scopeOrContextExpression, typeof(RubyContext));
}
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:10,代码来源:RubyParameterBinder.cs
示例8: GetBoundValue
protected override Expression GetBoundValue(Expression context, ActionBinder binder, Type type, Expression instance) {
return Ast.Call(
typeof(PythonOps).GetMethod("SlotGetValue"),
context,
Ast.Constant(GetSlot(), typeof(PythonTypeSlot)),
AstUtils.Convert(
instance,
typeof(object)
),
Ast.Constant(DynamicHelpers.GetPythonTypeFromType(type))
);
}
开发者ID:octavioh,项目名称:ironruby,代码行数:12,代码来源:CustomAttributeTracker.cs
示例9: ParameterWrapper
public ParameterWrapper(ActionBinder binder, ParameterInfo info, Type type, SymbolId name, bool prohibitNull, bool isParams, bool isParamsDict) {
ContractUtils.RequiresNotNull(binder, "binder");
ContractUtils.RequiresNotNull(type, "type");
_type = type;
_prohibitNull = prohibitNull;
_binder = binder;
_info = info;
_name = name;
_isParams = isParams;
_isParamsDict = isParamsDict;
}
开发者ID:mscottford,项目名称:ironruby,代码行数:12,代码来源:ParameterWrapper.cs
示例10: GetError
public override ErrorInfo GetError(ActionBinder binder) {
MethodInfo getter = ResolveGetter(binder.PrivateBinding);
if (getter == null) {
return binder.MakeMissingMemberErrorInfo(DeclaringType, Name);
}
if (getter.ContainsGenericParameters) {
return binder.MakeGenericAccessError(this);
}
throw new InvalidOperationException();
}
开发者ID:jschementi,项目名称:iron,代码行数:13,代码来源:PropertyTracker.cs
示例11: MethodBinderContext
public MethodBinderContext(ActionBinder actionBinder
#if FULL
, StandardRule rule
#endif
)
{
_actionBinder = actionBinder;
#if FULL
_rule = rule;
#endif
}
开发者ID:JamesTryand,项目名称:IronScheme,代码行数:13,代码来源:MethodBinderContext.cs
示例12: GetBoundValue
protected override DynamicMetaObject GetBoundValue(OverloadResolverFactory factory, ActionBinder binder, Type type, DynamicMetaObject instance) {
return new DynamicMetaObject(
Ast.Call(
typeof(PythonOps).GetMethod("SlotGetValue"),
((PythonOverloadResolverFactory)factory)._codeContext,
AstUtils.Constant(GetSlot(), typeof(PythonTypeSlot)),
AstUtils.Convert(
instance.Expression,
typeof(object)
),
AstUtils.Constant(DynamicHelpers.GetPythonTypeFromType(type))
),
BindingRestrictions.Empty
);
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:15,代码来源:CustomAttributeTracker.cs
示例13: ParameterWrapper
public ParameterWrapper(ActionBinder binder, ParameterInfo info)
: this(binder, info.ParameterType) {
_name = SymbolTable.StringToId(info.Name ?? "<unknown>");
#if FULL
_prohibitNull = info.IsDefined(typeof(NotNullAttribute), false);
#endif
_isParams = info.IsDefined(typeof(ParamArrayAttribute), false);
#if FULL
_isParamsDict = info.IsDefined(typeof(ParamDictionaryAttribute), false);
#endif
}
开发者ID:JamesTryand,项目名称:IronScheme,代码行数:15,代码来源:ParameterWrapper.cs
示例14: Initialize
internal static void Initialize(IronSchemeLanguageProvider ironSchemeLanguageProvider)
{
lp = ironSchemeLanguageProvider;
se = lp.GetEngine() as IronSchemeScriptEngine;
scriptmodule = ScriptDomainManager.CurrentManager.Host.DefaultModule as ScriptModule;
ModuleContext mc = new ModuleContext(scriptmodule);
mc.CompilerContext = new CompilerContext(SourceUnit.CreateSnippet(se, ""));
cc = new CodeContext(scriptmodule.Scope, se.GetLanguageContext(), mc);
binder = new IronScheme.Actions.IronSchemeActionBinder(cc);
Generator.initme = true;
}
开发者ID:kkirstein,项目名称:IronScheme,代码行数:17,代码来源:Generator.Helpers.cs
示例15: MakeCallAction
public static MSA.DynamicExpression/*!*/ MakeCallAction(string/*!*/ name, ActionBinder/*!*/ binder, RubyCallSignature signature,
params MSA.Expression[]/*!*/ args) {
RubyCallAction call = RubyCallAction.Make(name, signature);
switch (args.Length) {
case 0: return Ast.Dynamic(call, typeof(object), AstFactory.EmptyExpressions);
case 1: return Ast.Dynamic(call, typeof(object), args[0]);
case 2: return Ast.Dynamic(call, typeof(object), args[0], args[1]);
case 3: return Ast.Dynamic(call, typeof(object), args[0], args[1], args[2]);
case 4: return Ast.Dynamic(call, typeof(object), args[0], args[1], args[2], args[3]);
default:
return Ast.Dynamic(
call,
typeof(object),
new ReadOnlyCollection<MSA.Expression>(args)
);
}
}
开发者ID:joshholmes,项目名称:ironruby,代码行数:17,代码来源:CallBuilder.cs
示例16: GetBoundError
public override ErrorInfo GetBoundError(ActionBinder binder, DynamicMetaObject instance, Type instanceType)
{
MethodInfo getter = ResolveGetter(instanceType, binder.PrivateBinding);
if (getter == null) {
return binder.MakeMissingMemberErrorInfo(DeclaringType, Name);
}
if (getter.ContainsGenericParameters) {
return binder.MakeGenericAccessError(this);
}
if (IsStatic) {
return binder.MakeStaticPropertyInstanceAccessError(this, false, instance);
}
throw new InvalidOperationException();
}
开发者ID:TerabyteX,项目名称:main,代码行数:18,代码来源:PropertyTracker.cs
示例17: GetValue
public override DynamicMetaObject GetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type) {
if (!IsStatic || GetIndexParameters().Length > 0) {
// need to bind to a value or parameters to get the value.
return binder.ReturnMemberTracker(type, this);
}
MethodInfo getter = ResolveGetter(binder.PrivateBinding);
if (getter == null || getter.ContainsGenericParameters) {
// no usable getter
return null;
}
if (getter.IsPublic && getter.DeclaringType.IsPublic) {
return binder.MakeCallExpression(resolverFactory, getter);
}
// private binding is just a call to the getter method...
return MemberTracker.FromMemberInfo(getter).Call(resolverFactory, binder);
}
开发者ID:jschementi,项目名称:iron,代码行数:19,代码来源:PropertyTracker.cs
示例18: MethodBinder
private MethodBinder(ActionBinder binder, string name, IList<MethodBase> methods, BinderType binderType, SymbolId[] kwArgs)
{
_binder = binder;
_name = name;
_binderType = binderType;
_kwArgs = kwArgs;
foreach (MethodBase method in methods) {
if (IsUnsupported(method)) continue;
AddBasicMethodTargets(method);
}
if (_paramsCandidates != null) {
foreach (MethodCandidate maker in _paramsCandidates) {
foreach (int count in _targetSets.Keys) {
MethodCandidate target = maker.MakeParamsExtended(binder, count, _kwArgs);
if (target != null) AddTarget(target);
}
}
}
}
开发者ID:robertlj,项目名称:IronScheme,代码行数:21,代码来源:MethodBinder.cs
示例19: GetBoundValue
protected internal override Expression GetBoundValue(Expression context, ActionBinder binder, Type type, Expression instance) {
return binder.ReturnMemberTracker(type, BindToInstance(instance));
}
开发者ID:bclubb,项目名称:ironruby,代码行数:3,代码来源:MethodTracker.cs
示例20: SetValue
public override DynamicMetaObject SetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value) {
return SetBoundValue(resolverFactory, binder, type, value, new DynamicMetaObject(AstUtils.Constant(null), BindingRestrictions.Empty));
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:3,代码来源:CustomAttributeTracker.cs
注:本文中的Microsoft.Scripting.Actions.ActionBinder类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论