本文整理汇总了C#中Microsoft.CSharp.Expressions.DynamicCSharpArgument类的典型用法代码示例。如果您正苦于以下问题:C# DynamicCSharpArgument类的具体用法?C# DynamicCSharpArgument怎么用?C# DynamicCSharpArgument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DynamicCSharpArgument类属于Microsoft.CSharp.Expressions命名空间,在下文中一共展示了DynamicCSharpArgument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AssignBinaryDynamicCSharpExpression
internal AssignBinaryDynamicCSharpExpression(Type context, CSharpBinderFlags binderFlags, CSharpExpressionType binaryType, DynamicCSharpArgument left, DynamicCSharpArgument right)
: base(context, binderFlags)
{
OperationNodeType = binaryType;
Left = left;
Right = right;
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:7,代码来源:AssignBinaryDynamicCSharpExpression.cs
示例2: ReduceDynamicAssignment
public static Expression ReduceDynamicAssignment(DynamicCSharpArgument left, Func<Expression, Expression> functionalOp, CSharpBinderFlags flags, bool prefix = true)
{
var lhs = MakeWriteable(left.Expression);
var dynamicMember = lhs as GetMemberDynamicCSharpExpression;
if (dynamicMember != null)
{
return ReduceDynamicMember(dynamicMember, functionalOp, flags, prefix);
}
var dynamicIndex = lhs as GetIndexDynamicCSharpExpression;
if (dynamicIndex != null)
{
return ReduceDynamicIndex(dynamicIndex, functionalOp, flags, prefix);
}
return Helpers.ReduceAssignment(lhs, functionalOp, prefix);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:18,代码来源:DynamicHelpers.cs
示例3: VisitDynamicArgument
protected internal virtual DynamicCSharpArgument VisitDynamicArgument(DynamicCSharpArgument node)
{
return node.Update(Visit(node.Expression));
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:4,代码来源:DynamicCSharpArgument.cs
示例4: Update
/// <summary>
/// Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression.
/// </summary>
/// <param name="operand">The <see cref="Operand" /> property of the result.</param>
/// <returns>This expression if no children changed, or an expression with the updated children.</returns>
public UnaryDynamicCSharpExpression Update(DynamicCSharpArgument operand)
{
if (operand == this.Operand)
{
return this;
}
return DynamicCSharpExpression.MakeDynamicUnary(OperationNodeType, operand, Flags, Context);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:14,代码来源:UnaryDynamicCSharpExpression.cs
示例5: MakeDynamicUnary
/// <summary>
/// Creates a new expression representing a dynamically bound unary operation with the specified binder flags and the specified type context.
/// </summary>
/// <param name="unaryType">The type of the unary operation to perform.</param>
/// <param name="operand">The dynamic argument representing the operand of the operation.</param>
/// <param name="binderFlags">The binder flags to use for the dynamic operation.</param>
/// <param name="context">The type representing the context in which the dynamic operation is bound.</param>
/// <returns>A new expression representing a dynamically bound unary operation.</returns>
public static UnaryDynamicCSharpExpression MakeDynamicUnary(ExpressionType unaryType, DynamicCSharpArgument operand, CSharpBinderFlags binderFlags, Type context)
{
ContractUtils.RequiresNotNull(operand, nameof(operand));
CheckUnary(unaryType);
switch (unaryType)
{
case ExpressionType.NegateChecked:
binderFlags |= CSharpBinderFlags.CheckedContext;
break;
}
return new UnaryDynamicCSharpExpression(context, binderFlags, unaryType, operand);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:23,代码来源:UnaryDynamicCSharpExpression.cs
示例6: ReduceCore
private Expression ReduceCore(DynamicCSharpArgument left)
{
var functionalOp = new Func<Expression, Expression>(lhs =>
{
var operation = default(ExpressionType);
switch (OperationNodeType)
{
case CSharpExpressionType.AddAssign:
case CSharpExpressionType.AddAssignChecked:
operation = ExpressionType.AddAssign;
break;
case CSharpExpressionType.SubtractAssign:
case CSharpExpressionType.SubtractAssignChecked:
operation = ExpressionType.SubtractAssign;
break;
case CSharpExpressionType.MultiplyAssign:
case CSharpExpressionType.MultiplyAssignChecked:
operation = ExpressionType.MultiplyAssign;
break;
case CSharpExpressionType.DivideAssign:
operation = ExpressionType.DivideAssign;
break;
case CSharpExpressionType.ModuloAssign:
operation = ExpressionType.ModuloAssign;
break;
case CSharpExpressionType.AndAssign:
operation = ExpressionType.AndAssign;
break;
case CSharpExpressionType.OrAssign:
operation = ExpressionType.OrAssign;
break;
case CSharpExpressionType.ExclusiveOrAssign:
operation = ExpressionType.ExclusiveOrAssign;
break;
case CSharpExpressionType.LeftShiftAssign:
operation = ExpressionType.LeftShiftAssign;
break;
case CSharpExpressionType.RightShiftAssign:
operation = ExpressionType.RightShiftAssign;
break;
default:
throw ContractUtils.Unreachable;
}
var args = new[]
{
CSharpArgumentInfo.Create(GetArgumentInfoFlags(Left), null),
CSharpArgumentInfo.Create(GetArgumentInfoFlags(Right), null),
};
var binder = Binder.BinaryOperation(Flags, operation, Context, args);
var dynamic = DynamicHelpers.MakeDynamic(typeof(object), binder, new[] { lhs, Right.Expression }, new[] { lhs.Type, Right.Expression.Type });
var leftType = Left.Expression.Type;
if (leftType != dynamic.Type)
{
var convert = Binder.Convert(CSharpBinderFlags.ConvertExplicit, leftType, Context);
dynamic = DynamicHelpers.MakeDynamic(leftType, convert, new[] { dynamic }, null);
}
return dynamic;
});
var flags = Flags | CSharpBinderFlags.ValueFromCompoundAssignment;
var res = DynamicHelpers.ReduceDynamicAssignment(left, functionalOp, flags);
return res;
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:71,代码来源:AssignBinaryDynamicCSharpExpression.cs
示例7: MakeDynamicBinaryAssign
/// <summary>
/// Creates a new expression representing a dynamically bound binary assignment operation with the specified binder flags.
/// </summary>
/// <param name="binaryType">The type of the binary operation to perform.</param>
/// <param name="left">The dynamic argument representing the left operand of the operation.</param>
/// <param name="right">The dynamic argument representing the right operand of the operation.</param>
/// <param name="binderFlags">The binder flags to use for the dynamic operation.</param>
/// <returns>A new expression representing a dynamically bound binary operation.</returns>
public static AssignBinaryDynamicCSharpExpression MakeDynamicBinaryAssign(CSharpExpressionType binaryType, DynamicCSharpArgument left, DynamicCSharpArgument right, CSharpBinderFlags binderFlags)
{
return MakeDynamicBinaryAssign(binaryType, left, right, binderFlags, null);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:12,代码来源:AssignBinaryDynamicCSharpExpression.cs
示例8: DynamicPreIncrementAssignChecked
public static AssignUnaryDynamicCSharpExpression DynamicPreIncrementAssignChecked(DynamicCSharpArgument operand, CSharpBinderFlags binderFlags, Type context)
{
return MakeDynamicUnaryAssign(CSharpExpressionType.PreIncrementAssignChecked, operand, binderFlags, context);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:4,代码来源:AssignDynamicCSharpExpression.Generated.cs
示例9: DynamicPostIncrementAssignChecked
/// <summary>
/// Creates a new expression representing a dynamically bound unary 'PostIncrementAssignChecked' operation.
/// </summary>
/// <param name="operand">The dynamic argument representing the operand of the operation.</param>
/// <returns>A new expression representing a dynamically bound unary 'PostIncrementAssignChecked' operation.</returns>
public static AssignUnaryDynamicCSharpExpression DynamicPostIncrementAssignChecked(DynamicCSharpArgument operand)
{
return MakeDynamicUnaryAssign(CSharpExpressionType.PostIncrementAssignChecked, operand);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:9,代码来源:AssignDynamicCSharpExpression.Generated.cs
示例10: DynamicPreDecrementAssign
/// <summary>
/// Creates a new expression representing a dynamically bound unary 'PreDecrementAssign' operation.
/// </summary>
/// <param name="operand">The dynamic argument representing the operand of the operation.</param>
/// <returns>A new expression representing a dynamically bound unary 'PreDecrementAssign' operation.</returns>
public static AssignUnaryDynamicCSharpExpression DynamicPreDecrementAssign(DynamicCSharpArgument operand)
{
return MakeDynamicUnaryAssign(CSharpExpressionType.PreDecrementAssign, operand);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:9,代码来源:AssignDynamicCSharpExpression.Generated.cs
示例11: DynamicAndAssign
/// <summary>
/// Creates a new expression representing a dynamically bound binary 'AndAssign' operation.
/// </summary>
/// <param name="left">The dynamic argument representing the left operand of the operation.</param>
/// <param name="right">The dynamic argument representing the right operand of the operation.</param>
/// <returns>A new expression representing a dynamically bound binary 'AndAssign' operation.</returns>
public static AssignBinaryDynamicCSharpExpression DynamicAndAssign(DynamicCSharpArgument left, DynamicCSharpArgument right)
{
return MakeDynamicBinaryAssign(CSharpExpressionType.AndAssign, left, right);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:10,代码来源:AssignDynamicCSharpExpression.Generated.cs
示例12: DynamicSubtractAssignChecked
public static AssignBinaryDynamicCSharpExpression DynamicSubtractAssignChecked(DynamicCSharpArgument left, DynamicCSharpArgument right, CSharpBinderFlags binderFlags)
{
return MakeDynamicBinaryAssign(CSharpExpressionType.SubtractAssignChecked, left, right, binderFlags);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:4,代码来源:AssignDynamicCSharpExpression.Generated.cs
示例13: DynamicMultiplyAssignChecked
/// <summary>
/// Creates a new expression representing a dynamically bound binary 'MultiplyAssignChecked' operation.
/// </summary>
/// <param name="left">The dynamic argument representing the left operand of the operation.</param>
/// <param name="right">The dynamic argument representing the right operand of the operation.</param>
/// <returns>A new expression representing a dynamically bound binary 'MultiplyAssignChecked' operation.</returns>
public static AssignBinaryDynamicCSharpExpression DynamicMultiplyAssignChecked(DynamicCSharpArgument left, DynamicCSharpArgument right)
{
return MakeDynamicBinaryAssign(CSharpExpressionType.MultiplyAssignChecked, left, right);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:10,代码来源:AssignDynamicCSharpExpression.Generated.cs
示例14: DynamicRightShiftAssign
public static AssignBinaryDynamicCSharpExpression DynamicRightShiftAssign(DynamicCSharpArgument left, DynamicCSharpArgument right, CSharpBinderFlags binderFlags)
{
return MakeDynamicBinaryAssign(CSharpExpressionType.RightShiftAssign, left, right, binderFlags);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:4,代码来源:AssignDynamicCSharpExpression.Generated.cs
示例15: DynamicAssign
/// <summary>
/// Creates a new expression representing a dynamically bound binary assignment operation with the specified binder flags and the specified type context.
/// </summary>
/// <param name="left">The dynamic argument representing the left operand of the operation.</param>
/// <param name="right">The dynamic argument representing the right operand of the operation.</param>
/// <param name="binderFlags">The binder flags to use for the dynamic operation.</param>
/// <param name="context">The type representing the context in which the dynamic operation is bound.</param>
/// <returns>A new expression representing a dynamically bound binary operation.</returns>
public static AssignBinaryDynamicCSharpExpression DynamicAssign(DynamicCSharpArgument left, DynamicCSharpArgument right, CSharpBinderFlags binderFlags, Type context)
{
return MakeDynamicBinaryAssign(CSharpExpressionType.Assign, left, right, binderFlags, context);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:12,代码来源:AssignDynamicCSharpExpression.cs
示例16: DynamicPostDecrementAssignChecked
public static AssignUnaryDynamicCSharpExpression DynamicPostDecrementAssignChecked(DynamicCSharpArgument operand, CSharpBinderFlags binderFlags)
{
return MakeDynamicUnaryAssign(CSharpExpressionType.PostDecrementAssignChecked, operand, binderFlags);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:4,代码来源:AssignDynamicCSharpExpression.Generated.cs
示例17: CopyArguments
private static int CopyArguments(Expression receiver, ReadOnlyCollection<DynamicCSharpArgument> arguments, bool prefix, out DynamicCSharpArgument[] args, out Expression[] block, out ParameterExpression[] temps)
{
var n = arguments.Count;
args = new DynamicCSharpArgument[n];
block = new Expression[n + (prefix ? 2 : 4)];
temps = new ParameterExpression[n + (prefix ? 1 : 2)];
// ISSUE: If `receiver` is a value type, we're creating a copy here. How do we capture it
// as a `ref` instead? See https://github.com/dotnet/corefx/issues/4984 for this issue
// in the LINQ API as well.
var i = 0;
temps[i] = Expression.Parameter(receiver.Type, "__object");
block[i] = Expression.Assign(temps[i], receiver);
i++;
while (i <= n)
{
var arg = arguments[i - 1];
temps[i] = Expression.Parameter(arg.Expression.Type, "__arg" + i);
args[i - 1] = arg.Update(temps[i]);
block[i] = Expression.Assign(temps[i], arg.Expression);
i++;
}
return i;
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:28,代码来源:DynamicHelpers.cs
示例18: MakeDynamicBinary
/// <summary>
/// Creates a new expression representing a dynamically bound binary operation.
/// </summary>
/// <param name="binaryType">The type of the binary operation to perform.</param>
/// <param name="left">The dynamic argument representing the left operand of the operation.</param>
/// <param name="right">The dynamic argument representing the right operand of the operation.</param>
/// <returns>A new expression representing a dynamically bound binary operation.</returns>
public static BinaryDynamicCSharpExpression MakeDynamicBinary(ExpressionType binaryType, DynamicCSharpArgument left, DynamicCSharpArgument right)
{
return MakeDynamicBinary(binaryType, left, right, CSharpBinderFlags.None, null);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:11,代码来源:BinaryDynamicCSharpExpression.cs
示例19: GetArgumentInfoFlags
private static CSharpArgumentInfoFlags GetArgumentInfoFlags(DynamicCSharpArgument argument)
{
// TODO: Can we infer UseCompileTimeType?
return argument.Flags;
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:5,代码来源:AssignBinaryDynamicCSharpExpression.cs
示例20: Update
/// <summary>
/// Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression.
/// </summary>
/// <param name="left">The <see cref="Left" /> property of the result.</param>
/// <param name="right">The <see cref="Right" /> property of the result.</param>
/// <returns>This expression if no children changed, or an expression with the updated children.</returns>
public AssignBinaryDynamicCSharpExpression Update(DynamicCSharpArgument left, DynamicCSharpArgument right)
{
if (left == this.Left && right == this.Right)
{
return this;
}
return DynamicCSharpExpression.MakeDynamicBinaryAssign(OperationNodeType, left, right, Flags, Context);
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:15,代码来源:AssignBinaryDynamicCSharpExpression.cs
注:本文中的Microsoft.CSharp.Expressions.DynamicCSharpArgument类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论