Upstream icsharpcode/ILSpy state of the touched files before 53822318d9
This commit is contained in:
1 parent
3f1ef717b6
commit
8e3e41fedb
4 files changed
+909
-15
No files matched your search
@@ -1318,8 +1318,8 @@ namespace ICSharpCode.Decompiler.CSharp
|
||||
return false;
|
||||
|
||||
var firstArgument = argumentList.Arguments[0];
|
||||
bool canWriteTypeArguments = !settings.AnonymousTypes || !method.TypeArguments.Any(a => a.ContainsAnonymousType());
|
||||
bool writeTypeArguments = (transform & ReferenceTransformation.RequireTypeArguments) != 0 && canWriteTypeArguments;
|
||||
bool writeTypeArguments = (transform & ReferenceTransformation.RequireTypeArguments) != 0
|
||||
&& (!settings.AnonymousTypes || !method.TypeArguments.Any(a => a.ContainsAnonymousType()));
|
||||
IType[] typeArguments = writeTypeArguments ? method.TypeArguments.ToArray() : Empty<IType>.Array;
|
||||
|
||||
var directionExpression = firstArgument.Expression as DirectionExpression;
|
||||
@@ -1342,20 +1342,10 @@ namespace ICSharpCode.Decompiler.CSharp
|
||||
string[]? remainingNames = argumentNames?.Take(actualArgumentCount).Skip(1).ToArray();
|
||||
if (remainingNames != null && remainingNames.All(name => name == null))
|
||||
remainingNames = null;
|
||||
var remainingArguments = argumentList.GetArgumentResolveResults(skipCount: 1).ToArray();
|
||||
if (!resolver.CanTransformToExtensionMethodCall(method, typeArguments, target, remainingArguments, remainingNames))
|
||||
if (!resolver.CanTransformToExtensionMethodCall(method, typeArguments, target,
|
||||
argumentList.GetArgumentResolveResults(skipCount: 1).ToArray(), remainingNames))
|
||||
{
|
||||
// 'a?.M()' has no static call form to fall back to. Spelled-out type arguments rule out
|
||||
// extension methods of a different arity, which NullPropagationTransform relies on.
|
||||
if (writeTypeArguments || !canWriteTypeArguments || method.TypeArguments.Count == 0
|
||||
|| !IsNullConditional(firstArgument.Expression))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
writeTypeArguments = true;
|
||||
typeArguments = method.TypeArguments.ToArray();
|
||||
if (!resolver.CanTransformToExtensionMethodCall(method, typeArguments, target, remainingArguments, remainingNames))
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
Expression targetExpression;
|
||||
|
||||
Reference in new issue
Block a user