本文整理汇总了C#中Microsoft.Scripting.Actions.Calls.OverloadResolver类的典型用法代码示例。如果您正苦于以下问题:C# OverloadResolver类的具体用法?C# OverloadResolver怎么用?C# OverloadResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OverloadResolver类属于Microsoft.Scripting.Actions.Calls命名空间,在下文中一共展示了OverloadResolver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: 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
示例3: 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
示例4: ToReturnExpression
internal override Expression ToReturnExpression(OverloadResolver resolver) {
if (_isRef) {
return _tmp;
}
return GetDefaultValue();
}
开发者ID:Hank923,项目名称:ironruby,代码行数:7,代码来源:OutArgBuilder.cs
示例5: ToExpression
internal protected override Expression ToExpression(OverloadResolver resolver, IList<Expression> parameters, bool[] hasBeenUsed) {
if (_tmp == null) {
_tmp = resolver.GetTemporary(Type, "outParam");
}
return Ast.Block(Ast.Assign(_tmp, base.ToExpression(resolver, parameters, hasBeenUsed)), _tmp);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:7,代码来源:ReturnReferenceArgBuilder.cs
示例6: 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
示例7: ToExpression
internal protected override Expression ToExpression(OverloadResolver resolver, IList<Expression> parameters, bool[] hasBeenUsed) {
Debug.Assert(BuilderExpectsSingleParameter(_builder));
int index = GetKeywordIndex(parameters.Count);
Debug.Assert(!hasBeenUsed[index]);
hasBeenUsed[index] = true;
return _builder.ToExpression(resolver, new Expression[] { parameters[index] }, new bool[1]);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:8,代码来源:KeywordArgBuilder.cs
示例8: 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
示例9: ParameterMapping
internal ParameterMapping(OverloadResolver resolver, OverloadInfo method, IList<string> argNames) {
Assert.NotNull(resolver, method);
_resolver = resolver;
_overload = method;
_argNames = argNames;
_parameters = new List<ParameterWrapper>();
_arguments = new List<ArgBuilder>(method.ParameterCount);
_defaultArguments = new List<ArgBuilder>();
}
开发者ID:BenHall,项目名称:ironruby,代码行数:9,代码来源:ParameterMapping.cs
示例10: ToExpression
internal protected override Expression ToExpression(OverloadResolver resolver, IList<Expression> parameters, bool[] hasBeenUsed) {
Expression res = Ast.Call(
typeof(BinderOps).GetMethod("MakeSymbolDictionary"),
Ast.NewArrayInit(typeof(string), ConstantNames()),
AstUtils.NewArrayHelper(typeof(object), GetParameters(parameters, hasBeenUsed))
);
return res;
}
开发者ID:jcteague,项目名称:ironruby,代码行数:9,代码来源:ParamsDictArgBuilder.cs
示例11: 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
示例12: UpdateFromReturn
internal override Expression UpdateFromReturn(OverloadResolver resolver, IList<Expression> parameters) {
return Expression.Assign(
Expression.Field(
Expression.Convert(parameters[Index], Type),
Type.GetField("Value")
),
_tmp
);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:9,代码来源:ReferenceArgBuilder.cs
示例13: 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
示例14: 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
示例15: ParameterMapping
internal ParameterMapping(OverloadResolver resolver, MethodBase method, ParameterInfo[] parameterInfos, IList<string> argNames) {
Assert.NotNull(resolver, method);
_resolver = resolver;
_method = method;
_argNames = argNames;
_parameterInfos = parameterInfos ?? method.GetParameters();
_parameters = new List<ParameterWrapper>();
_arguments = new List<ArgBuilder>(_parameterInfos.Length);
_defaultArguments = new List<ArgBuilder>();
}
开发者ID:teejayvanslyke,项目名称:ironruby,代码行数:10,代码来源:ParameterMapping.cs
示例16: 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
示例17: 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
示例18: 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
示例19: 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
示例20: MethodCandidate
internal MethodCandidate(OverloadResolver resolver, MethodBase method, List<ParameterWrapper> parameters, ParameterWrapper paramsDict,
ReturnBuilder returnBuilder, ArgBuilder instanceBuilder, IList<ArgBuilder> argBuilders) {
Assert.NotNull(resolver, method, instanceBuilder, returnBuilder);
Assert.NotNullItems(parameters);
Assert.NotNullItems(argBuilders);
_resolver = resolver;
_method = method;
_instanceBuilder = instanceBuilder;
_argBuilders = argBuilders;
_returnBuilder = returnBuilder;
_parameters = parameters;
_paramsDict = paramsDict;
_paramsArrayIndex = ParameterWrapper.IndexOfParamsArray(parameters);
parameters.TrimExcess();
}
开发者ID:jcteague,项目名称:ironruby,代码行数:19,代码来源:MethodCandidate.cs
注:本文中的Microsoft.Scripting.Actions.Calls.OverloadResolver类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论