|
|
|
@ -90,10 +90,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
@@ -90,10 +90,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
|
|
|
|
|
if (mre == null || IsNullConditional(mre.Target)) |
|
|
|
|
return null; |
|
|
|
|
switch (mre.MemberName) { |
|
|
|
|
case "Select": |
|
|
|
|
{ |
|
|
|
|
case "Select": { |
|
|
|
|
if (invocation.Arguments.Count != 1) |
|
|
|
|
return null; |
|
|
|
|
if (!IsComplexQuery(mre)) |
|
|
|
|
return null; |
|
|
|
|
ParameterDeclaration parameter; |
|
|
|
|
Expression body; |
|
|
|
|
if (MatchSimpleLambda(invocation.Arguments.Single(), out parameter, out body)) { |
|
|
|
@ -158,6 +159,8 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
@@ -158,6 +159,8 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
|
|
|
|
|
{ |
|
|
|
|
if (invocation.Arguments.Count != 1) |
|
|
|
|
return null; |
|
|
|
|
if (!IsComplexQuery(mre)) |
|
|
|
|
return null; |
|
|
|
|
ParameterDeclaration parameter; |
|
|
|
|
Expression body; |
|
|
|
|
if (MatchSimpleLambda(invocation.Arguments.Single(), out parameter, out body)) { |
|
|
|
@ -175,6 +178,8 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
@@ -175,6 +178,8 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
|
|
|
|
|
{ |
|
|
|
|
if (invocation.Arguments.Count != 1) |
|
|
|
|
return null; |
|
|
|
|
if (!IsComplexQuery(mre)) |
|
|
|
|
return null; |
|
|
|
|
ParameterDeclaration parameter; |
|
|
|
|
Expression orderExpression; |
|
|
|
|
if (MatchSimpleLambda(invocation.Arguments.Single(), out parameter, out orderExpression)) { |
|
|
|
@ -250,6 +255,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
@@ -250,6 +255,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool IsComplexQuery(MemberReferenceExpression mre) |
|
|
|
|
{ |
|
|
|
|
return ((mre.Target is InvocationExpression && mre.Parent is InvocationExpression) || mre.Parent?.Parent is QueryClause); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QueryFromClause MakeFromClause(ParameterDeclaration parameter, Expression body) |
|
|
|
|
{ |
|
|
|
|
QueryFromClause fromClause = new QueryFromClause { |
|
|
|
|