本文整理汇总了C#中Microsoft.Scripting.Actions.Calls.RestrictedArguments类的典型用法代码示例。如果您正苦于以下问题:C# RestrictedArguments类的具体用法?C# RestrictedArguments怎么用?C# RestrictedArguments使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RestrictedArguments类属于Microsoft.Scripting.Actions.Calls命名空间,在下文中一共展示了RestrictedArguments类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ToExpression
internal override Expression ToExpression(OverloadResolver resolver, IList<ArgBuilder> builders, RestrictedArguments args, Expression ret) {
if (_returnArgs.Count == 1) {
if (_returnArgs[0] == -1) {
return ret;
}
return Ast.Block(ret, builders[_returnArgs[0]].ToReturnExpression(resolver));
}
Expression[] retValues = new Expression[_returnArgs.Count];
int rIndex = 0;
bool usesRet = false;
foreach (int index in _returnArgs) {
if (index == -1) {
usesRet = true;
retValues[rIndex++] = ret;
} else {
retValues[rIndex++] = builders[index].ToReturnExpression(resolver);
}
}
Expression retArray = AstUtils.NewArrayHelper(typeof(object), retValues);
if (!usesRet) {
retArray = Ast.Block(ret, retArray);
}
return resolver.GetByRefArrayExpression(retArray);
}
开发者ID:Hank923,项目名称:ironruby,代码行数:27,代码来源:ByRefReturnBuilder.cs
示例2: ToExpression
internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
if (_tmp == null) {
_tmp = resolver.GetTemporary(_elementType, "outParam");
}
Debug.Assert(!hasBeenUsed[Index]);
hasBeenUsed[Index] = true;
Expression arg = args.GetObject(Index).Expression;
return Expression.Condition(
Expression.TypeIs(arg, Type),
Expression.Assign(
_tmp,
Expression.Field(
AstUtils.Convert(arg, Type),
Type.GetField("Value")
)
),
Expression.Throw(
Expression.Call(
new Func<Type, object, Exception>(RuntimeHelpers.MakeIncorrectBoxTypeError).Method,
AstUtils.Constant(_elementType),
AstUtils.Convert(arg, typeof(object))
),
_elementType
)
);
}
开发者ID:madpilot,项目名称:ironruby,代码行数:28,代码来源:ReferenceArgBuilder.cs
示例3: ToExpression
internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
if (_tmp == null) {
_tmp = resolver.GetTemporary(Type, "outParam");
}
return Ast.Block(Ast.Assign(_tmp, base.ToExpression(resolver, args, hasBeenUsed)), _tmp);
}
开发者ID:apboyle,项目名称:ironruby,代码行数:7,代码来源:ReturnReferenceArgBuilder.cs
示例4: BindingTarget
private readonly int _actualArgs; // gets the actual number of arguments provided
/// <summary>
/// Creates a new BindingTarget when the method binding has succeeded.
/// </summary>
internal BindingTarget(string name, int actualArgumentCount, MethodCandidate candidate, NarrowingLevel level, RestrictedArguments restrictedArgs) {
_name = name;
_candidate = candidate;
_restrictedArgs = restrictedArgs;
_level = level;
_actualArgs = actualArgumentCount;
}
开发者ID:BenHall,项目名称:ironruby,代码行数:12,代码来源:BindingTarget.cs
示例5: ToExpression
internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
if (_tmp == null) {
_tmp = resolver.GetTemporary(_elementType, "outParam");
}
Debug.Assert(!hasBeenUsed[Index]);
hasBeenUsed[Index] = true;
Type boxType = typeof(StrongBox<>).MakeGenericType(_elementType);
Expression arg = args.GetObject(Index).Expression;
return Expression.Condition(
Expression.TypeIs(arg, Type),
Expression.Assign(
_tmp,
Expression.Field(
AstUtils.Convert(arg, boxType),
boxType.GetField("Value")
)
),
Expression.Call(
typeof(RuntimeHelpers).GetMethod("IncorrectBoxType").MakeGenericMethod(_elementType),
AstUtils.Convert(arg, typeof(object))
)
);
}
开发者ID:Hank923,项目名称:ironruby,代码行数:25,代码来源:ReferenceArgBuilder.cs
示例6: ToExpression
internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
Debug.Assert(BuilderExpectsSingleParameter(_builder));
int index = GetKeywordIndex(args.Length);
Debug.Assert(!hasBeenUsed[index]);
hasBeenUsed[index] = true;
return _builder.ToExpression(resolver, MakeRestrictedArg(args, index), new bool[1]);
}
开发者ID:madpilot,项目名称:ironruby,代码行数:8,代码来源:KeywordArgBuilder.cs
示例7: ToExpression
internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
Expression res = Ast.Call(
typeof(BinderOps).GetMethod("MakeSymbolDictionary"),
Ast.NewArrayInit(typeof(string), ConstantNames()),
AstUtils.NewArrayHelper(typeof(object), GetParameters(args, hasBeenUsed))
);
return res;
}
开发者ID:Hank923,项目名称:ironruby,代码行数:9,代码来源:ParamsDictArgBuilder.cs
示例8: ToExpression
internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
Type dictType = ParameterInfo.ParameterType;
return Ast.Call(
GetCreationDelegate(dictType).Method,
Ast.NewArrayInit(typeof(string), ConstantNames()),
AstUtils.NewArrayHelper(typeof(object), GetParameters(args, hasBeenUsed))
);
}
开发者ID:techarch,项目名称:ironruby,代码行数:9,代码来源:ParamsDictArgBuilder.cs
示例9: UpdateFromReturn
internal override Expression UpdateFromReturn(OverloadResolver resolver, RestrictedArguments args) {
return Expression.Assign(
Expression.Field(
Expression.Convert(args.GetObject(Index).Expression, Type),
Type.GetField("Value")
),
_tmp
);
}
开发者ID:Hank923,项目名称:ironruby,代码行数:9,代码来源:ReferenceArgBuilder.cs
示例10: GetCallableMethod
private void GetCallableMethod(RestrictedArguments args, ref MethodInfo method) {
// If we have a non-visible method see if we can find a better method which
// will call the same thing but is visible. If this fails we still bind anyway - it's
// the callers responsibility to filter out non-visible methods.
//
// We use limit type of the meta instance so that we can access methods inherited to that type
// as accessible via an interface implemented by the type. The type might be internal and the methods
// might not be accessible otherwise.
method = CompilerHelpers.TryGetCallableMethod(args.GetObject(_index).LimitType, method);
}
开发者ID:Hank923,项目名称:ironruby,代码行数:10,代码来源:InstanceBuilder.cs
示例11: ToExpression
internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
if (_isRef) {
if (_tmp == null) {
_tmp = resolver.GetTemporary(_parameterType, "outParam");
}
return _tmp;
}
return GetDefaultValue();
}
开发者ID:Hank923,项目名称:ironruby,代码行数:10,代码来源:OutArgBuilder.cs
示例12: GetParameters
private List<Expression> GetParameters(RestrictedArguments args, bool[] hasBeenUsed) {
List<Expression> res = new List<Expression>(_nameIndexes.Length);
for (int i = 0; i < _nameIndexes.Length; i++) {
int parameterIndex = _nameIndexes[i] + _argIndex;
if (!hasBeenUsed[parameterIndex]) {
res.Add(args.GetObject(parameterIndex).Expression);
hasBeenUsed[parameterIndex] = true;
}
}
return res;
}
开发者ID:techarch,项目名称:ironruby,代码行数:11,代码来源:ParamsDictArgBuilder.cs
示例13: ToExpression
internal protected virtual Expression ToExpression(ref MethodInfo method, OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
if (_index == -1) {
return AstUtils.Constant(null);
}
Debug.Assert(hasBeenUsed.Length == args.Length);
Debug.Assert(_index < args.Length);
Debug.Assert(!hasBeenUsed[_index]);
hasBeenUsed[_index] = true;
GetCallableMethod(args, ref method);
return resolver.Convert(args.GetObject(_index), args.GetType(_index), null, method.DeclaringType);
}
开发者ID:Hank923,项目名称:ironruby,代码行数:13,代码来源:InstanceBuilder.cs
示例14: ToExpression
internal protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
object value = ParameterInfo.DefaultValue;
if (value is Missing) {
value = CompilerHelpers.GetMissingValue(ParameterInfo.ParameterType);
}
if (ParameterInfo.ParameterType.IsByRef) {
return AstUtils.Constant(value, ParameterInfo.ParameterType.GetElementType());
}
var metaValue = new DynamicMetaObject(AstUtils.Constant(value), BindingRestrictions.Empty, value);
return resolver.Convert(metaValue, CompilerHelpers.GetType(value), ParameterInfo, ParameterInfo.ParameterType);
}
开发者ID:madpilot,项目名称:ironruby,代码行数:13,代码来源:DefaultArgBuilder.cs
示例15: ToDelegate
protected internal override Func<object[], object> ToDelegate(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
if (ParameterInfo.ParameterType.IsByRef) {
return null;
} else if (ParameterInfo.DefaultValue is Missing && CompilerHelpers.GetMissingValue(ParameterInfo.ParameterType) is Missing) {
// reflection throws when we do this
return null;
}
object val = ParameterInfo.DefaultValue;
if (val is Missing) {
val = CompilerHelpers.GetMissingValue(ParameterInfo.ParameterType);
}
Debug.Assert(val != Missing.Value);
return (_) => val;
}
开发者ID:apboyle,项目名称:ironruby,代码行数:15,代码来源:DefaultArgBuilder.cs
示例16: ToDelegate
internal protected virtual Func<object[], object> ToDelegate(ref MethodInfo method, OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
if (_index == -1) {
return (_) => null;
}
GetCallableMethod(args, ref method);
Func<object[], object> conv = resolver.GetConvertor(_index + 1, args.GetObject(_index), null, method.DeclaringType);
if (conv != null) {
return conv;
}
return (Func<object[], object>)Delegate.CreateDelegate(
typeof(Func<object[], object>),
_index + 1,
typeof(ArgBuilder).GetMethod("ArgumentRead"));
}
开发者ID:Hank923,项目名称:ironruby,代码行数:17,代码来源:InstanceBuilder.cs
示例17: ToExpression
protected override Expression ToExpression(OverloadResolver/*!*/ resolver, RestrictedArguments/*!*/ args, bool[]/*!*/ hasBeenUsed) {
Debug.Assert(Index < args.Length);
Debug.Assert(Index < hasBeenUsed.Length);
hasBeenUsed[Index] = true;
return null;
}
开发者ID:andreakn,项目名称:ironruby,代码行数:6,代码来源:RubyOverloadResolver.cs
示例18: ToDelegate
protected internal override Func<object[], object> ToDelegate(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
string[] names = _names;
int[] indexes = GetParameters(hasBeenUsed);
Type dictType = ParameterInfo.ParameterType;
Func<string[], object[], object> func = GetCreationDelegate(dictType);
return (actualArgs) => {
object[] values = new object[indexes.Length];
for (int i = 0; i < indexes.Length; i++) {
values[i] = actualArgs[indexes[i] + 1];
}
return func(names, values);
};
}
开发者ID:techarch,项目名称:ironruby,代码行数:16,代码来源:ParamsDictArgBuilder.cs
示例19: GetArgumentExpressions
private Expression[] GetArgumentExpressions(RestrictedArguments restrictedArgs, out bool[] usageMarkers, out Expression[] spilledArgs) {
int minPriority = Int32.MaxValue;
int maxPriority = Int32.MinValue;
foreach (ArgBuilder ab in _argBuilders) {
minPriority = System.Math.Min(minPriority, ab.Priority);
maxPriority = System.Math.Max(maxPriority, ab.Priority);
}
var args = new Expression[_argBuilders.Count];
Expression[] actualArgs = null;
usageMarkers = new bool[restrictedArgs.Length];
for (int priority = minPriority; priority <= maxPriority; priority++) {
for (int i = 0; i < _argBuilders.Count; i++) {
if (_argBuilders[i].Priority == priority) {
args[i] = _argBuilders[i].ToExpression(_resolver, restrictedArgs, usageMarkers);
// see if this has a temp that needs to be passed as the actual argument
Expression byref = _argBuilders[i].ByRefArgument;
if (byref != null) {
if (actualArgs == null) {
actualArgs = new Expression[_argBuilders.Count];
}
actualArgs[i] = byref;
}
}
}
}
if (actualArgs != null) {
for (int i = 0; i < args.Length; i++) {
if (args[i] != null && actualArgs[i] == null) {
actualArgs[i] = _resolver.GetTemporary(args[i].Type, null);
args[i] = Expression.Assign(actualArgs[i], args[i]);
}
}
spilledArgs = RemoveNulls(args);
return RemoveNulls(actualArgs);
}
spilledArgs = null;
return RemoveNulls(args);
}
开发者ID:hansdude,项目名称:Phalanger,代码行数:43,代码来源:MethodCandidate.cs
示例20: ToDelegate
protected override Func<object[], object> ToDelegate(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
object value = Activator.CreateInstance(ParameterInfo.ParameterType);
return (_) => value;
}
开发者ID:andreakn,项目名称:ironruby,代码行数:4,代码来源:SiteLocalStorageBuilder.cs
注:本文中的Microsoft.Scripting.Actions.Calls.RestrictedArguments类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论