本文整理汇总了C#中Microsoft.Scripting.Actions.Calls.OverloadResolver类的典型用法代码示例。如果您正苦于以下问题:C# OverloadResolver类的具体用法?C# OverloadResolver怎么用?C# OverloadResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OverloadResolver类属于Microsoft.Scripting.Actions.Calls命名空间,在下文中一共展示了OverloadResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
)
);
}
示例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);
}
示例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);
}
示例4: ToReturnExpression
internal override Expression ToReturnExpression(OverloadResolver resolver) {
if (_isRef) {
return _tmp;
}
return GetDefaultValue();
}
示例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);
}
示例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))
)
);
}
示例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]);
}
示例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]);
}
示例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>();
}
示例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;
}
示例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))
);
}
示例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
);
}
示例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
);
}
示例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();
}
示例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>();
}