本文整理汇总了C#中Microsoft.Scripting.Actions.ActionBinder类的典型用法代码示例。如果您正苦于以下问题:C# ActionBinder类的具体用法?C# ActionBinder怎么用?C# ActionBinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionBinder类属于Microsoft.Scripting.Actions命名空间,在下文中一共展示了ActionBinder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
);
}
示例2: ParameterWrapper
public ParameterWrapper(ActionBinder binder, ParameterInfo info)
: this(binder, info.ParameterType)
{
_name = SymbolTable.StringToId(info.Name ?? "<unknown>");
_isParams = info.IsDefined(typeof(ParamArrayAttribute), false);
}
示例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));
}
示例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);
}
示例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;
}
示例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)
);
}
示例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));
}
}
示例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))
);
}
示例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;
}
示例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();
}
示例11: MethodBinderContext
public MethodBinderContext(ActionBinder actionBinder
#if FULL
, StandardRule rule
#endif
)
{
_actionBinder = actionBinder;
#if FULL
_rule = rule;
#endif
}
示例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
);
}
示例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
}
示例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;
}
示例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)
);
}
}