Skip to content

Commit

Permalink
Undo System.Linq.Expressions changes
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-safar committed Jan 24, 2023
1 parent ec0dec2 commit 982c24d
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)-maccatalyst</TargetFrameworks>
<IsInterpreting>false</IsInterpreting>
<DefineConstants> $(DefineConstants);FEATURE_FAST_CREATE</DefineConstants>
<NoWarn>$(NoWarn);CA1859</NoWarn>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private static ExpressionType GetBinaryOpFromAssignmentOp(ExpressionType op)
};
}

private BinaryExpression ReduceVariable()
private Expression ReduceVariable()
{
// v (op)= r
// ... is reduced into ...
Expand Down Expand Up @@ -216,7 +216,7 @@ private Expression ReduceMember()
}
}

private BlockExpression ReduceIndex()
private Expression ReduceIndex()
{
// left[a0, a1, ... aN] (op)= r
//
Expand Down Expand Up @@ -597,7 +597,7 @@ public static BinaryExpression Assign(Expression left, Expression right)

#endregion

private static MethodBinaryExpression? GetUserDefinedBinaryOperator(ExpressionType binaryType, string name, Expression left, Expression right, bool liftToNull)
private static BinaryExpression? GetUserDefinedBinaryOperator(ExpressionType binaryType, string name, Expression left, Expression right, bool liftToNull)
{
// try exact match first
MethodInfo? method = GetUserDefinedBinaryOperator(binaryType, left.Type, right.Type, name);
Expand Down Expand Up @@ -626,7 +626,7 @@ public static BinaryExpression Assign(Expression left, Expression right)
return null;
}

private static MethodBinaryExpression GetMethodBasedBinaryOperator(ExpressionType binaryType, Expression left, Expression right, MethodInfo method, bool liftToNull)
private static BinaryExpression GetMethodBasedBinaryOperator(ExpressionType binaryType, Expression left, Expression right, MethodInfo method, bool liftToNull)
{
System.Diagnostics.Debug.Assert(method != null);
ValidateOperator(method);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1024,8 +1024,7 @@ public static BlockExpression Block(Type type, IEnumerable<ParameterExpression>?
return BlockCore(type, variableList, expressionList);
}

#pragma warning disable CA1859 // https://github.com/dotnet/roslyn-analyzers/issues/6452
private static ScopeExpression BlockCore(Type? type, ReadOnlyCollection<ParameterExpression> variables, ReadOnlyCollection<Expression> expressions)
private static BlockExpression BlockCore(Type? type, ReadOnlyCollection<ParameterExpression> variables, ReadOnlyCollection<Expression> expressions)
{
ValidateVariables(variables, nameof(variables));

Expand Down Expand Up @@ -1062,7 +1061,6 @@ private static ScopeExpression BlockCore(Type? type, ReadOnlyCollection<Paramete
_ => new ScopeN(variables, expressions),
};
}
#pragma warning restore CA1859

// Checks that all variables are non-null, not byref, and unique.
internal static void ValidateVariables(ReadOnlyCollection<ParameterExpression> varList, string collectionName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal sealed partial class StackSpiller
/// This should not be used for rewriting BlockExpression itself, or
/// anything else that supports jumping.
/// </summary>
private static SpilledExpressionBlock MakeBlock(ArrayBuilder<Expression> expressions)
private static Expression MakeBlock(ArrayBuilder<Expression> expressions)
{
return new SpilledExpressionBlock(expressions.ToArray());
}
Expand All @@ -25,7 +25,7 @@ private static SpilledExpressionBlock MakeBlock(ArrayBuilder<Expression> express
/// This should not be used for rewriting BlockExpression itself, or
/// anything else that supports jumping.
/// </summary>
private static SpilledExpressionBlock MakeBlock(params Expression[] expressions)
private static Expression MakeBlock(params Expression[] expressions)
{
return new SpilledExpressionBlock(expressions);
}
Expand All @@ -35,7 +35,7 @@ private static SpilledExpressionBlock MakeBlock(params Expression[] expressions)
/// This should not be used for rewriting BlockExpression itself, or
/// anything else that supports jumping.
/// </summary>
private static SpilledExpressionBlock MakeBlock(IReadOnlyList<Expression> expressions)
private static Expression MakeBlock(IReadOnlyList<Expression> expressions)
{
return new SpilledExpressionBlock(expressions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2199,7 +2199,7 @@ private void CompileMethodCallExpression(Expression @object, MethodInfo method,
}
}

private ArrayByRefUpdater CompileArrayIndexAddress(Expression array, Expression index, int argumentIndex)
private ByRefUpdater CompileArrayIndexAddress(Expression array, Expression index, int argumentIndex)
{
LocalDefinition left = _locals.DefineLocal(Expression.Parameter(array.Type, nameof(array)), _instructions.Count);
LocalDefinition right = _locals.DefineLocal(Expression.Parameter(index.Type, nameof(index)), _instructions.Count);
Expand Down Expand Up @@ -2353,7 +2353,7 @@ private static bool ShouldWritebackNode(Expression node)
return null;
}

private IndexMethodByRefUpdater CompileMultiDimArrayAccess(Expression array, IArgumentProvider arguments, int index)
private ByRefUpdater CompileMultiDimArrayAccess(Expression array, IArgumentProvider arguments, int index)
{
Compile(array);
LocalDefinition objTmp = _locals.DefineLocal(Expression.Parameter(array.Type), _instructions.Count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ protected internal override Expression VisitRuntimeVariables(RuntimeVariablesExp
);
}

private static RuntimeOps.MergedRuntimeVariables MergeRuntimeVariables(IRuntimeVariables first, IRuntimeVariables second, int[] indexes)
private static IRuntimeVariables MergeRuntimeVariables(IRuntimeVariables first, IRuntimeVariables second, int[] indexes)
{
return new RuntimeOps.MergedRuntimeVariables(first, second, indexes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public override Expression Reduce()
return ReduceMemberInit(NewExpression, Bindings, keepOnStack: true);
}

private static BlockExpression ReduceMemberInit(
private static Expression ReduceMemberInit(
Expression objExpression, ReadOnlyCollection<MemberBinding> bindings, bool keepOnStack)
{
ParameterExpression objVar = Variable(objExpression.Type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ internal Expression ReduceTypeEqual()
}

// Helper that is used when re-eval of LHS is safe.
private BinaryExpression ByValParameterTypeEqual(ParameterExpression value)
private Expression ByValParameterTypeEqual(ParameterExpression value)
{
Expression getType = Expression.Call(value, Object_GetType);

Expand Down Expand Up @@ -135,7 +135,7 @@ private BinaryExpression ByValParameterTypeEqual(ParameterExpression value)
);
}

private ConstantExpression ReduceConstantTypeEqual()
private Expression ReduceConstantTypeEqual()
{
ConstantExpression? ce = Expression as ConstantExpression;
//TypeEqual(null, T) always returns false.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private Expression ReduceMember()
}
}

private BlockExpression ReduceIndex()
private Expression ReduceIndex()
{
// left[a0, a1, ... aN] (op)
//
Expand Down

0 comments on commit 982c24d

Please sign in to comment.